Skip to content

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

Closed

Description

@Jammy2211

Overview

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 and never got: "add
PyAutoNerves — and audit the other organ/library repos — so refactor
decisions stop flagging witnessed repos as unwitnessed."

The audit found the Nerves case was not a one-off. test_witness misses five
repos that have real test suites, and two more are split across two keys the
way autoconf/pyautonerves were — so pyauto-brain refactor tells you to
"strengthen tests first" for repos that are already tested.

Every row below was verified against the repository itself (shallow tree read of
PyAutoLabs/<repo>@main), not inferred from naming convention.

Findings

Repo Category Test dir (verified) In test_witness today
PyAutoNerves organ test_autonerves ✅ (added in #268)
PyAutoFit library test_autofit ✅
PyAutoArray library test_autoarray ✅
PyAutoGalaxy library test_autogalaxy ✅
PyAutoLens library test_autolens ✅
PyAutoCTI library test_autocti ❌ missing entirely
PyAutoReduce library test_autoreduce ⚠️ keyed pyautoreduce — @autoreduce misses it
PyAutoBrain organ tests ❌ missing
PyAutoHeart organ tests ❌ missing
PyAutoHands organ tests ❌ missing
PyAutoMemory organ tests ❌ missing
PyAutoMind organ tests ❌ missing
PyAutoGut organ none correctly absent — genuinely unwitnessed

The two-keys-per-repo defect recurs

This is the same root cause #268 fixed for Nerves, still live for two repos:

  • normalise_repo("PyAutoCTI") → pyautocti, normalise_repo("@autocti") →
    autocti. No alias joins them, and neither is in test_witness.
  • normalise_repo("PyAutoReduce") → pyautoreduce,
    normalise_repo("@autoreduce") → autoreduce. The map is keyed on the
    prefixed form, so the bare package mention — the spelling prompts actually
    use — misses.

Same shape for the organs: extra_organism_targets adds bare autohands as a
target while @PyAutoHands normalises to pyautohands.

Plan

  • Give every repo one canonical normalised key, extending the alias policy fix: retire PyAutoConf rename leftovers in Brain functional surfaces #268
    established: bare package name where the repo ships a package
    (autocti, autoreduce), repo name where it does not (pyautobrain,
    pyautoheart, …).
  • Re-key and fill test_witness so all twelve tested repos resolve, under every
    spelling a prompt might use.
  • Leave PyAutoGut out, with a comment saying it has no suite — an honest "no
    witness" rather than a silent gap.
  • Add a drift guard so a new library or organ cannot join the body map without
    either a witness row or an explicit, reasoned exclusion.
Detailed implementation plan

Affected Repositories

  • PyAutoBrain (only)

Work Classification

Library / organism-infrastructure. Effective autonomy safe
(header safe, maintenance cap safe).

Implementation Steps

  1. config/policy.yaml → repo_aliases. Add pyautocti: autocti,
    pyautoreduce: autoreduce, and autohands: pyautohands so each repo has a
    single canonical key. (Nerves already done in fix: retire PyAutoConf rename leftovers in Brain functional surfaces #268.)

  2. config/policy.yaml → test_witness. Re-key pyautoreduce →
    autoreduce; add autocti: PyAutoCTI/test_autocti,
    pyautobrain: PyAutoBrain/tests, pyautoheart: PyAutoHeart/tests,
    pyautohands: PyAutoHands/tests, pyautomemory: PyAutoMemory/tests,
    pyautomind: PyAutoMind/tests. Comment PyAutoGut's deliberate absence.

  3. tests/test_policy_seams.py. New drift guard: every body-map repo of
    category library or organ must have a test_witness row, except a
    named WITNESS_EXEMPT set (PyAutoGut, with its reason). A new organ with a
    suite and no witness row then fails here instead of silently reporting
    unwitnessed. Plus per-spelling assertions for the CTI and Reduce keys,
    mirroring the Nerves ones fix: retire PyAutoConf rename leftovers in Brain functional surfaces #268 added.

Key Files

  • config/policy.yaml — both maps.
  • agents/conductors/refactor/_refactor.py — behaviour_preservation consumer (unchanged).
  • agents/faculties/sizing/_sizing.py — normalise_repo / _body_map_categories (unchanged).
  • tests/test_policy_seams.py — the guard.

Verification

  • python3 -m pytest tests/ -q
  • python3 PyAutoMind/scripts/repos_sync.py --check
  • Live bin/pyauto-brain refactor on prompts mentioning the newly-witnessed
    repos, confirming unwitnessed_repos is empty.

Risk

Low, and lower than #268: test_witness has exactly one consumer
(_refactor.behaviour_preservation) and the change only ever adds resolvable
keys. No conductor behaviour changes for a repo that already resolved.

Note on ordering

This builds on #268 (same file, same two maps) and should merge after it.

Original Prompt

Click to expand starting prompt
# Refactor Agent witness map lacks PyAutoNerves test suite

Type: maintenance
Target: pyautobrain
Repos:
- @PyAutoBrain
Difficulty: low
Autonomy: safe
Priority: low
Status: draft
Filed: 2026-08-19 (backfilled from git)

## Finding (2026-08-19, lazy-heavy-imports RefactorDecision)

`pyauto-brain refactor` reported `[unwitnessed: pyautonerves]` and advised
"strengthen tests first", but PyAutoNerves has a real suite
(`test_autonerves`, 157 tests, verified jax-less in the JAX-default arc).
The witness map only knows autoarray/autofit.

## Task

Add PyAutoNerves (`PyAutoNerves/test_autonerves`) — and audit the other
organ/library repos — to the Refactor Agent's witness map so refactor
decisions stop flagging witnessed repos as unwitnessed.

Activity

  1. Jammy2211 commented on Aug 24, 2026

    @Jammy2211
    ContributorAuthor

    Shipped as #271 — and one gap deliberately left open

    PR #271 covers the audit as planned: PyAutoCTI and the five organ suites added,
    PyAutoReduce re-keyed, PyAutoGut's absence documented, three body-map-derived
    guards added and mutation-tested. 468 tests green, repos_sync --check clean.

    Two things worth recording here rather than burying in the PR.

    The organ spellings still split — not fixed, on purpose

    _target_sets.names_for registers both spellings of every PyAuto* repo as
    known targets (name.lower() and name.lower()[2:]). For libraries the bare
    form is canonical and the alias table joins them. For organs it does not:

    Spelling Normalises to Resolves?
    @PyAutoBrain pyautobrain ✅
    @autobrain autobrain ❌ known target, nothing filed under it
    @autoheart, @automemory, @automind, @autogut bare form ❌ same

    I fixed only @autohands, because extra_organism_targets explicitly
    declares it, so it reaches real code today. The rest are latent: no prompt in
    the Mind history uses them.

    Fixing them properly is not a one-line alias sweep — it means deciding whether
    organs key bare or prefixed, and target_signals keys the prefixed form
    (pyautobrain, pyautomind, pyautoheart, pyautobuild), so the decision has
    to hold across both maps. That is a policy question wider than this prompt, and
    widening #271 to answer it would have made a safe-autonomy maintenance PR into
    a routing change. Worth a refactor/pyautobrain/ prompt — happy to file one
    via /intake if you want it picked up.

    The deeper pattern

    Three separate repos have now hit the same defect — Nerves (#267), CTI and
    Reduce (this one) — and each was found only because someone happened to look.
    The shared cause is that repo_aliases is hand-maintained while
    KNOWN_REPOS is derived from the body map, so the two drift silently and
    the gap only shows as a wrong-but-plausible conductor message.

    Guard 2 in #271 (a witness key must be what its repo normalises to) closes the
    witness-map instance of this. It does not close the general case: an alias gap
    in a map with no coverage guard is still invisible. If a fourth instance turns
    up, the fix is probably to derive the aliases from the body map rather than add
    another per-map guard.

    Heart

    Not consulted — pyauto-heart is unreachable in this web-github session, as on
    #268. The suite stood in per the WORKFLOW.md fallback and is green, but no
    verdict was obtained, and no YELLOW was acknowledged because none was seen.


    Generated by Claude Code

  2. Jammy2211 commented on Aug 24, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    Merged as #271 (cf969f3) into main, after #268. CI green: Brain Tests
    on 2846b65. Branch proven merged — 0 unmerged commits.

    PyAutoCTI and the five organ suites (Brain, Heart, Hands, Memory, Mind) added;
    PyAutoReduce re-keyed off the prefixed spelling; PyAutoGut's absence documented
    as deliberate. Three body-map-derived guards added and mutation-tested — the
    pre-existing mis-keyed Reduce row now fails all three.

    The gap left open is filed as a prompt rather than left as a comment:
    draft/bug/pyautobrain/organ_repo_spellings_split_across_keys.md (merged in
    PyAutoMind#304). It covers the bare organ spellings — @autobrain,
    @autoheart, @automemory, @automind, @autogut — which are registered as
    known targets but normalise to keys nothing is filed under, and it asks for the
    keying decision before any edit, since target_signals keys the prefixed form
    while test_witness now keys libraries bare.

    That prompt also carries the class-level question this task raised: three repos
    have now hit the same defect because repo_aliases is hand-maintained while the
    known-target set is derived from the body map. Deriving the aliases would close
    the class instead of its fourth instance.

    Note on the intake: pyauto-brain intake classify scored this bug at high
    confidence (kept) but proposed Target: autocti — it read the prior-instance
    history in the draft as the subject — and Difficulty: too-large, inflated by
    repo names and design keywords. Corrected to pyautobrain / large on review,
    with the correction recorded in the prompt itself.

    Heart was not consulted here either; autonomy_log.md records the run as
    heart NOT EVALUATED.


    Generated by Claude Code

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