Skip to content

Work/88 trait versioning#4

Closed
feltech wants to merge 22 commits into
mainfrom
work/88-traitVersioning
Closed

Work/88 trait versioning#4
feltech wants to merge 22 commits into
mainfrom
work/88-traitVersioning

Conversation

@feltech

@feltech feltech commented Oct 1, 2025

Copy link
Copy Markdown
Owner

No description provided.

Part of OpenAssetIO#80. The .editorconfig setting were only applied to `.yml` and
not `.yaml`, yet our tests use `.yaml`.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Part of OpenAssetIO#80. The main OpenAssetIO project updated to Clang-Tidy 19 in
OpenAssetIO/OpenAssetIO#1390. The TraitGen C++ tests run the generated
code through `clang-tidy`, which failed for v19, specifically the
`modernize-use-auto` check.

So tweak the C++ code template to satisfy the failing check, allowing
us to use a common Clang-Tidy version across projects.

Signed-off-by: David Feltell <david.feltell@foundry.com>
@feltech feltech force-pushed the work/88-traitVersioning branch 2 times, most recently from 6e426c8 to 12fc9c2 Compare October 1, 2025 17:34
feltech added 13 commits October 1, 2025 18:50
Part of OpenAssetIO#80. The `unique_name_parts` field is not, in general, a tuple
of a single element. In order to allow for arbitrary length tuples, we
must suffix an ellipsis.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Closes OpenAssetIO#80. Update the schema to support a dictionary of "versions" for
traits and specifications, where each version contains the full
trait/specification definition.

Use string keys for the version, rather than integer keys, to provide
maximum scope for future extension (e.g. tagged, semver). This decision
was not called out in the original design.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Add version specifiers to `TraitDeclaration`, `TraitReference` and
`SpecificationDeclaration` for use in constructing IDs and class names.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Add a `.v1` suffix to trait IDs and an `_v1` suffix to trait and
specification class names (where `1` is the version string).

Update log output from command-line script to add version numbers.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Signed-off-by: David Feltell <david.feltell@foundry.com>
Do not add a version suffix to the ID for the first version of a trait,
to maintain backward compatibility.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Add trait classes that match the previous scheme, i.e. with no `_v1`
suffix, which alias the first version of a trait, to maintain backward
compatibility. Use inheritance to ensure maximum compatibility, rather
than duplicating the class.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Signed-off-by: David Feltell <david.feltell@foundry.com>
More thoroughly test docstring generation, hence fix discovered
issue with C++ docstring.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Mark non-versioned trait view classes as deprecated in the docstring.
They are only for backward compatibility - going forward, hosts/managers
should be explicit and use the version-suffixed classes.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Since we're now using the `to_python_*_name` filters multiple times for
the same input (in particular, class names), we're duplicating the same
"Conforming" warning logs several times. So de-duplicate by keeping a
cache of warnings that have already been logged.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Signed-off-by: David Feltell <david.feltell@foundry.com>
Add a `DeprecationWarning` using the `warnings` module when an
unversioned trait view class is first constructed. Use the class name
in the warning text, so a separate warning will be generated for each
non-migrated class.

Signed-off-by: David Feltell <david.feltell@foundry.com>
@feltech feltech force-pushed the work/88-traitVersioning branch from 12fc9c2 to 69b8b40 Compare October 1, 2025 17:50
Add `[[deprecated]]` annotation to non-versioned trait view classes.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Similarly to traits, add unversioned Specification view classes for
backward compatibility, with deprecation warnings.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Signed-off-by: David Feltell <david.feltell@foundry.com>
Add a "deprecated" tag to the schema, allowing traits and specifications
to be flagged as due for complete removal (i.e. all versions).

Signed-off-by: David Feltell <david.feltell@foundry.com>
Add deprecation docstrings and warnings for traits and specifications
flagged with `deprecated: true`. Flag warnings at runtime in Python
using the `warnings` module and C++ at compile time using the
`[[deprecated]]` annotation.

Signed-off-by: David Feltell <david.feltell@foundry.com>
@feltech feltech force-pushed the work/88-traitVersioning branch from 69b8b40 to 7280d76 Compare October 1, 2025 17:54
Add a CTest target for testing C++ deprecation warnings. Hence remove
suppressions from the source and suppress at the compiler warning
level, other than for the explicit deprecation warning test.
Unfortunately, testing multiple raw string matches in build output via
CTest is rather involved, but can be made to work.

Signed-off-by: David Feltell <david.feltell@foundry.com>
Signed-off-by: David Feltell <david.feltell@foundry.com>
@feltech feltech force-pushed the work/88-traitVersioning branch from 7280d76 to 7d76d22 Compare October 1, 2025 18:09
@feltech feltech closed this Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant