feat(tdf): spec-compliant container — manifest.json entry, payload from payload.url - #188
arkavo-com wants to merge 9 commits into
Conversation
… fallback Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…e ValueError UnicodeDecodeError is a ValueError subclass, so the __init__ passthrough guard (meant only for the resolvers' own missing-manifest/payload and unsafe-url ValueErrors) let a corrupt manifest entry escape unwrapped, contradicting the docstring's promise of SDKException on read failures. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…nt, add spec_version() Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…gration helper _validate_tdf_zip_structure is shared by the otdfctl-produced and Python-produced TDF checks; otdfctl still writes 0.manifest.json, so require resolve_manifest_name() there instead of the spec-only name. Enforce the spec name specifically in test_python_encrypt, which only exercises the Python writer. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
BREAKING CHANGE: TDF archives are now written with the spec-mandated manifest.json entry instead of 0.manifest.json. Readers accept both names. Files written by this version cannot be opened by released otdfctl, upstream Go, Java, or JS SDKs until they add a manifest.json fallback. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ds manifest.json Released otdfctl still looks for the legacy 0.manifest.json zip entry, while this branch writes the spec-mandated manifest.json entry (see README "TDF container format"). That is an accepted, documented interop break pending an upstream otdfctl/platform reader-fallback PR. _run_otdfctl_decrypt() now accepts an opt-in expect_failure_reason: when set and otdfctl exits nonzero, the step calls pytest.xfail() instead of failing, with diagnostic stdout/stderr still printed. Wired into the three otdfctl-decrypts-Python-output scenarios in test_cli_tdf_validation.py (test_python_encrypt, test_cross_tool_compatibility, test_different_content_types). All other assertions, including that Python output must contain manifest.json (not 0.manifest.json), and the otdfctl-encrypts/Python-decrypts scenarios, are untouched. Once otdfctl gains the fallback, the branch is never taken and these tests report a normal pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
CI note: the three integration failures on the first run ( 8632c9f gates exactly those otdfctl-decrypts-Python-output steps with |
Summary
Brings the TDF zip container into compliance with the OpenTDF spec.
manifest.jsonat the archive root (was0.manifest.json).payload.urlis derived from the same constant as the payload zip entry (0.payload), so the two cannot diverge.manifest.jsonfirst, then legacy0.manifest.json(accepted permanently). Payload entry located frommanifest.payload.url, falling back to0.payloadonly when the url is empty; a url naming a missing entry is an error quoting the url; unsafe urls (..segment, leading/, backslash) are rejected before any lookup.is_tdfno longer requires exactly two entries.Manifest.spec_version()resolvesschemaVersion>tdf_spec_version>payload.tdf_spec_version; bothtdf_spec_versionplacements are accepted on read and never serialized.supports spec-containerreturns 0 for the cross-SDK conformance harness.SDKExceptionfromTDFReaderinstead of a bareUnicodeDecodeError.The
feat(tdf)!:commit carries aBREAKING CHANGEfooter for release-please; README gains a "TDF container format" section.Test plan
uv run pytest tests/ -m "not integration": 266 passeduv run ruff check . && uv run ruff format --check .cleantest_container_layoutgreen for pythontests/integration/test_cli_tdf_validation.pyupdated to accept both names for otdfctl-produced archives)Interop note
Files written by this version use the spec name
manifest.json. Released otdfctl, upstream opentdf/platform Go, Java, and JS SDKs still look for0.manifest.jsonand will not open them until they gain a read fallback (upstream reader-fallback PR planned). Files written by older versions remain readable.schemaVersionis unchanged (4.3.0);tdf_spec_versionis now read at either placement but never written.Spec: opentdf/spec schema/OpenTDF/README.md,
manifest.md,payload.md.🤖 Generated with Claude Code