Skip to content

Realize harden-ideation-readiness-check: the proof reads its own repository, at a commit, and reds on an unreachable pin - #400

Merged
brettheap merged 3 commits into
mainfrom
change/realize-ideation-readiness-check
Aug 27, 2026
Merged

brettheap merged 3 commits into
mainfrom
change/realize-ideation-readiness-check

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Realizes the ratified packet harden-ideation-readiness-check (admitted by Brett, 2026-08-26). Three ADDED doc-health requirements, nine scenarios, no requirement MODIFIED. Do not archive on merge — tasks.md § 4.6 is the archive act and stays open.

What was broken

tests/doc-health/test_ideation_readiness.py::test_derivation_reproduces_the_real_bootstrap_clusters is the proof that the readiness lane's derivation still reproduces the landed ideation-cross-reference index. It carried three defects:

  • A — it read a checkout nobody asked it to read. _openxfactory_root() walked UP to the first ancestor holding openxFactory/ideation/cross-reference.yaml, which inside the aggregation workspace is always the ONE shared checkout. Every agent worktree proved a verdict about another session's working tree. find_index_validator() carried the identical walk and spawned that checkout's validator besides.
  • B — it read the index from a working tree, so an uncommitted edit anywhere on the machine moved the verdict.
  • C — an unresolvable pin became a skip, with the reason "(shallow clone?)" — a conjecture that is false where it fires, since pytest-suite.yml checks out at fetch-depth: 0.

What changed

  1. Resolution order (design § 1): repository under test first; only if that checkout carries no index does the resolver reach further — explicit argument, OPENXFACTORY_ROOT, then the walk — and every rung past the first announces which checkout it took and why. Applied to all three test spellings AND to find_index_validator().
  2. Committed read point (design § 2): git show <HEAD>:ideation/cross-reference.yaml, with the resolved revision named in both assertion messages. Both sides of the comparison are now revision-addressed.
  3. Fail vs skip by observation (design § 3): on git archive failure the code asks git rev-parse --is-shallow-repository and git cat-file -e <rev>^{commit}. Complete clone plus absent object FAILS, naming the pin and the index; a genuinely truncated clone skips, naming the truncation observed.
  4. The live instance repaired: the pin moves f13a3b60 → 4e57009c and ideation/cross-reference.md is re-rendered through scripts/render-ideation-cross-reference.py — exactly one line each. Nothing else in either file moved.

THE ACCEPTANCE SIGNAL — measured, not asserted

Nothing was written to the shared checkout. The hazard was reconstructed instead: an aggregation root holding a checkout at openxFactory/, two fresh fetch-based clones beneath it at worktrees/, and the sibling dirtied into the exact 2026-08-26 shape — an uncommitted hand-bumped source_revision with the body left as generated and truncated to 67 topic_entries.

run tests/doc-health
pre-change code, sibling dirty 1 failed, 895 passed — the packet's baseline, reproduced to the number
this change, sibling dirty 920 passed
this change, sibling clean 920 passed — the same verdict, which is the whole question

THE GATE (tasks.md § 4.3) — the first execution in a fresh clone

Fresh git clone --no-local (never --local, which copies unreachable objects and would have hidden the defect). Every clone is complete — rev-parse --is-shallow-repository → false — and NONE carries f13a3b60, which reproduces the packet's defect-B measurement.

clone code ancestor checkout verdict
fresh, isolated pre-change none SKIP — "openxFactory checkout unreachable"
fresh, isolated this change none PASS
fresh, under an aggregation root pre-change clean SKIP — "pinned revision f13a3b6 unreachable (shallow clone?)"
fresh, under an aggregation root this change clean PASS

A FINDING THIS RUN SURFACED, reported rather than suppressed. The assertion was unreachable by TWO routes, not one. In an ISOLATED clone — which is exactly how this repository's own CI checks out — the pre-change resolver could not find the repository's OWN index, so the proof skipped before it ever reached the pin. In the CI shape the pre-change tests/doc-health run is 889 passed, 7 skipped; with this change it is 920 passed, 0 skipped. Seven real-corpus proofs — the derivation proof, the validator wiring, the pipeline proof — have never run on a runner. They run now.

Pin repair — verified the way the requirement will verify it

Re-measured before writing, by rebuilding the derivation from the corpus at each candidate and comparing skeletons against the COMMITTED 290-entry body:

revision reachable derived reproduces committed body
f13a3b60 (the orphan pin) no ref 290 yes
da9bf3b7 (generated at) no ref 290 yes
4e57009c (landed the index) yes 290 yes
current origin/main (275d065d) yes 288 NO

Scratch git clone --bare --no-local: is-shallow-repository → false; cat-file -t f13a3b60 → 128, cat-file -t 4e57009c → commit; git archive f13a3b60 ideation → 128, git archive 4e57009c ideation → 0. scripts/validate-ideation-cross-reference.py … --strict → 0 error(s), 0 warning(s).

Q1 / Q2 / Q3 dispositions

  • Q1 — KEEP the narrowed skip. Taken as a MEASURED DECISION by the realizing session (§ 2/§ 3 cannot be written without it), not as a ruling; recorded against the question in proposal.md. The skip now only fires after rev-parse --is-shallow-repository has answered true, so it is a stated observation about the clone rather than the silence defect C was. Both branches carry regressions that assert WHICH outcome was raised, so reversing this is one branch and one test.
  • Q2 — 4e57009c. Also a measured decision — and its evidence moved. The proposal recorded 290 at origin/main when main stood at 31c931fa; current main derives 288, so "both produce a body identical to today's" is no longer true and the regenerate-at-main alternative would now owe a body regeneration. The recommendation survived its own evidence changing.
  • Q3 — NOT TAKEN, STILL OPEN. The three resolver spellings are fixed in place exactly as tasks.md § 2 prescribes; tasks.md § 5.1 stays open. What the realization added is a guard against the duplication rotting: every resolver test is parametrized over all three modules (RESOLVERS), so the copies cannot drift apart silently while the question waits for a ruling.

Verification

  • python3 -m pytest tests/doc-health -q → 920 passed (896 before; the 24 added are the regressions, no existing test moved).
  • python3 -m pytest tests/ -q -m "not postgres" → 6639 passed, 18 skipped, 338 deselected, 1 failed in 19m49s. The one failure is tests/hermes_runtime_contracts/test_validator_cli.py::test_release_mode_field_is_preserved_on_the_real_repository[--require-realization-realization], a 30s _run_cli timeout — and it is PRE-EXISTING AND ENVIRONMENTAL, proven rather than presumed: it reproduces identically at unmodified origin/main (bb7d7ae8) in a sibling agent worktree, and it PASSES with this change's code in a fresh clone (47.58s, both parameters). The CLI takes ~33s from a worktree under the aggregation root against ~24s from an isolated clone; git ls-remote is 1.65s of that, so it is local walking, not the network.
  • openspec validate harden-ideation-readiness-check --strict → valid; openspec validate --all --strict → 77 passed, 0 failed.
  • Single-repo doc-health before and after: 5 critical / 7 error / 4 info / 41 warning both times, and diff before.md after.md is EMPTY. release-inventory-drift 0 → 0, proposal-origin 0 → 0. The one ideation/cross-reference.md record-immutability finding is pre-existing — it is present identically on a pristine origin/main clone.
  • Release-bundle membership checked, not assumed: none of scripts/doc_health/ideation_readiness.py, the four test modules, ideation/cross-reference.yaml or ideation/cross-reference.md appears in ANY contracts/releases/*.digests.yaml (those inventories carry only contracts/, schemas/ and the hermes_runtime_validation surface). No bundle is owed.

Mutation discipline

Every regression is pinned to a defect rather than to the fix. The in-suite mutation check spells the pre-change walk out verbatim and asserts it resolves the ancestor decoy over the SAME fixture where the shipped resolver resolves the repository under test. Two further mutants were run by hand and reddened the suite:

mutant reddened
committed read → working-tree read 3 tests
discrimination → unconditional skip 2 tests
validator resolver → bare ancestor walk 2 tests

The unreachable-pin regression catches (Failed, Skipped) and then asserts WHICH was raised. Catching only Failed would report a regression back to the skip as a SKIPPED test — a green scoreboard over an absent verification, which is defect C wearing the costume of the guard against it.

For Brett

  • Q1 and Q2 were taken as measured decisions because the implementation could not be written without them; both are recorded against their questions and either is a small edit to reverse. Q3 and the four decisions in § Orchestrator decisions were NOT ruled and stay flagged for veto.
  • tasks.md § 5.3 remains unaddressed and named: git_generation() pins rev-parse HEAD whether or not the working tree is clean.
  • § 5.2 — the governance rule that a source_revision recorded on a branch must be re-derived when that branch lands rewritten — is still an unwritten follow-up packet. This change makes its absence loud and repairs the one live instance; it does not state the rule.

🤖 Generated with Claude Code

brettheap and others added 2 commits August 26, 2026 20:19
…cannot

Three defects, one verification. The readiness derivation proof resolved its
subject by walking UP to the first ancestor holding
openxFactory/ideation/cross-reference.yaml, which inside the aggregation
workspace is always the ONE shared checkout — so every agent worktree proved a
verdict about another session's working tree, and find_index_validator() spawned
that checkout's validator besides. It read the index from a WORKING TREE, so an
uncommitted edit anywhere on the machine moved the verdict. And it turned an
unresolvable generation.source_revision into pytest.skip with the reason
"(shallow clone?)" — a conjecture that is false in the one place it fires, since
pytest-suite.yml checks out at fetch-depth: 0.

Resolution order now tries the repository under test first; only if that
checkout carries no index does it reach further — explicit argument,
OPENXFACTORY_ROOT, then the walk — and every rung past the first announces which
checkout it took and why. All three test spellings of the helper move together
(Q3, whether they collapse into one fixture, stays OPEN), and
find_index_validator() takes the same order, which also lets a standalone clone
find its own validator for the first time.

The index side of the comparison becomes revision-addressed like the corpus side
already was: git show <HEAD>:ideation/cross-reference.yaml, with the revision
named in both assertion messages. The accepted trade is stated rather than
hidden — an index edit is proved when it is committed, not while it sits in a
working tree.

An unresolvable pin is now discriminated by asking the repository rather than
guessing: rev-parse --is-shallow-repository and cat-file -e <rev>^{commit}.
Complete clone plus absent object FAILS, naming the pin and the index that
carries it; a genuinely truncated clone still skips (Q1 = KEEP), with a reason
naming the truncation observed.

The one live instance is repaired in the same commit, because requirement three
would otherwise land red on its own gate: main pinned f13a3b6, reachable from
no ref (the generating branch landed squashed as 4e57009), so the pin moves to
4e57009 and ideation/cross-reference.md is re-rendered through
scripts/render-ideation-cross-reference.py — one line each. Re-measured here
before writing: the derivation reproduces the committed 290-entry skeleton at
da9bf3b, at 4e57009, and at the old origin/main of 31c931f — but at CURRENT
main it derives 288, because the corpus has moved since the packet was authored.
Q2's recommendation is stronger than when it was written.

24 regressions, every one pinned to a defect rather than to the fix, over real
two-commit fixture repositories under tmp_path. The mutation check spells the
old walk out verbatim and proves the fixture reproduces defect A; two further
mutants — the working-tree read and the unconditional skip — were run by hand
and reddened the suite. The unreachable-pin regression catches both outcomes and
asserts WHICH was raised, because a test that merely skips when the skip returns
is the defect wearing the costume of the guard against it.

Realizes: harden-ideation-readiness-check (doc-health; three ADDED requirements,
nine scenarios).

Co-Authored-By: Claude Fable 5 <[email protected]>
…t got wrong

The tasks now carry their evidence in the task rather than beside it: 920 tests
where the packet predicted 895-plus-one-red, 77 openspec items strict-green, a
single-repo doc-health report that diffs EMPTY against the pre-change run, and a
release-bundle membership check that was performed rather than assumed — none of
the edited files appears in any contracts/releases/*.digests.yaml, so no bundle
is owed.

Two of the packet's measurements have decayed since it was authored, and both
are corrected where they live rather than quietly re-stated:

The derivation reproduces the committed 290-entry body at da9bf3b and at
4e57009, but at CURRENT main it derives 288. The proposal measured 290 at
origin/main when main stood at 31c931f. So Q2's "both produce a body identical
to today's" is no longer true, and the alternative it offered would now owe a
body regeneration. Q2's recommendation survives its own evidence changing, which
is the strongest form it could have taken.

The assertion was unreachable by two routes, not one. In an ISOLATED clone — how
this repository's own CI validate job checks out — the pre-change resolver could
not find the repository's OWN index, and the proof skipped before it ever
reached the pin. Defect B named only the second route.

Q1 (KEEP the narrowed skip) and Q2 (re-pin to 4e57009) are recorded as MEASURED
DECISIONS taken by the realizing session, not as rulings: the implementation
cannot be written without settling them, and either is one edit to reverse. Q3
is NOT taken. The three resolver spellings are fixed in place exactly as the
tasks prescribe, and § 5.1 stays open — with the new regressions parametrized
over all three modules, so the copies cannot drift apart while the question
waits.

§ 4.6 stays unticked. The change ships ACTIVE and archives after the merge, in
its own commit.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 27, 2026 00:21

@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 realizes the harden-ideation-readiness-check packet by making the ideation readiness “derivation proof” deterministic and self-scoped: it resolves the repository-under-test first, reads the ideation index from committed Git state, and distinguishes “unreachable pin” failures from genuinely shallow-clone skips. It also repairs the live ideation/cross-reference.yaml pin and updates the corresponding generated Markdown projection.

Changes:

  • Reworks test-side “openxFactory root” resolution to prioritize the repository under test, with explicit/ENV/ancestor fallbacks and auditable announcements.
  • Updates the derivation proof to read ideation/cross-reference.yaml via git show <rev>:... and reconstruct the corpus via git archive, failing vs skipping based on observed shallowness/object presence.
  • Adds a comprehensive regression suite covering the three defects and updates the live source_revision pin (+ re-rendered .md) and packet documentation.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/doc-health/test_readiness_proof_resolution.py Adds regression coverage for resolver precedence, committed-index reads, and unreachable-pin behavior.
tests/doc-health/test_readiness_dispatch.py Aligns dispatch-side resolver to “repository under test first” and improves skip messaging.
tests/doc-health/test_ideation_readiness.py Implements committed index reads and observed fail-vs-skip behavior in the core derivation proof helpers.
tests/doc-health/test_derive_possibles.py Aligns possibles lane tests with the updated resolver behavior and explicit skip reasons.
scripts/doc_health/ideation_readiness.py Updates validator discovery to prefer the repository under test and to announce fallbacks.
ideation/cross-reference.yaml Re-pins generation.source_revision to a reachable commit.
ideation/cross-reference.md Re-renders the generated projection to reflect the updated pin.
README.md Updates the “Active changes” index entry with realization status and measured outcomes.
openspec/changes/harden-ideation-readiness-check/tasks.md Marks implementation tasks as realized while explicitly keeping the archive step open.
openspec/changes/harden-ideation-readiness-check/proposal.md Records measured decisions (Q1/Q2) and documents realization findings/impact.

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

f"state no reader can reconstruct, so its provenance claim is "
f"unverifiable: re-pin it to a reachable revision. "
f"git archive said: {detail}")
tarfile.open(fileobj=io.BytesIO(proc.stdout)).extractall(dest)
Comment on lines +449 to +454
reachable = _git(repo, "merge-base", "--is-ancestor", pin, "HEAD",
check=False).returncode == 0
assert reachable, (
f"{INDEX_REL.as_posix()} pins {pin}, which is not an ancestor of HEAD "
"— the index names a corpus state no reader can reconstruct from this "
"history (re-pin it, as harden-ideation-readiness-check § 3 did)")
…ched

Task 4.3 predicted a first execution in a fresh clone and got two. The isolated
doc-health shape moves 889 passed / 7 skipped to 920 passed / 0 skipped — seven
real-corpus proofs no runner had ever run, the derivation proof among them — and
pytest-suite on PR #400 is green at 6638 passed, 20 skipped, 0 failed in 13m07s,
which is that assertion executing on continuous integration for the first time
in the life of the test.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 27, 2026 00:37

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

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Suppressed comments (1)

tests/doc-health/test_ideation_readiness.py:506

  • _corpus_at_pin() extracts a tar stream from git archive using tarfile.extractall() without any path validation. Even though the archive is produced locally, a repository can contain paths that escape dest (e.g. ../...), which is a known tar path-traversal issue and is increasingly guarded against by Python tooling. Consider validating members before extraction, and (when supported) using filter='tar' to silence/avoid unsafe-extraction warnings in newer Python versions.
    tarfile.open(fileobj=io.BytesIO(proc.stdout)).extractall(dest)
    return dest

@brettheap
brettheap merged commit 78ffb7f into main Aug 27, 2026
3 checks passed
@brettheap
brettheap deleted the change/realize-ideation-readiness-check branch August 27, 2026 03:05
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