Skip to content

fix(python): deep-freeze nonportable extension data - #713

Draft
MikeCarlo wants to merge 12 commits into
apache:mainfrom
MikeCarlo:feat/nonportable-extension-deep-freeze
Draft

MikeCarlo wants to merge 12 commits into
apache:mainfrom
MikeCarlo:feat/nonportable-extension-deep-freeze

Conversation

@MikeCarlo

Copy link
Copy Markdown
Contributor

Summary

Deep-freezes OssieNonportableExtension.data in the Python models so the model's frozen=True config actually holds for the payload.

This addresses the Copilot review on #522 (#522 (comment)) and was split out of #522 at reviewer request.

  • data is annotated Mapping[str, Any].
  • After validation, the payload is copied and frozen: mappings become MappingProxyType, lists become tuples, recursively. The caller's input dict is not aliased.
  • A field serializer converts back to plain dicts and lists, so model_dump(), model_dump(mode="json"), and YAML/JSON output are unchanged.
  • The model is still not hashable, same as before and as other frozen models that hold collections.

Depends on #522. This branch is stacked on #522, so the diff includes #522's commits until it merges. After that I will rebase so only this change remains (one commit touching python/src/ossie/models.py and python/tests/test_validation.py).

No spec, schema, or docs/spec_changes.md change: this is Python package behavior only.

Related Issues

Follow-up to #522.

Checklist

Specification

  • Spec changes are included in core-spec/ and follow the existing structure (n/a)
  • Spec changes have been discussed on the mailing list or in a linked issue (n/a)
  • Breaking changes to the spec are clearly called out in the summary (n/a)
  • For a material spec change, docs/spec_changes.md records rationale, compatibility and migration impact, or the PR explains why no entry is needed (no spec change)

Tests

  • All existing tests pass (pytest / CI green): local runs pass (validation/test_validate.py 59, validation/tests 615, python/tests 280, generate-spec-types --check, example validators, audit-spec-changes); GitHub CI awaits fork-workflow approval
  • New functionality is covered by tests (test_nonportable_extension_data_is_deep_frozen_and_not_aliased, test_nonportable_extension_round_trip_emits_plain_dicts)

Compliance

  • ASF license headers are present on all new source files (no new files)

MikeCarlo and others added 12 commits November 10, 2026 15:35
… rules

Add a migration note for string data, require JSON-representable data,
require consumers to preserve unknown data, note null preservation,
align Vendor examples with extensions/vendors.md, and test non-object
rejection at every custom_extensions location.
Core semantics do not depend on any property in the extension area.
The old field name is not accepted. validate.py rejects dates,
timestamps, and non-finite floats under data, and the spec states the
YAML retyping that check cannot catch.

BREAKING CHANGE: custom_extensions is renamed to nonportable_extensions
with no alias. data remains an object. A date, timestamp, or non-finite
float under data is a schema error.

Co-authored-by: Mike Carlo <mike@powerbi.tips>
Add a field guide for nonportable_extensions with the YAML cases
validate.py rejects and the ones it still accepts after retyping.

Co-authored-by: Mike Carlo <mike@powerbi.tips>
Keep the custom_extensions rename only in the 0.3.0.dev0 version
history. Point the schema data description at the spec section, and
leave quoting details in the field guide.

Co-authored-by: Mike Carlo <mike@powerbi.tips>
Add the unreleased 0.3.0.dev0 rename and object-data change to the
significant-change history, which is where migration impact belongs.

Co-authored-by: Mike Carlo <mike@powerbi.tips>
Keep nested extension payloads from being mutated after validation, and
serialize them back to plain dicts and lists.

Co-authored-by: Mike Carlo <mike@powerbi.tips>
…a separate PR)

This reverts commit 77659ec.

Co-authored-by: Mike Carlo <mike@powerbi.tips>
Keep nested extension payloads from being mutated after validation, and
serialize them back to plain dicts and lists.

Co-authored-by: Mike Carlo <mike@powerbi.tips>
ekut added a commit to Dactopus/dactopus-ossie-clickhouse that referenced this pull request Nov 11, 2026
apache/ossie#522 renamed custom_extensions to nonportable_extensions and
made its data an object instead of a string holding JSON, keeping the
schema version 0.3.0.dev0. Vendor apache-ossie at af7630c, read and write
the entry in the new form, and name the change when a model still uses
the old one: the SDK refuses it, so it is not read.

Messages show data values without json.dumps on them directly, so a
frozen data object (apache/ossie#713) still prints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants