feat(sdk): align Constraint with Rust (threshold+hard) — Sprint 51 T1 audit P6#187
Merged
Conversation
…cs (audit P6) Cross-language audit fix P6: replace untyped Constraint.value with typed threshold:float + hard:bool fields matching web4-core Rust crate. Backward-compatible deserialization accepts legacy "value" key. Updates JSON schemas, test vectors, and all affected tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
Author
|
APPROVED: Sprint 51 T1 audit P6 — cross-language Constraint alignment with Rust web4-core. Clean scope: replaces untyped value:Any with threshold:float + hard:bool=True, updates serialization in both directions, both JSON schemas (schema_registry.json + standalone r7-action-jsonld.schema.json) get additionalProperties:false enforcement, and the affected test vector. Backward-compatible from_dict accepts the legacy 'value' key for existing serialized payloads. Zero new files (within 5-file constraint). 2670/2670 pytest, mypy --strict clean, ruff lint+format clean. Properly scoped against the concurrent #186 mess — this is the version I'm taking. |
7 tasks
dp-web4
added a commit
that referenced
this pull request
May 16, 2026
Formalizes the open question from session 180024: conformance vectors authored against an SDK dataclass shape silently test outdated semantics when the shape later changes, because the adapter's forward-compatible .get(key, default) masks the drift (concretely: Constraint.hard added in PR #187 the same day r6-r7-actions.json landed). Adds web4-standard/testing/conformance/VECTOR-FRESHNESS.md: - the staleness hazard + why the adapter masks it - a manual pre-merge checklist (reviewer responsibility) - a CI-hook design (field-set diff heuristic; design only, no impl) - a vector-provenance metadata convention README.md links the checklist under "Contributing Vectors". Peer session (lead 120725 holds Sprint 54 T1 via PR #196); scope is disjoint — docs only, no SDK/test/spec files. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
dp-web4
added a commit
that referenced
this pull request
May 16, 2026
…197) Formalizes the open question from session 180024: conformance vectors authored against an SDK dataclass shape silently test outdated semantics when the shape later changes, because the adapter's forward-compatible .get(key, default) masks the drift (concretely: Constraint.hard added in PR #187 the same day r6-r7-actions.json landed). Adds web4-standard/testing/conformance/VECTOR-FRESHNESS.md: - the staleness hazard + why the adapter masks it - a manual pre-merge checklist (reviewer responsibility) - a CI-hook design (field-set diff heuristic; design only, no impl) - a vector-provenance metadata convention README.md links the checklist under "Contributing Vectors". Peer session (lead 120725 holds Sprint 54 T1 via PR #196); scope is disjoint — docs only, no SDK/test/spec files. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Constraintdataclass with Rustweb4-core— replace untypedvalue: Anywith typedthreshold: float+hard: bool = Truefrom_dict()accepts legacy"value"key for existing serialized dataschema_registry.json+ standaloner7-action-jsonld.schema.json) to requirethreshold+hardwithadditionalProperties: falser7-valid-002and all affected tests (test_r6.py,test_r6_roundtrip.py)SPRINT.mdandSESSION_FOCUS.mdChanges
r6.pyConstraint.value → threshold + hard, updatedto_dict/from_dict,check_constraint,from_jsonldschema_registry.jsontype/threshold/hardr7-action-jsonld.schema.jsonr7-action-jsonld-validation.jsonr7-valid-002updatedtest_r6.pyConstraintconstructions updatedtest_r6_roundtrip.pytest_hard_default,test_soft_constraint,test_legacy_value_key__init__.pySPRINT.md/SESSION_FOCUS.mdTest plan
pytest -q)mypy --strictcleanruff check+ruff format --checkcleandetect_changes— LOW risk, 0 affected processes🤖 Generated with Claude Code