Skip to content

test(primaite): compose RAES conformance with simulator-specific probes #42

Closed

Description

@Brad-Edwards

Objective

Compose published RAES backend conformance with PrimAITE-specific mapping, control, and leakage probes.

Scope

  • Validate the adapter manifest with the published RAES model.
  • Run the applicable published backend profile and canonical fixtures against a fully constructed RuntimeTarget.
  • Add adapter-local probes for source-ledger coverage, source/profile identity, reset/seed/clock controls, action and observation projection, evaluator projection, cleanup, and portable-output leakage.
  • Define a small deterministic PR suite and a broader study/readiness suite.
  • Emit machine-readable RAES diagnostics, conformance reports, evidence references, and declared weaknesses.
  • Keep adapter probes additive; do not create a second profile table, fixture corpus, schema registry, or manifest authority.

Acceptance criteria

  • Every applicable published fixture passes or returns a justified machine-readable unsupported result.
  • Every manifest capability links to passing evidence.
  • Success and failure paths for all four backend surfaces are leak-tested.
  • The selected source protocol's reset, stochastic, action, observation, reward, and terminal controls have executable probes.
  • Clean-install conformance runs in CI under the primaite extra.
  • Reports distinguish backend conformance from source-protocol reproduction and research claims.

Activity

  1. added
    in-progressAn agent is actively working this issue via /implement
    on Aug 4, 2026
  2. Brad-Edwards commented on Aug 4, 2026

    @Brad-Edwards
    CollaboratorAuthor

    🛠️ Picked up by /implement - driver claude-code, branch 42-primaite-conformance-probes, 2026-08-04T17:14:08.826Z.

  3. Brad-Edwards commented on Aug 4, 2026

    @Brad-Edwards
    CollaboratorAuthor

    gc workflow phase recorded: preflight (issue #42). 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 Aug 4, 2026

    @Brad-Edwards
    CollaboratorAuthor

    gc workflow phase recorded: plan (issue #42). 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.

    Implementation plan — compose RAES conformance with PrimAITE-specific probes

    Context & design authority

    • Requirement-free test(primaite) run (issue has no ## Requirements section). Governance runs with --skip-requirement.
    • Binding design: docs/decisions/primaite-conformance-guardrails.md (authored by the architecture preflight this run), reconciled with primaite-backend-guardrails.md (feat(primaite): implement the conformant simulator backend target #41/feat(primaite): implement the conformant simulator backend target #73).
    • Precedents reused (mechanics/patterns, not semantics): tests/test_cyberbattlesim_conformance.py, tests/test_nasim_conformance.py, and the cyborg/cyberbattlesim conformance modules.
    • Fail-closed non-runnable model. The live PrimaiteDriver verifies source identity then refuses in-process construction (CPython-3.11-only qualified runtime; PrimAITE writes platform dirs on import). A fake/injected driver proves portable mechanics but can never certify live-native capability. Consequently capability evidence stays empty and every affirmative manifest capability is a disclosed gap — the inverse of the nasim/cbs closure. This change extends that established contract; it does not migrate the hand-rolled conformance.py onto the gym framework.

    Acceptance criteria → deliverable

    1. Every applicable published fixture passes or a justified machine-readable unsupported result → canonical run_primaite_conformance report (single published realization-envelope-v1 no-witness unsupported case), native_conformance=false.
    2. Every manifest capability links to passing evidence → the closure mechanism runs and fails closed: primaite_manifest_capability_evidence() stays {}, …_gaps() = all affirmative pointers, and a newly-declared affirmative capability surfaces as a gap.
    3. Four backend surfaces success+failure leak-tested → provisioner / orchestrator / participant-runtime / evaluator + cleanup cross-product against _LEAKAGE_MARKERS.
    4. Source protocol reset/stochastic/action/observation/reward/terminal probes → validated RAES source-protocol diagnostics + declared weaknesses; reset broken/absent/unbound dispositions; unrepresentable action; withheld observation/reward; fixed-horizon truncation.
    5. Clean-install conformance in CI under the primaite extra → new PRIMAITE_CONFORMANCE_PROBE + venv-primaite block in noxfile.py _distributions().
    6. Reports distinguish backend conformance / source-protocol reproduction / research claims → the PR bundle keeps the three claims distinct; no aggregate passed.

    Files

    Add

    • tests/test_primaite_conformance.py — deterministic PR probe suite (injected driver, never imports PrimAITE): canonical report+payload shapes; source-protocol diagnostics + declared weaknesses are RAES models; capability evidence fails closed (evidence == {}, gaps ⊇ /capabilities/cleanup/supported_action_kinds, /capabilities/participant_runtime/feature_support; mutated payload → new affirmative capability appears as a gap); PR bundle composes report+diagnostics+weaknesses+disclosed non-claims, JSON-serializable, no leakage; clock/time unsupported (manifest.time is None); four-surface failure/leakage cross-product + cleanup with every diagnostic validated by diagnostic_model; manual-native-readiness protocol test asserting the guardrails-doc phrasing.

    Modify

    • src/raes_adapters/primaite/backend/conformance.py — add PR_CONFORMANCE_SEED (fixed literal) and run_primaite_pr_conformance(*, driver, seed=PR_CONFORMANCE_SEED) -> dict composing the machine-readable disclosure bundle: seed, native_conformance (False), backend_conformance (payload), source_diagnostics (diagnostic_payload), capability_evidence ({}), capability_gaps (disclosed non-claims), declared_weaknesses. It does not raise on gaps (gaps are the expected fail-closed disclosure, unlike nasim). Existing 6 functions unchanged.
    • src/raes_adapters/primaite/backend/__init__.py — export PR_CONFORMANCE_SEED, run_primaite_pr_conformance.
    • noxfile.py — add PRIMAITE_CONFORMANCE_PROBE string + venv-primaite clean-install block in _distributions() mirroring the cyberbattlesim block; run the bundle from the installed [primaite] wheel with -I, cleared PYTHONPATH, PYTHONSAFEPATH=1; assert native_conformance is False, the single non-passing realization-envelope-v1 case, capability_evidence == {}, non-empty gaps, JSON-serializable.
    • docs/decisions/primaite-conformance-guardrails.md — add the manual-native-readiness anchor paragraph the readiness test asserts against (names PrimaiteDriver, run_primaite_conformance(), backend_conformance_report_payload(), primaite_source_protocol_diagnostics(), the deterministic injected-driver lane, native blocked pending worker isolation + CPython-3.12 qualification).
    • README.md — add a "PrimAITE backend conformance" section mirroring the NASim section (three distinct claims; fail-closed/blocked-native posture).
    • docs/index.md, mkdocs.yml — nav link to the guardrails doc (already added by preflight; verify).

    No CHANGELOG.md edit (Release Please owns it); PR title will be Conventional Commit test(primaite): ….

    Cross-cutting review

    • Security: no route/daemon/secret/env/subprocess. Diagnostics pointer-addressed and input-free (diagnostic_model). Leakage cross-product proves no native ids / Box(1652) / masks / info / reward / paths / tracebacks / tokens cross. Clean-install probe runs isolated (-I, cleared PYTHONPATH, PYTHONSAFEPATH=1).
    • Maintainability: build on run_conformance_probe, _conformance_support.affirmative_capability_pointers, existing primaite surfaces + FakeDriver patterns, diagnostic_payload/diagnostic_model. No new abstraction, controller, schema, or diagnostic hierarchy.
    • Extensibility: seam is EvidenceSelection + injected driver factory + fixed seed; future live runtime enters behind a reviewed worker boundary + CPython-3.12 qualification — not this change.
    • Whole-repo: single pyproject.toml/uv.lock, empty primaite extra unchanged, _distributions() clean-wheel matrix + CI PR Gate, strict nox -s verify.

    Verification

    • Canonical: uv tool run --from 'nox[uv]==2026.4.10' nox -f noxfile.py -s verify with --skip-requirement.
    • Targeted during TDD: nox -s tests -- tests/test_primaite_conformance.py plus the primaite backend suite.
    • Docs build + policy gate for guardrails/README/nav changes.
  5. Brad-Edwards commented on Aug 4, 2026

    @Brad-Edwards
    CollaboratorAuthor

    gc_codex_review — cycle 1 of 1 (pre-push) on issue #42 (branch 42-primaite-conformance-probes)
    Diff mode: inline — the complete diff was supplied in one prompt

    Core review

    Verdict: ship

    This change is shaped as an adapter-local conformance composition layer: it keeps the RAES backend report as the canonical object, adds PrimAITE-specific source diagnostics and gap disclosure beside it, and documents the boundary rather than inventing a new schema or profile. The implementation seam is narrow (run_primaite_pr_conformance), reuses the existing manifest/report/diagnostic projectors, and keeps the injected-driver lane explicitly non-native. The nox clean-install probe exercises the packaged extra without broadening workflow shape. I would ship this.

    No blocking findings.

    Security review

    Verdict: ship

    This change is shaped as a conformance-disclosure composition, not a new runtime/control-plane surface: it keeps the RAES backend report, PrimAITE source diagnostics, capability gaps, and weakness disclosures as separate outputs, and the only production code path added is a deterministic bundle projector around existing conformance and manifest helpers. The security-relevant boundary remains the existing driver/component boundary and validated RAES payload projection; this diff does not add request handling, persistence, auth scope, secret material, dynamic imports, shell interpolation, or user-controlled file execution paths. I would ship this from an application-security standpoint.

    No blocking findings.

  6. Brad-Edwards commented on Aug 4, 2026

    @Brad-Edwards
    CollaboratorAuthor

    gc_codex_review pre-push cycle 1 of 1 complete for issue #42 on branch '42-primaite-conformance-probes'. 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 Aug 4, 2026

    @Brad-Edwards
    CollaboratorAuthor

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

    Reviewer: codex
    Cycle: 1

    Architectural read:

    Core reviewer: This change is shaped as an adapter-local conformance composition layer: it keeps the RAES backend report as the canonical object, adds PrimAITE-specific source diagnostics and gap disclosure beside it, and documents the boundary rather than inventing a new schema or profile. The implementation seam is narrow (run_primaite_pr_conformance), reuses the existing manifest/report/diagnostic projectors, and keeps the injected-driver lane explicitly non-native. The nox clean-install probe exercises the packaged extra without broadening workflow shape. I would ship this.

    Security reviewer: This change is shaped as a conformance-disclosure composition, not a new runtime/control-plane surface: it keeps the RAES backend report, PrimAITE source diagnostics, capability gaps, and weakness disclosures as separate outputs, and the only production code path added is a deterministic bundle projector around existing conformance and manifest helpers. The security-relevant boundary remains the existing driver/component boundary and validated RAES payload projection; this diff does not add request handling, persistence, auth scope, secret material, dynamic imports, shell interpolation, or user-controlled file execution paths. I would ship this from an application-security standpoint.

    Blocking findings: 0 (clean run)

  8. Brad-Edwards commented on Aug 4, 2026

    @Brad-Edwards
    CollaboratorAuthor

    gc_test_quality_review cycle 1 of 1 — issue #42

    Reviewer: test-quality (claude-sonnet-5 via gc_test_quality_review)
    Branch: 42-primaite-conformance-probes
    Cycle: 1 / 1
    Findings: 0 (clean run)

  9. Brad-Edwards commented on Aug 4, 2026

    @Brad-Edwards
    CollaboratorAuthor

    gc_test_quality_review cycle 1 of 1 complete for issue #42 on branch '42-primaite-conformance-probes'. Posted by the MCP server to enforce the gc_test_quality_review hard-cap-1 contract (issue #884 follow-up, default lowered in #906). Do not edit or delete — used by the next gc_test_quality_review invocation to count cycles.

  10. Brad-Edwards commented on Aug 4, 2026

    @Brad-Edwards
    CollaboratorAuthor

    Review decision record — test-quality cycle 1 (issue #42)

    Reviewer: test-quality
    Cycle: 1

    Architectural read:

    This is a composition-level test file mirroring the just-merged tests/test_nasim_conformance.py sibling almost line-for-line in structure (same ProbeDriver shape, same native-marker leakage sweep, same manual-readiness doc-sync check, same failure-surface cross-product across provisioner/orchestrator/participant-runtime/evaluator/cleanup). The new production surface it exercises (PR_CONFORMANCE_SEED, run_primaite_pr_conformance) is thin and wired through already-owned RAES projectors (backend_conformance_report_payload, diagnostic_payload), so there's little room for the test to under-cover it. The one deliberate divergence from the nasim precedent — no pytest.raises-driven "fails closed on capability gaps" test — is correct, not a gap: PrimAITE's bundle is documented to not raise on gaps (every affirmative capability is an expected disclosed gap given the fail-closed live driver), so there's nothing to drive through that branch. The critical invariant this whole design exists to protect — "the non-runnable target is never falsely certified" — is asserted directly (non_passing[0].contract_name == "realization-envelope-v1", exactly one case), and a self-consistency violation between report.passed and per-case results would surface as a raised ValueError from validate_backend_conformance_report inside the payload-equality assertion, so that path is covered even without an explicit report.passed check. Native-leakage sentinels are asserted against real JSON-serialized projections (not repr), matching the guardrails doc's explicit prohibition on str(result)-based leakage oracles. This is shaped correctly and matches the repo's established conformance-test vocabulary; I would ship it.

    Blocking findings: 0 (clean run)

  11. Brad-Edwards commented on Aug 4, 2026

    @Brad-Edwards
    CollaboratorAuthor

    Ready for review — issue #42

    PR: #75
    Plan: #42 (comment)

    Outcome

    PrimAITE now ships a deterministic, offline conformance-composition test suite plus a clean-install CI proof that compose the published RAES backend conformance report with adapter-local source-protocol and leakage probes. Because the live PrimAITE driver cannot run in-process, the suite is fail-closed: it proves the portable mechanics and honestly discloses every unproven live capability as an open gap rather than certifying it, keeping backend conformance, source-protocol reproduction, and research claims distinct.

    Files changed

    Added:

    • tests/test_primaite_conformance.py
    • docs/decisions/primaite-conformance-guardrails.md

    Modified:

    • src/raes_adapters/primaite/backend/conformance.py
    • src/raes_adapters/primaite/backend/__init__.py
    • noxfile.py
    • README.md
    • docs/index.md
    • mkdocs.yml

    Reviews

    • codex: Clean — 0 findings, whole-diff coverage (8/8 files).
    • test-quality: Clean — 0 findings.

    Traceability reconciliation

    • Pending — requirement status transition and IMPLEMENTS/TESTS reconciliation run in Phase E once the PR merges.

    Status

    • CI: ✅ green
    • SonarCloud: ✅ passed
    • PR ready for user review and merge. Ground Control reconciliation (requirement status + traceability) runs on merge (Phase E).

    Documentation

    Updated: see diff.

  12. doublewhy commented on Aug 13, 2026

    @doublewhy

    Verified complete in merged PR #75 (8c39789f3198530caf303aa836aad11e5eb18260). The PR added the PrimAITE conformance composition, fail-closed capability evidence, four-surface leakage probes, clean-install primaite-extra CI proof, manual native-readiness protocol, and documentation. All recorded required checks passed, including tests, distributions, typecheck, policy, docs, CodeQL, SonarCloud, GitGuardian, and the aggregate PR Gate.

  13. removed
    in-progressAn agent is actively working this issue via /implement
    on Aug 13, 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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions