Skip to content

fix: witness map missed 5 tested repos and split 2 more across keys - #271

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/refactor-witness-map-audit
Aug 24, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
claude/refactor-witness-map-audit

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

The audit #267 asked for and never got. #268 fixed the PyAutoNerves half of the
Refactor Agent's witness map; this checks the rest, and Nerves turns out not to
have been a one-off.

test_witness had no row at all for PyAutoCTI or for five organs
(Brain, Heart, Hands, Memory, Mind) that all have real suites — so
behaviour_preservation reported them unwitnessed and the conductor advised
"strengthen tests first" for repos that are already tested. Two more carried
the same two-keys-per-repo defect #268 fixed for Nerves: @PyAutoCTI/@autocti
and @PyAutoReduce/@autoreduce normalised to different keys with nothing
joining them, and the Reduce row was keyed on the prefixed spelling — so the
bare package spelling, the one prompts actually use, missed the witness.

Repo Test dir (verified) Before
PyAutoCTI test_autocti missing entirely
PyAutoReduce test_autoreduce keyed pyautoreduce; @autoreduce missed
PyAutoBrain / Heart / Hands / Memory / Mind tests missing
PyAutoGut none correctly absent — now says so in a comment

Every row was verified by reading the repository's own tree
(PyAutoLabs/<repo>@main), not inferred from the naming convention — which
matters, because the organs break the test_<package> pattern the libraries
follow.

The keying rule is now stated where the map lives: canonical key is the bare
package name where the repo ships one, the repo name where it does not.

API Changes

None. Internal policy maps only; test_witness has exactly one consumer
(_refactor.behaviour_preservation) and this change only ever adds resolvable
keys — no repo that already resolved changes behaviour.

Test Plan

  • python3 -m pytest tests/ -q → 468 passed
  • python3 PyAutoMind/scripts/repos_sync.py --check → all 11 checks OK
  • Live resolution check — all twelve tested repos now resolve under both
    spellings, unwitnessed_repos == ['pyautogut'] and nothing else
  • Mutation-tested the guards rather than trusting them (below)
Three guards, and proof each one bites

All three derive from the body map, so they hold for an adopting fork and name
no instance fact — the tenant-firewall leg of repos_sync --check enforces
that, and it rejected two earlier drafts of these tests that hardcoded repo
names.

  1. Coverage — every library/organ in the body map needs a witness row or
    a reasoned WITNESS_EXEMPT entry; an exemption naming a repo the body map
    has since dropped is itself a failure, so the allowlist can't rot into a
    blanket waiver.
  2. Key sanity — a row's key must be what the repo it names normalises to.
    This is the invariant autoconf: PyAutoConf/test_autoconf violated while
    looking entirely plausible.
  3. Both spellings — where a row's value shows the repo ships a package
    (<Repo>/test_<package> does, <Repo>/tests does not), both spellings must
    reach the same key.

Verified by mutation, not assertion:

Mutation Caught by
drop the autocti witness row guard 1
drop the pyautoreduce alias guards 1, 2
restore the original mis-keyed pyautoreduce row guards 1, 2, 3

That last row is the point: the pre-existing defect this PR fixes would now
fail CI three ways.

One gap found and deliberately left open

The bare spellings of the organ repos still split: _target_sets registers
both pyautobrain and autobrain as known targets, but only the prefixed form
is canonical, so @autobrain, @autoheart, @automemory and @automind
resolve to keys nothing is filed under. I fixed only @autohands, because
extra_organism_targets explicitly declares it and it therefore reaches real
code today; the others are latent and fixing them means deciding whether organs
should key bare or prefixed across target_signals too — a policy question
wider than this prompt. Filed as a note on #269 rather than widened into this
PR.

Reviewer caveats

Ordering

Stacked on #268 — same file, same two maps. Based against
claude/pyautoconf-rename-leftovers-38ia48 so the diff shows only this task's
change; it will retarget to main automatically when #268 merges. Merge #268
first.

Effective autonomy safe (header safe, maintenance cap safe); plan
written to #269 at the start, unmodified since. Gate: tests PASS (468) · smoke
n/a (organism repo) · review CLEAN with the disposition above · Heart not
evaluated.

Closes #269

🤖 Generated with Claude Code

https://claude.ai/code/session_01MPhEXMoPYa7H1sNHWR2GNW


Generated by Claude Code

Follow-up to #267/#268, which fixed the PyAutoNerves half of the Refactor
Agent's witness map. This is the audit that prompt asked for: Nerves was not a
one-off.

`test_witness` had no row for PyAutoCTI or for five organs that all have real
suites, so `behaviour_preservation` reported them `unwitnessed` and the
conductor advised "strengthen tests first" for repos that are already tested.
Two more repos carried the same two-keys-per-repo defect #268 fixed for Nerves:
`@PyAutoCTI`/`@autocti` and `@PyAutoReduce`/`@autoreduce` normalised to
different keys with no alias joining them, and the Reduce row was keyed on the
prefixed spelling — so the bare package spelling, the one prompts actually use,
missed the witness entirely.

Every row was verified against the repository itself (tree read of
PyAutoLabs/<repo>@main), not inferred from the naming convention:
test_autocti and test_autoreduce exist; Brain, Heart, Hands, Memory and Mind
each keep a plain `tests/`. PyAutoGut has no suite and is deliberately left out
with a comment, so the conductor's advice is correct there rather than noise.

The keying rule is now stated where the map lives: the canonical key is the
bare package name where the repo ships one, the repo name where it does not.

Three guards, all deriving from the body map so they hold for an adopting fork
and name no instance fact:

- every library/organ needs a witness row or a reasoned WITNESS_EXEMPT entry,
  and an exemption naming a repo the body map dropped is itself a failure;
- a row's key must be what the repo it names normalises to — the invariant
  `autoconf: PyAutoConf/test_autoconf` violated while looking plausible;
- where a row's value shows the repo ships a package, both spellings must reach
  the same key.

Reverting any of the three fixes above now fails one or more of these; the
pre-existing mis-keyed Reduce row fails all three.

Closes #269

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MPhEXMoPYa7H1sNHWR2GNW
@Jammy2211
Jammy2211 changed the base branch from claude/pyautoconf-rename-leftovers-38ia48 to main August 24, 2026 21:30
@Jammy2211
Jammy2211 merged commit cf969f3 into main Aug 24, 2026
2 checks passed
@github-actions
github-actions Bot deleted the claude/refactor-witness-map-audit branch August 25, 2026 14:09
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.

fix: witness map misses 5 repos with real test suites, splits 2 more across keys

1 participant