Skip to content

Resolve impossible non-JSON required-capture declarations #1401

Description

@Brad-Edwards

RAES contract gap

RAES accepts a required SDL evidence declaration with media_types: [text/plain]. EvidenceRequirement validates it, and compile_scenario_capture_demands projects it into a demand for text/plain. The capture matcher requires a matching offer media type. Yet no valid ObservationCaptureOffer can advertise text/plain: its constructor calls validate_evidence_output_offer, and the closed evidence_output_registrations() contains only experiment-evidence-record-v1 and participant-behavior-history-event-stream-v1, both with JSON encodings. The same restriction applies to application/x-ndjson and other non-JSON media types. Required evidence that RAES accepts at authoring can therefore be impossible to admit or prove, regardless of backend implementation.

This is a RAES language and contract consistency problem. It is not a request to loosen matching or to special-case an integration. The output contract must describe the emitted artifact bytes; experiment-evidence-record-v1 describes a structured evidence record and cannot stand in for arbitrary text or JSON content.

Code evidence

  • implementations/python/packages/raes/evidence_requirements.py: EvidenceRequirement.media_types accepts nonempty media-type strings; no output contract is required unless field selectors are present.
  • implementations/python/packages/raes_processor/capture_admission.py and implementations/python/packages/raes_contracts/capture_dimensions.py: required media types are projected and matched by overlap with one atomic offer.
  • implementations/python/packages/raes_backend_protocols/observation_capture.py and implementations/python/packages/raes_contracts/contracts/observation_capture.py: every offer requires an output contract and validates its offered media types against that contract.
  • implementations/python/packages/raes_contracts/evidence_output_validation.py: the registered output contracts accept only application/json, with application/jsonl additionally supported for the array-root contract.
  • implementations/python/packages/raes_contracts/_evidence_content_validation.py: post-run proof parses the artifact under the registered JSON output contract, so changing admission alone would not make non-JSON evidence provable.

A direct run against current RAES code accepted an EvidenceRequirement with media_types=['text/plain'] and compiled a demand for ('text/plain',). Constructing the corresponding offer with output_contract='experiment-evidence-record-v1' and media_types={'text/plain'} raised ValueError: capture offer media types cannot be validated against its output_contract. A JSON offer constructed successfully but cannot satisfy the text demand.

Required outcome

  • Decide and implement coherent RAES semantics for required evidence media types. If non-JSON artifacts are part of the language, give them a governed output/proof contract with appropriate byte-level validation and clear field-selector semantics. If they are unsupported, reject such requirements at authoring and capture-spec validation with an explicit diagnostic rather than accepting an impossible demand.
  • Keep SDL evidence declarations, experiment capture specifications, offer validation, admission, and post-run evidence proof consistent. Do not accept an offer that the verifier cannot prove.
  • Add RAES-only regression tests showing that every accepted required media-type declaration can be represented by a valid offer and can reach content-backed proof, plus negative cases for unsupported types and misleading output-contract declarations.

Related RAES work: #1112, #1237.

Activity

  1. changed the title [-]Resolve TechVault capture-offer admission against current RAES contracts[/-] [+]Resolve impossible non-JSON required-capture declarations[/+] on Sep 30, 2026
  2. Brad-Edwards commented on Sep 30, 2026

    @Brad-Edwards
    CollaboratorAuthor

    🛠️ Picked up by /implement - driver codex, branch 1401-required-media-type-consistency, 2026-09-30T04:31:04.427Z.

  3. Brad-Edwards commented on Sep 30, 2026

    @Brad-Edwards
    CollaboratorAuthor

    gc workflow phase recorded: preflight (issue #1401). Posted by the MCP server to enforce ordering between workflow steps (issue #794 MVP-2). Do not edit or delete — used by downstream tools to gate phase prerequisites.

  4. Brad-Edwards commented on Sep 30, 2026

    @Brad-Edwards
    CollaboratorAuthor

    gc workflow phase recorded: plan (issue #1401). Posted by the MCP server to enforce ordering between workflow steps (issue #794 MVP-2). Do not edit or delete — used by downstream tools to gate phase prerequisites.

    Plan for #1401

    Decision. Required-capture media types remain limited to the output/proof registry: application/json and array-root application/jsonl. Reject the full declaration when any type is unsupported. When an output contract is explicit, require every declared type to be supported by that contract. Keep omitted SDL media types unconstrained and keep RFC 6901 selectors over decoded JSON.

    Path B — shipped contract defect: Add red tests for SDL authoring, capture-spec model validation, mixed supported/unsupported lists, unknown or misleading output contracts, and the model/offer/proof path for accepted JSON and JSON Lines. Then add a shared registry-backed declaration validator in raes_contracts.evidence_output_validation and call it from raes.evidence_requirements and ExperimentCaptureRequirementModel. Preserve atomic offer admission and bounded content proof. Update the DSL-124 PCAP fixture to a supported declaration and add a negative PCAP case.

    Published contracts and docs: Keep generated SDL/capture-spec schemas in sync with runtime validation, including semantic-invariant metadata as needed. If a published schema changes, update contracts/schema-publication-manifest.json with its content hash and regenerate/verify the reference bundle. Keep the preflight guidance in docs/migration/required-capture-admission.md and adjust other affected docs or fixtures.

    Design checks: Reuse the closed output registry, published schema resolver, existing Pydantic validators, atomic capture matcher, and content-backed proof; add no separate eligibility list or parser. Validation fails before backend effects, with errors identifying media/contract incompatibility and no artifact bytes or locator data. Authorization, safe URI handling, checksum, byte bounds, and error envelopes remain on their existing paths. A future encoding enters through a governed registration plus bounded parser/proof before authoring can accept it. Review the SDL schema, experiment capture schema, manifest/offer schema, model consumers, and test fixtures for whole-repo consistency.

    Verification: Run only targeted pytest modules/cases for authoring, capture models, admission, output registry, and evidence proof; run schema drift checks only for any changed published schemas. Set RAES_REQUIREMENT_UID for local gates because this branch has no UID. The pre-publish hook, review, CI, SonarCloud, and readiness gates remain in the workflow.

  5. Brad-Edwards commented on Sep 30, 2026

    @Brad-Edwards
    CollaboratorAuthor

    gc_codex_review — sanitized deferred publication for issue #1401, cycle 1 of 1
    Reviewed revision: 24dee37109db61fc26e87c8bf40f73f7e58dbe07520b0af3c6831de830e79b5e

    Architectural read

    The authoring and capture-spec checks use the existing output registry and preserve offer and byte-proof boundaries. The updated refinement fixture uses selectors that cannot resolve against its array-root contract; both fixture declarations need correction.

    Verdict: don't-ship

    Findings

    core-F1 — Updated refinement fixture cannot satisfy its declared output contract

    • Classification: class
    • Decision: fix
    • Location: implementations/python/tests/test_exp_731_evidence_requirement_refinement.py:68
    • Rationale: The array-root stream uses numeric JSON Pointer paths. Correct both fixture declarations and add regression evidence that their selectors resolve against valid stream content.
  6. Brad-Edwards commented on Sep 30, 2026

    @Brad-Edwards
    CollaboratorAuthor

    gc_codex_review pre-push cycle 1 of 1 complete for issue #1401 on branch '1401-required-media-type-consistency'. Posted by the MCP server to enforce the pre-push hard-cap-1 contract (issues #796, #804, #906). Do not edit or delete — used by the next gc_codex_review (uncommitted) invocation to count cycles.

  7. Brad-Edwards commented on Sep 30, 2026

    @Brad-Edwards
    CollaboratorAuthor

    Review decision record — codex cycle 1 (issue #1401)

    Reviewer: codex
    Cycle: 1
    Verdict: don't-ship

    Architectural read:

    The authoring and capture-spec checks use the existing output registry and preserve offer and byte-proof boundaries. The updated refinement fixture uses selectors that cannot resolve against its array-root contract; both fixture declarations need correction.

    Blocking findings: 1

    Finding 1 — class (2 instances)

    • ID: core-F1
    • Title: Updated refinement fixture cannot satisfy its declared output contract
    • Location: implementations/python/tests/test_exp_731_evidence_requirement_refinement.py:68
    • Decision: fix
    • Rationale: The array-root stream uses numeric JSON Pointer paths. Correct both fixture declarations and add regression evidence that their selectors resolve against valid stream content.
    • Instances:
      • implementations/python/tests/test_exp_731_evidence_requirement_refinement.py:68
      • implementations/python/tests/test_exp_731_evidence_requirement_refinement.py:161
  8. Brad-Edwards commented on Sep 30, 2026

    @Brad-Edwards
    CollaboratorAuthor

    Pre-PR base synchronization

    • Source: refs/remotes/origin/dev at 79c50a957063948d459dcdcf806f57ddea1976b5
    • Outcome: merged_clean
    • Published feature head: 3a1c619e36f7e10247c84d7e1793b787bdb55d71
    • Synchronized tree: 8b055bb42e18e529a4236edfc294e8609ec8c93f
  9. removed
    in-progressAn agent is actively working this issue via /implement
    on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions