commit 7fc24d452d9374935386d95836d3dcde8de9a21e
parent 76907a9d8981e9ec59b1a5542034e399dd23a87b
Author: triesap <tyson@radroots.org>
Date: Fri, 25 Sep 2026 15:13:03 +0000
C004: complete escaped-context cells and successor executor links (ADR-0030 D50 EC02)
Diffstat:
3 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/schemas/hyf_ops_v2/examples/corpus.json b/schemas/hyf_ops_v2/examples/corpus.json
@@ -2,7 +2,7 @@
"schema_version": 1,
"program": "hyf_http_v1",
"revision": "hyf_ops_v2",
- "note": "Reference-validation corpus for C004 (ADR-0026 D46 CR01-CR03 and ADR-0027 D47 BP01-BP03 successor). schema_valid records the JSON Schema outcome; semantic names a labelled obligation that JSON Schema cannot express and that is exercised separately (semantic-cases.json). Targets: '<operation>.<request|response>' uses that operation schema; 'def:<name>' validates against that named $defs entry in any hyf_ops_v2 schema (resolved across all schemas, first match). The CR01 envelope algebra, BP01 money/provenance and CR02 linkage/degradation controls are executed programmatically by the successor reference diagnostic (docs/execution/evidence/hyf_http_v1/C004-requalification-2/reference-schema-validate.v3.py.txt).",
+ "note": "Reference-validation corpus for C004 (ADR-0026 D46 CR01-CR03 and ADR-0027 D47 BP01-BP03 successor). schema_valid records the JSON Schema outcome; semantic names a labelled obligation that JSON Schema cannot express and that is exercised separately (semantic-cases.json). Targets: '<operation>.<request|response>' uses that operation schema; 'def:<name>' validates against that named $defs entry in any hyf_ops_v2 schema (resolved across all schemas, first match). The CR01 envelope algebra, BP01 money/provenance and CR02 linkage/degradation controls are executed programmatically by the successor reference diagnostic (docs/execution/evidence/hyf_http_v1/C004-requalification-4/reference-schema-validate.v5.py.txt).",
"entries": [
{"file": "examples/valid/farm_update_interpret.request.json", "target": "farm_update.interpret.request", "schema_valid": true},
{"file": "examples/valid/farm_update_interpret.response.json", "target": "farm_update.interpret.response", "schema_valid": true},
diff --git a/schemas/hyf_ops_v2/semantic-cases.json b/schemas/hyf_ops_v2/semantic-cases.json
@@ -11,7 +11,7 @@
{"id": "taxonomy_version_mismatch", "path": "context.versions.taxonomy != input.references.taxonomy.version", "expect": "reject", "wire": "invalid_request", "owner": "C023", "enforced_by": "C004 labelled semantic script; C023 typed consistency"},
{"id": "normalization_version_mismatch", "path": "context.versions.normalization != input.references.normalization.version", "expect": "reject", "wire": "invalid_request", "owner": "C023", "enforced_by": "C004 labelled semantic script; C023 typed consistency"},
{"id": "source_actor_mismatch", "path": "input.source.actor_id != context.actor_id", "expect": "reject", "wire": "invalid_request", "owner": "C023", "enforced_by": "C004 labelled semantic script; C023 typed consistency"},
- {"id": "match_need_actor_mismatch", "path": "input.need.actor_id != context.actor_id", "expect": "reject", "wire": "invalid_request", "owner": "C023", "enforced_by": "docs/execution/evidence/hyf_http_v1/C004-requalification-2/reference-schema-validate.v3.py.txt executes the paired accepting/rejecting control; C023 owns typed consistency"},
+ {"id": "match_need_actor_mismatch", "path": "input.need.actor_id != context.actor_id", "expect": "reject", "wire": "invalid_request", "owner": "C023", "enforced_by": "docs/execution/evidence/hyf_http_v1/C004-requalification-4/reference-schema-validate.v5.py.txt executes the paired accepting/rejecting control; C023 owns typed consistency"},
{"id": "farm_source_farm_mismatch", "path": "input.source.farm_id != context.farm_id", "expect": "reject", "wire": "invalid_request", "owner": "C023", "enforced_by": "C004 labelled semantic script; C023 typed consistency"},
{"id": "unknown_quantity_with_value", "path": "quantity.state=unknown with non-null value", "expect": "reject", "wire": "invalid_request", "owner": "C004", "enforced_by": "schema if/then; C009 typed mapping"},
{"id": "known_quantity_without_value", "path": "quantity.state=known without value/unit", "expect": "reject", "wire": "invalid_request", "owner": "C004", "enforced_by": "schema if/then; C009 typed mapping"},
@@ -41,11 +41,11 @@
{"id": "provenance_required_on_success", "path": "every successful output (including empty claims/lines and no-match/zero-plan results) without a closed provenance object", "expect": "reject", "wire": "invalid_request", "owner": "C009", "enforced_by": "BP01 response schema requires provenance on every success independently of context.return_provenance; C009 typed decode"},
{"id": "provenance_identity_closed", "path": "provenance identity objects missing/blank revision or carrying unknown fields", "expect": "reject", "wire": "invalid_request", "owner": "C009/C023", "enforced_by": "BP01 closed identity objects with required nonblank identity strings; C023 equality"},
{"id": "provenance_farm_prior_records_only", "path": "buyer interpretation provenance carrying the farm-only prior_records field", "expect": "reject", "wire": "invalid_request", "owner": "C023/C030", "enforced_by": "BP01 buyer provenance is closed without prior_records; C030 owns farm prior-record provenance"},
- {"id": "provenance_actual_use_only", "path": "source/clarification/prior_records/need/snapshot identities not actually consulted", "expect": "reject", "wire": "invalid_request", "owner": "C023/C041", "enforced_by": "docs/execution/evidence/hyf_http_v1/C004-requalification-2/reference-schema-validate.v3.py.txt executes the paired accepting/rejecting never-copy-all-supplied controls; C023/C041 own runtime actual-use"},
- {"id": "provenance_repeated_identity_pair", "path": "repeated identical identity/revision pair in provenance", "expect": "reject", "wire": "invalid_request", "owner": "C023", "enforced_by": "docs/execution/evidence/hyf_http_v1/C004-requalification-2/reference-schema-validate.v3.py.txt executes the paired uniqueness controls; C023 owns runtime uniqueness"},
- {"id": "provenance_snapshot_scope_consistency", "path": "match provenance snapshots disagree with assessed/allocated lot revisions or with supplied scope", "expect": "reject", "wire": "invalid_request", "owner": "C023/C041", "enforced_by": "docs/execution/evidence/hyf_http_v1/C004-requalification-2/reference-schema-validate.v3.py.txt executes the paired assessed/allocation-agreement controls; C023/C041 own runtime consistency"},
- {"id": "price_amount_full_string", "path": "snapshot.price/fee amount with a trailing newline or other unconsumed byte (schema pattern `$` is not full-string consumption)", "expect": "reject", "wire": "invalid_request", "owner": "C009", "enforced_by": "docs/execution/evidence/hyf_http_v1/C004-requalification-2/reference-schema-validate.v3.py.txt full-match oracle; C009 typed decode"},
- {"id": "price_currency_nonblank", "path": "snapshot.price/fee currency that is whitespace-only (schema minLength:1 is not nonblank)", "expect": "reject", "wire": "invalid_request", "owner": "C009", "enforced_by": "docs/execution/evidence/hyf_http_v1/C004-requalification-2/reference-schema-validate.v3.py.txt nonblank oracle; C009 typed decode"},
- {"id": "price_fee_amount_canonical", "path": "optional price.fees amount beyond int64, non-canonical, blank currency or wrong type", "expect": "reject", "wire": "invalid_request", "owner": "C009", "enforced_by": "BP01 closed fee schema plus docs/execution/evidence/hyf_http_v1/C004-requalification-2/reference-schema-validate.v3.py.txt int64/full-string/nonblank controls; C009 typed decode"}
+ {"id": "provenance_actual_use_only", "path": "source/clarification/prior_records/need/snapshot identities not actually consulted", "expect": "reject", "wire": "invalid_request", "owner": "C023/C041", "enforced_by": "docs/execution/evidence/hyf_http_v1/C004-requalification-4/reference-schema-validate.v5.py.txt executes the paired accepting/rejecting never-copy-all-supplied controls; C023/C041 own runtime actual-use"},
+ {"id": "provenance_repeated_identity_pair", "path": "repeated identical identity/revision pair in provenance", "expect": "reject", "wire": "invalid_request", "owner": "C023", "enforced_by": "docs/execution/evidence/hyf_http_v1/C004-requalification-4/reference-schema-validate.v5.py.txt executes the paired uniqueness controls; C023 owns runtime uniqueness"},
+ {"id": "provenance_snapshot_scope_consistency", "path": "match provenance snapshots disagree with assessed/allocated lot revisions or with supplied scope", "expect": "reject", "wire": "invalid_request", "owner": "C023/C041", "enforced_by": "docs/execution/evidence/hyf_http_v1/C004-requalification-4/reference-schema-validate.v5.py.txt executes the paired assessed/allocation-agreement controls; C023/C041 own runtime consistency"},
+ {"id": "price_amount_full_string", "path": "snapshot.price/fee amount with a trailing newline or other unconsumed byte (schema pattern `$` is not full-string consumption)", "expect": "reject", "wire": "invalid_request", "owner": "C009", "enforced_by": "docs/execution/evidence/hyf_http_v1/C004-requalification-4/reference-schema-validate.v5.py.txt full-match oracle; C009 typed decode"},
+ {"id": "price_currency_nonblank", "path": "snapshot.price/fee currency that is whitespace-only (schema minLength:1 is not nonblank)", "expect": "reject", "wire": "invalid_request", "owner": "C009", "enforced_by": "docs/execution/evidence/hyf_http_v1/C004-requalification-4/reference-schema-validate.v5.py.txt nonblank oracle; C009 typed decode"},
+ {"id": "price_fee_amount_canonical", "path": "optional price.fees amount beyond int64, non-canonical, blank currency or wrong type", "expect": "reject", "wire": "invalid_request", "owner": "C009", "enforced_by": "BP01 closed fee schema plus docs/execution/evidence/hyf_http_v1/C004-requalification-4/reference-schema-validate.v5.py.txt int64/full-string/nonblank controls; C009 typed decode"}
]
}
diff --git a/tests/test_hyf.mojo b/tests/test_hyf.mojo
@@ -2630,6 +2630,32 @@ def test_c004_cr04_correlation_duplicate_matrix() raises:
+ v2_obj
)
)
+ # context: escaped-first equal/conflicting (ADR-0030 D50 EC02 completes the
+ # missing escaped-context-first cells; the escaped key leads both orders).
+ duplicates.append(
+ _c004_corr_envelope(
+ '"request_id":"ctx-7","\\u0063ontext":'
+ + v2_obj
+ + ',"context":'
+ + v2_obj
+ )
+ )
+ duplicates.append(
+ _c004_corr_envelope(
+ '"request_id":"ctx-8","\\u0063ontext":'
+ + v2_obj
+ + ',"context":'
+ + legacy_ctx
+ )
+ )
+ duplicates.append(
+ _c004_corr_envelope(
+ '"request_id":"ctx-9","\\u0063ontext":'
+ + legacy_ctx
+ + ',"context":'
+ + v2_obj
+ )
+ )
for line in duplicates:
var message = _decode_error_message(line)