Skip to content

Bundle schema fixes - #2084

Open
peter-targett wants to merge 5 commits into
AcademySoftwareFoundation:mainfrom
peter-targett:bundle-schema
Open

peter-targett wants to merge 5 commits into
AcademySoftwareFoundation:mainfrom
peter-targett:bundle-schema

Conversation

@peter-targett

Copy link
Copy Markdown
Contributor

Summary

Fix schema upgrades re-applying the upgrade to the current version (98b8dee)

Upgrade functions are registered against the version they upgrade to, but
_instance_from_schema also ran the upgrade for the version the object was already at
(schema_version <= e.first).

Upgrades now only apply to versions above the object's own. Also corrected
test_upgrade_versions, which fed version 2 data labelled as version 3 and so
encoded the old behaviour.

Allow bundles to be written at older schema versions (c866e70)

Add bundle::WriteOptions::target_schema_versions, which is passed through to the
JSON writer - this lets an .otiod/.otioz be written for an older OTIO to read,
e.g. "0.18.1" versions, which have Marker.2.

The otiod and otioz adapters take a matching target_schema_versions argument. Like
otio_json, they fall back to OTIO_DEFAULT_TARGET_VERSION_FAMILY_LABEL when it
isn't given, so otioconvert can downgrade bundles too:

  otioconvert -i in.otio -o out.otioz -A target_schema_versions="{'Marker':2}"

Documentation

  • otio-filebundles.md: new "target_schema_versions Optional Argument" section
  • versioning-schemas.md: the env var and otioconvert sections now cover bundles, plus the
    C++ option
  • otio-plugins.md: regenerated for the new adapter argument

Testing

  • tests/test_marker.py: reads a genuine Marker.2 file
  • tests/test_serializable_object.py: corrected upgrade test
  • tests/test_otiod.py: writes a bundle via otio.adapters.write_to_file with
    target_schema_versions, and via the env var fallback
  • tests/test_otioz.py: same for .otioz, checking content.otio inside the zip
  • Manually checked the otioconvert example above: the bundle's content.otio contains
    Marker.2

peter-targett and others added 3 commits October 30, 2026 17:58
Upgrade functions are registered against the version they upgrade *to*,
but _instance_from_schema also ran the function for the version the
object was already at (schema_version <= e.first). With Marker at
version 3, every Marker.2 file - what all released OTIO and NLEs write -
re-ran the 1 -> 2 upgrade, which copied the absent "range" over
"marked_range", so the file failed to load with "expected type TimeRange
under key 'marked_range': found type None".

Only apply upgrades to versions above the object's own. Add a test that
reads a genuine Marker.2, and correct test_upgrade_versions, which fed
version 2 data labelled as version 3 and so encoded the old behaviour.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Targett <petert@filmlight.ltd.uk>
Add bundle::WriteOptions::target_schema_versions, passed through to the
JSON writer, so an .otiod/.otioz can be written for an older OTIO to read
(e.g. at the CORE_VERSION_MAP "0.18.1" versions, which have Marker.2).

The otiod and otioz adapters take a matching target_schema_versions
argument and, like otio_json, fall back to
OTIO_DEFAULT_TARGET_VERSION_FAMILY_LABEL, so otioconvert can downgrade
bundles too. Document this in the file bundle and versioning tutorials,
and regenerate the plugin documentation.

Signed-off-by: Peter Targett <petert@filmlight.ltd.uk>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Targett <131255921+peter-targett@users.noreply.github.com>
@codecov-commenter

codecov-commenter commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.67%. Comparing base (80c5ff3) to head (aee5715).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2084      +/-   ##
==========================================
+ Coverage   83.59%   83.67%   +0.08%     
==========================================
  Files         184      184              
  Lines       13632    13691      +59     
  Branches     1271     1273       +2     
==========================================
+ Hits        11395    11456      +61     
+ Misses       2064     2063       -1     
+ Partials      173      172       -1     
Flag Coverage Δ
py-unittests 83.67% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/opentimelineio/bundle.cpp 49.44% <100.00%> (+0.22%) ⬆️
src/opentimelineio/typeRegistry.cpp 83.15% <100.00%> (ø)
...timelineio/opentimelineio-bindings/otio_bundle.cpp 69.56% <100.00%> (+0.67%) ⬆️
...py-opentimelineio/opentimelineio/adapters/otiod.py 89.47% <100.00%> (+3.75%) ⬆️
...py-opentimelineio/opentimelineio/adapters/otioz.py 80.00% <100.00%> (+6.66%) ⬆️
tests/test_marker.py 97.33% <100.00%> (+0.19%) ⬆️
tests/test_otiod.py 96.42% <100.00%> (+1.83%) ⬆️
tests/test_otioz.py 95.55% <100.00%> (+4.25%) ⬆️
tests/test_serializable_object.py 93.37% <100.00%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 80c5ff3...aee5715. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Peter Targett <petert@filmlight.ltd.uk>
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.

2 participants