Skip to content

Add the standing policy compliance contract - #514

Merged
brettheap merged 41 commits into
mainfrom
015-intent-compliance-contract
Aug 30, 2026
Merged

brettheap merged 41 commits into
mainfrom
015-intent-compliance-contract

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Summary

  • add the neutral intent-compliance contract family, canonical validator, schemas, templates, examples, and contract-v2.3 inventory
  • enforce content-bound authority, revocable allowances, honest registry outcomes, deterministic vetoes, and fail-closed v2.3 release membership
  • harden exact-object and release Git trust boundaries while preserving linked worktrees and deterministic static pytest evidence

Verification

  • exact candidate: d09866b073137d95c44cad00235ee1a20d5d7b3e
  • release inventory: 283 entries; exact verify-commit passed
  • focused suite: 478 passed
  • full non-PostgreSQL suite: 8057 passed, 18 skipped, 338 deselected, 46 subtests passed
  • PostgreSQL 15 and 16: 171 exact nodes each, run sequentially
  • strict Hermes: 439 evidence nodes; OpenSpec: 78 passed; manifest: 150 digests verified
  • five independent final review lanes: PASS

brettheap and others added 30 commits August 29, 2026 09:18
…elease evidence proves the exact suite that ran
brettheap and others added 11 commits August 29, 2026 21:25
Copilot AI lite review requested due to automatic review settings August 30, 2026 12:00

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the ratified neutral intent-compliance contract family (schemas/templates/examples + canonical validator) and rolls it into the additive contract-v2.3 release, alongside additional hardening of Hermes runtime validation (exact Git trust boundaries and static pytest evidence inventory).

Changes:

  • Introduces contracts/intent-compliance/ (five record kinds) and scripts/validate-intent-compliance.py with a focused positive/negative corpus and pytest coverage.
  • Advances the contracts bundle to contract-v2.3 and updates manifest/changelog/release evidence surfaces accordingly.
  • Strengthens Hermes runtime validation around static pytest node inventory and Git/environment hardening; updates related tests and evidence artifacts.

Reviewed changes

Copilot reviewed 132 out of 134 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/intent-compliance/test_temporal.py Adds unit coverage for timestamp parsing normalization.
tests/intent-compliance/test_registry_hardening.py Adds negative-case tests for registry/revocation hardening rules.
tests/intent-compliance/test_redaction_boundaries.py Adds tests ensuring credential-shaped values are rejected/redacted.
tests/intent-compliance/test_intent_compliance_negative_corpus.py Adds negative-fixture corpus closure tests and hostile-input checks.
tests/intent-compliance/test_evidence_integrity.py Exercises evidence-shape evolution and classifier trigger validation.
tests/intent-compliance/test_decision_hardening.py Adds decision outcome/binding hardening tests.
tests/intent-compliance/test_classifier_coherence.py Adds classifier coherence and derived-outcome checks.
tests/hermes_runtime_contracts/test_validator_cli.py Adds CLI/static inventory safety regression tests.
tests/hermes_runtime_contracts/test_topology_and_identity.py Stabilizes topology param IDs and asserts ordering matches YAML.
tests/hermes_runtime_contracts/test_static_evidence_suppression.py Adds suppression-boundary tests for static evidence collection.
tests/hermes_runtime_contracts/test_static_evidence_security.py Adds security-focused node-id proof tests for evidence inventory.
tests/hermes_runtime_contracts/test_static_evidence_edge_cases.py Adds edge-case tests for static proof/collection behavior.
tests/hermes_runtime_contracts/test_static_evidence_collection_boundaries.py Adds boundary tests for static collection proof rules.
tests/hermes_runtime_contracts/static_evidence_helpers.py Adds helpers for writing/collecting static-evidence test modules.
tests/hermes_runtime_contracts/test_fixture_index.py Switches fixture-index suite identity to database_test_suite().
tests/hermes_runtime_contracts/test_content_resolution.py Adds alternate-object-dir rejection, linked-worktree support tests, and env sanitization tests.
tests/hermes_runtime_contracts/postgres/test_migration_recovery.py Hardens lock-wait race test orchestration and removes DB timeouts.
tests/hermes_runtime_contracts/postgres/evidence/postgres-16.json Updates Postgres evidence payload to include static node digest/profile.
tests/hermes_runtime_contracts/postgres/evidence/postgres-15.json Updates Postgres evidence payload to include static node digest/profile.
tests/hermes_runtime_contracts/postgres/conftest.py Replaces env-based major selection with explicit per-major markers.
tests/hermes_runtime_contracts/postgres/compose.yaml Tightens compose isolation (e.g., network_mode: none) and removes unused client service.
specs/015-intent-compliance-contract/tasks.md Adds Speckit tasks checklist for the feature realization.
specs/015-intent-compliance-contract/spec.md Adds the feature spec for intent compliance contract realization.
specs/015-intent-compliance-contract/research.md Captures design research/decisions for schemas, validator, release allocation.
specs/015-intent-compliance-contract/quickstart.md Adds developer quickstart for validator + release workflows.
specs/015-intent-compliance-contract/plan.md Adds implementation plan and structure decisions.
specs/015-intent-compliance-contract/data-model.md Documents shared value forms and record model semantics.
specs/015-intent-compliance-contract/contracts/validator-cli.md Defines validator CLI/exit-code/finding contract.
specs/015-intent-compliance-contract/checklists/requirements.md Adds requirements/spec quality checklist output.
scripts/validate-hermes-runtime-contracts.py Reworks node collection to use static evidence inventory rather than invoking pytest.
scripts/validate-contract-release.py Hardens git-root detection via sanitized Git environment and no-replace-objects.
scripts/intent_compliance/yaml_discovery.py Adds early YAML event scanning for governed kind detection under parse errors.
scripts/intent_compliance/validator.py Adds public validator entrypoint for intent-compliance document validation.
scripts/intent_compliance/temporal.py Adds timestamp parsing helper used throughout intent-compliance validation.
scripts/intent_compliance/state_validation.py Adds canonical-digest/identity/time ordering checks for governed records.
scripts/intent_compliance/schema_validation.py Adds schema registry and schema-finding generation for governed kinds.
scripts/intent_compliance/registry_state.py Adds registry state selection/binding logic (terminal vs applicable snapshot).
scripts/intent_compliance/records.py Adds core record/value types and small helpers.
scripts/intent_compliance/pipeline.py Implements the schema+semantic validation pipeline for governed docs.
scripts/intent_compliance/input_io.py Adds bounded, non-symlink file IO and directory constraints for hostile inputs.
scripts/intent_compliance/fixture_metadata.py Adds negative-fixture header parsing for expected failures/requirements.
scripts/intent_compliance/evidence_validation.py Adds deterministic/dispatch evidence binding and digest checks.
scripts/intent_compliance/enforcement_validation.py Adds cross-gate sequence/binding/reference-set enforcement.
scripts/intent_compliance/discovery.py Adds bounded discovery of candidate YAML inputs in directories.
scripts/intent_compliance/classifier_validation.py Adds classifier limits/coherence/trigger binding checks.
scripts/intent_compliance/canonical.py Adds canonical JSON encoding/digest utilities with strict numeric constraints.
scripts/intent_compliance/authority_source.py Adds closed authority-source document parsing and validation.
scripts/intent_compliance/allowance_resolution.py Adds allowance resolution/reason-code derivation and revocation applicability logic.
scripts/hermes_runtime_validation/pytest_targets.py Adds AST-based pytest target discovery helpers.
scripts/hermes_runtime_validation/pytest_support.py Adds AST rules for allowed pytest constructs and suppression detection.
scripts/hermes_runtime_validation/pytest_source.py Adds bounded, symlink-safe source reading/parsing for static proof.
scripts/hermes_runtime_validation/pytest_paths.py Adds canonical path validation for test modules.
scripts/hermes_runtime_validation/pytest_parameter_ids.py Adds static skip evaluation for decorators and parameter-id proofs.
scripts/hermes_runtime_validation/pytest_inventory.py Adds static evidence node collection against the evidence register.
scripts/hermes_runtime_validation/pytest_fixtures.py Adds fixture dependency + parametrization dimension proof logic.
scripts/hermes_runtime_validation/pytest_execution_validation.py Adds validator for execution report parity against static inventory.
scripts/hermes_runtime_validation/pytest_execution_report.py Adds pytest plugin to emit execution evidence deterministically.
scripts/hermes_runtime_validation/pytest_count.py Adds static counting of pytest nodes under strict proof constraints.
scripts/hermes_runtime_validation/pytest_config.py Adds strict acceptance rules for pytest configuration surfaces.
scripts/hermes_runtime_validation/loader.py Adds YAML complexity bounds and safer byte-based loading for Hermes YAML.
scripts/hermes_runtime_validation/fixtures.py Switches Postgres suite identity from runtime collection to static node digest identity.
scripts/hermes_runtime_validation/content.py Expands Git environment sanitization and trust boundary hardening for exact-object resolution.
README.md Updates OpenSpec change index to reflect ratification status/record.
openspec/changes/add-standing-policy-compliance-contract/specs/intent-compliance/spec.md Updates requirement language to “coherent snapshot” and clarifies dispatch evidence boundaries.
openspec/changes/add-standing-policy-compliance-contract/review/ratification-2026-08-26.md Adds explicit ratification record for the change.
openspec/changes/add-standing-policy-compliance-contract/proposal.md Updates proposal status to ratified and links ratification record.
openspec/changes/add-standing-policy-compliance-contract/design.md Updates design doc to ratified and clarifies neutral/runtime boundaries.
contracts/README.md Adds contract index entries for the new intent-compliance family and validator.
contracts/manifest.yaml Bumps bundle version to contract-v2.3 and registers new intent-compliance members.
contracts/intent-compliance/veto-class-vocabulary.template.yaml Adds template for vocabulary record.
contracts/intent-compliance/veto-class-vocabulary.schema.yaml Adds schema for vocabulary record.
contracts/intent-compliance/README.md Adds family documentation and usage/validation guidance.
contracts/intent-compliance/policy-allowance.template.yaml Adds template for allowance approval record.
contracts/intent-compliance/policy-allowance.schema.yaml Adds schema for allowance approval record.
contracts/intent-compliance/policy-allowance-revocation.template.yaml Adds template for revocation event record.
contracts/intent-compliance/policy-allowance-revocation.schema.yaml Adds schema for revocation event record.
contracts/intent-compliance/policy-allowance-registry.template.yaml Adds template for registry revision record.
contracts/intent-compliance/policy-allowance-registry.schema.yaml Adds schema for registry revision record.
contracts/intent-compliance/examples/positive/vocabulary.example.yaml Adds positive example for vocabulary record.
contracts/intent-compliance/examples/positive/revocation.example.yaml Adds positive example for revocation event.
contracts/intent-compliance/examples/positive/registry.example.yaml Adds positive examples for registry revisions.
contracts/intent-compliance/examples/positive/allowance.example.yaml Adds positive example for allowance approval.
contracts/intent-compliance/examples/negative/unclaimed-veto-as-allow.yaml Adds negative fixture for outcome composition rule.
contracts/intent-compliance/examples/negative/unauthorized-revoker.yaml Adds negative fixture for revoker authority attribution.
contracts/intent-compliance/examples/negative/unauthorized-issuer.yaml Adds negative fixture for issuer authority attribution.
contracts/intent-compliance/examples/negative/reused-allowance-id.yaml Adds negative fixture for allowance-id reuse detection.
contracts/intent-compliance/examples/negative/raw-intent-evidence.yaml Adds negative fixture for raw evidence prohibition.
contracts/intent-compliance/examples/negative/missing-classifier-limits.yaml Adds negative fixture for required classifier limits in schema.
contracts/intent-compliance/examples/negative/indeterminate-scope-as-allow.yaml Adds negative fixture for scope outcome rules.
contracts/intent-compliance/examples/negative/hermes-review-as-allow.yaml Adds negative fixture for Hermes outcome composition.
contracts/intent-compliance/examples/negative/duplicate-class-id.yaml Adds negative fixture for duplicate class IDs in vocabulary.
contracts/intent-compliance/examples/negative/classifier-error-as-allow.yaml Adds negative fixture for classifier error fail-closed behavior.
contracts/intent-compliance/examples/negative/approval-content-changed.yaml Adds negative fixture for cross-gate binding stability.
contracts/intent-compliance/examples/negative/allowance-reference-substitution.yaml Adds negative fixture for allowance reference substitution across gates.
contracts/intent-compliance/compliance-decision.template.yaml Adds template for compliance decision record.
contracts/hermes-runtime/evidence-register.yaml Updates one recorded pytest node ID for release inventory test.
contracts/CHANGELOG.md Adds contract-v2.3 release notes and documents superseding digest correction.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/intent_compliance/pipeline.py Resolved
@brettheap
brettheap merged commit ec8be5a into main Aug 30, 2026
4 checks passed
@brettheap
brettheap deleted the 015-intent-compliance-contract branch August 31, 2026 01:13
brettheap pushed a commit that referenced this pull request Aug 31, 2026
…both tags are now published (#532)

`contract-v2.4`'s changelog entry carried a careful `contract-v2.3`
disposition subsection — target commit measured by the ratified rule,
`verify-commit` run, and "TAG PUBLICATION IS THE REPOSITORY OWNER'S ACT
AND IS RECORDED HERE AS PENDING" — and said nothing about its own tag,
which the same clause binds the moment the bundle is declared. This adds
the subsection that was missing.

Both tags were published by the repository owner on 2026-08-31 and both
peel to the commit the rule names:

- `contract-v2.3` → tag `9fe9a742` → `ec8be5aa` (the #514 merge)
- `contract-v2.4` → tag `3374ad2f` → `afdf0e88` (the #526 squash)

`verify-commit` passes at both against their own inventories, exit 0. The
rule — the earliest first-parent commit on published `main` that declares
the bundle and at which `verify-commit` passes — was re-validated against
a live control before being trusted here: it returns `8ccfb67b` for
`contract-v2.2`, and that bundle's already-published tag peels to exactly
that commit.

The v2.3 subsection is NOT edited. Its heading still reads PENDING and
that was true when written; the completion is recorded in the new
subsection instead. This is the handling the versioning policy already
requires of `docs/archive-record-discrepancies.md`, which still states
that `contract-v1.33` and `contract-v1.35` are not git tags and is
deliberately left uncorrected, because rewriting a statement to match
today's state destroys the evidence of what was true then.

The new subsection also records why the omission is structural rather
than careless, and cites **#528**: no gate anywhere asserts that a
declared bundle has a published tag. `verify_tag` exists but is called
only by unit tests over synthetic repositories, no workflow calls the
release validator at all, `release-surface-integrity` deliberately does
not anchor on tags, and `tag-hygiene` is a different family entirely
(document prose tags). That is why the same shape reached
`contract-v1.33`/`v1.35`/`v1.39` in August and needed a ruling to
discharge, and why the policy's sentence "every bundle from
contract-v1.7 is now tagged" has now been false twice with nothing
noticing.

Docs-only, one file. tests/hermes_runtime_contracts/test_release_inventory.py
+ tests/intent-compliance/test_release_boundary.py: 81 passed. doc-health
with and without the change: identical, zero new findings.

Co-authored-by: brettheap <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
brettheap added a commit that referenced this pull request Aug 31, 2026
…ain is not an audit trail, it is a permission) (#533)

* Realize add-signed-execution-chain: cut contract-v2.5 (a validated chain is not an audit trail, it is a permission)

Task 4.7 — the cut-dependent box act one (PR #524, squash 9af98c4) left to the
cutting session, because a proposed change MUST NOT reserve a minor number before
merge order is known.

THE NUMBER, FRESH-COUNTED AT THE CUT — THE THIRD COUNT, and it has moved twice:
the packet read contract-v2.3 (PR #514 took it), the realization read
contract-v2.4 (#526 afdf0e8 cut AND tagged it alone). At this tip
contracts/manifest.yaml:3 declared contract-v2.4, contracts/releases/ held
inventories through v2.4, git ls-remote published v2.0-v2.4, no Unreleased block
was pending, and `grep -c signed-execution-chain
contracts/releases/contract-v2.4.digests.yaml` returned 0 — so v2.4 is spent and
covers none of this family. Next additive number: contract-v2.5.

Nothing had to be renumbered when a sibling took v2.4, because act one wrote the
re-count INSTRUCTION into tasks.md and no number into any contract byte.

ADDITIVE (minor), AND NOTHING NARROWS — MEASURED, NOT CLAIMED.
`git diff --name-status contract-v2.4 9af98c4 -- contracts/` reports 47
additions and exactly ONE modification, and that modification is
contracts/README.md, the editorial index. Not one schema, template, example or
registry already published moved a byte, so there is no shared file in which a
prior-bundle instance could be refused. contract_schema_version unchanged.

WHAT MOVED, IN ORDER, WITH THE INVENTORY LAST:

- contracts/manifest.yaml: contract_bundle_version contract-v2.4 -> contract-v2.5,
  plus the signed-execution-chain family block registering all FIVE schemas with
  per-file sha256. 167 rows -> 172; validate-manifest-digests.py 150 -> 155
  verify. The corpus, the family README, the reader and its pytest wiring are
  content-addressed by commit with no per-file digest (the openxWallet,
  client-identity-roster, identity-brokering and trust-anchor precedent).
- contracts/CHANGELOG.md: the contract-v2.5 entry, with the nothing-narrows
  measurement, the fresh count, the two structural residuals, the
  registration-is-not-enforcement section and the contract-v2.3 discharge.
- contracts/README.md + contracts/signed-execution-chain/README.md: the three
  "REALIZED and NOT YET REGISTERED" sentences act one wrote, resolved to the
  literal contract-v2.5, each keeping its enforcement line.
- docs/contract-versioning-policy.md: contract-v2.3 recorded as a FOURTH untagged
  instance and its discharge, in the section that already holds three. The
  section's "Every bundle from contract-v1.7 ... is now tagged" was true when
  written, became false, and is true again; a reader must not take it as evidence
  the practice never lapsed.
- tests/intent-compliance/test_release_boundary.py: the boundary pin ADVANCED, not
  broadened. The tripwire fired on the bump, correctly — the library floor is an
  at-or-after comparison that would never have noticed. One named enum member,
  same match arm, 13 tests before and 13 after. The reason it needs a hand act is
  sharper here than at v2.4: this cut registers a DIFFERENT family, so nothing
  about it touches intent-compliance's membership, which is exactly the fact a
  human has to state because the library cannot tell "unchanged" from "unnoticed".
- tests/signed_execution_chain/test_manifest_row_digests.py: NEW. The five rows
  this cut adds are recomputed from the files on disk, and the registration is
  closed in BOTH directions with the on-disk set derived from the DIRECTORY.
  It exists because scripts/validate-manifest-digests.py, which sweeps all 155
  rows, is wired into NO workflow and NO test — a tool that catches drift when a
  human remembers to run it is the failure mode it was written to close, one
  level up.
  RED-PROVEN, AND THE PROOF FOUND A DEFECT IN THE TEST ITSELF: a 64-zero digest
  is parsed by PyYAML as an INT, so slicing it raised TypeError where a MISMATCH
  was the answer owed — this realization's own round-three lesson, that every
  refusal must reach the caller as the same kind of answer, arriving in its own
  gate. Repaired with str() (the sweeper's precedent) plus an explicit
  isinstance(..., str) assertion, since an int-parsed digest also silently loses
  leading zeros. Both mutation classes now report as findings.
- contracts/releases/contract-v2.5.digests.yaml: built LAST, by
  scripts/validate-contract-release.py build, never hand-edited. 283 entries —
  MEMBERSHIP UNCHANGED from v2.4's 283, zero added and zero removed, which is what
  an additive release looks like in an inventory: the growth is in what a member
  ASSERTS. Exactly five digests move, each a file this cut edited. Built TWICE for
  that reason: rebuilt after two members moved during review of the entry text.

REGISTRATION IS NOT ENFORCEMENT, and every artifact this cut touches says so.
Tasks 4.5 and 4.6 are OPEN and are not this session's to close, and they are the
ones that decide whether any of the rest confers anything: 4.5 makes the named
reader a REQUIRED check in the branch ruleset, an OPERATOR act whose evidence is
the live ruleset state and never a merged workflow file; 4.6 is its canary
evidence and is blocked on 4.5 by construction. Requirement 9 is UNMET rather
than partially met, the packaged conformance declaration still records
is_required_in_ruleset: false, and the reader still warns on every run.

contract-v2.3 — THE PENDING OWNER ACT IS DISCHARGED, surfaced by this cut's fresh
count. The tag exists on the remote, verify-tag passes, and it dereferences to
ec8be5a — exactly the commit the contract-v2.4
entry measured as the earliest first-parent commit on main declaring the bundle at
which verify-commit passes (the PR #514 merge). Tag object dated 2026-08-31
03:14 -0400, the same timestamp as contract-v2.4's: the owner published both
together. Untagged window about nineteen hours, during which afdf0e8 consumed
v2.3 as a spent number. RECORDED, NOT SOFTENED, and nothing here tags or re-tags
anything.

The uncut mismatch 4.7 predicted was found exactly as predicted: verify-commit
--commit HEAD at 9af98c4 reported ONE HGR-RELEASE-DIGEST-MISMATCH, on
contracts/README.md, and nothing else. No non-editorial member drifted. The cut
resolves it by construction.

Full working record: openspec/changes/add-signed-execution-chain/realization-evidence.md

Co-Authored-By: Claude Fable 5 <[email protected]>

* Bot round: derive the on-disk schema set from the whole directory, not one level of it

Copilot, PR #533 round one, and the finding is real. The closure test derived the
on-disk set with Path.glob("*.schema.yaml"), which reads the family ROOT ONLY —
so a schema placed in a SUBDIRECTORY would bypass the closure this test exists to
enforce and ship UNREGISTERED while the test stayed green.

Not hypothetical: this repository already carries
contracts/hermes-runtime/migrations/v1-to-v2-mapping.schema.yaml, the only nested
schema under contracts/ today and proof the layout is reachable.

MEASURED AGAINST THE PRE-FIX PREDICATE, not reasoned about. With an unregistered
nested sixth schema on disk, glob returned exactly the five expected paths and the
assertion PASSED; rglob fails. glob and rglob return the identical five paths at
this cut, so the fix changes nothing today and closes the hole for whoever adds
the sixth file.

The docstring said "derived from the DIRECTORY" while the code read one level of
it — this capability's own round-one defect class, a check that looked like it was
doing its job, arriving one level up in the cut's own instrument. The instrument
gets the same scrutiny as the thing it measures.

realization-evidence.md records the round. No inventory member moved, so the
contract-v2.5 inventory is unchanged and verify-commit stays green.

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: brettheap <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants