Skip to content

ci: make --check-version report a real symbol diff and gate on removals only #25

Closed

Description

@Jammy2211

Overview

wiki-currency was red on main and was fixed on 2026-08-24 by regenerating wiki/core/api_audit_baseline.json (#24, PR #23). That fix is correct but temporary, and the reason is structural.

--check-version compares a hash of the entire public API surface of autonerves, autoarray, autofit, autocti and autocti.plot against a committed baseline. The assistant documents almost none of that surface. The drift that turned the repo red was 12 additions and 2 removals across autoarray and autofit — and not one of those 14 symbols is cited anywhere in wiki/, skills/ or modes/. --scope all, which audits exactly the symbols the docs do cite, reported clean throughout.

The workflow installs the stack from the libraries' main source clones, so the clock is every merge into autofit or autoarray main that touches an __init__ export. The new baseline should be expected to rot within weeks. A check that goes red on a schedule nobody controls, for reasons that never affect the thing it gates, trains reviewers to ignore it — and this repo's PRs already opened red for over a month.

The decision (made deliberately, per the prompt)

Option 1: gate on removals; additions become informational. A symbol disappearing can break a doc; a symbol appearing cannot.

Option 2 (demote --check-version entirely and let --scope all be the only gate) was the leaner candidate and was rejected for one reason: it throws away the whole-surface tripwire, and there is a cheaper way to get the noise down that also fixes a second, worse problem.

The fact that decided it

The baseline stores only a hash and a symbol count — not the symbol names:

"autofit": { "hash": "d540d084…", "n_symbols": 160 }

So --check-version today cannot tell an addition from a removal, and a red prints exactly this:

[drift] API DRIFT vs baseline (baseline generated 2026-07-23):
  - public API surface changed: autoarray, autofit

That is undiagnosable. Reconstructing what actually moved is what cost the last session real work: worktrees had to be created at the baseline's own commits, the libraries installed from them, and the symbol sets diffed by hand.

Recording the sorted names — all 449 across the five modules, roughly 15 KB — fixes the noise and makes every future red self-diagnosing. That combination is worth more than the simplification option 2 buys.

Plan

  • Baseline gains a symbols list per module, alongside the existing hash and n_symbols.
  • --check-version computes the real diff and prints +added / -removed per module.
  • Exit 0 when every change is an addition; exit 1 on any removal. Additions still print, labelled informational.
  • Stay backward-compatible with a baseline that predates symbols: fall back to the hash comparison and say so, rather than crashing or silently passing.
  • Document the whole story in skills/ac_audit_skill_apis.md — including when regenerating the baseline is the right response and when it is papering over.

The caveat, stated plainly

This would not have prevented the red that started all this. Both removed symbols (TransformerNUFFTPyNUFFT, autofit.database) were uncited, so a removals-only gate still goes red on them. What changes is that the red now arrives with the two names attached, and the twelve irrelevant additions no longer trigger it at all. Narrowing further to removals of cited symbols is what --scope all already computes, so putting a second mechanism on that question was rejected as duplication.

Detailed implementation plan

Affected Repositories

  • autocti_assistant (primary, and the only repo changed)

Branch Survey

Repository Current Branch Dirty?
./autocti_assistant main clean

Suggested branch: feature/wiki-currency-check-version-gate

Implementation Steps

  1. autoassistant/audit_skill_apis.py → compute_baseline — record "symbols": _public_names(mod) per module. _public_names is already sorted, and _api_hash already hashes exactly that list, so the hash stays consistent with the names by construction (no second enumeration).
  2. check_version — replace the boolean hash comparison with a per-module set diff. Print + added / - removed. Gate: return 1 iff any module lost a symbol.
  3. Legacy-baseline path — a baseline with no symbols key cannot support a diff. Fall back to the current hash comparison, print that the baseline predates symbol recording, and say --write-baseline upgrades it. Never silently pass.
  4. skills/ac_audit_skill_apis.md — document the gate's meaning, the regenerate-or-investigate decision, and the --scope all division of labour.
  5. Tests — additions-only exits 0; a removal exits 1; a legacy baseline still works; the printed diff names the right symbols.

Two call sites to keep working

  • .github/workflows/wiki-currency.yml — the uniform run() helper fails the job on any non-zero exit, so the exit-code change is the whole mechanism there; no workflow edit is needed.
  • AGENTS.md "Session start" — the same command, where exit 1 means "genuine drift: recommend the pinned version or an audit". Its prose needs to match the narrowed meaning.

Key Files

  • autoassistant/audit_skill_apis.py — compute_baseline, check_version
  • wiki/core/api_audit_baseline.json — regenerated with symbols
  • skills/ac_audit_skill_apis.md — the documented story
  • AGENTS.md — session-start prose

Note

.claude/skills/*.md are symlinks into skills/ (git mode 120000), so one edit covers both surfaces.

Explicitly rejected

Pinning to a released stack. Considered and rejected on 2026-08-24: autocti's PyPI release is the pre-resurrection 2024.11.13.2, so pinning would grade today's docs against an API predating the work they describe — vacuously green, which is worse than noisily red. The workflow's own install-step comment says as much.

Original Prompt

Click to expand starting prompt

wiki-currency's --check-version gate rots on every library main merge

Type: maintenance
Target: autocti_assistant
Repos:

  • @autocti_assistant
    Difficulty: medium
    Autonomy: supervised
    Priority: normal
    Status: formalised
    Filed: 2026-08-24

--check-version compares a hash of the entire public API surface of
autonerves, autoarray, autofit, autocti and autocti.plot against a
committed baseline. The assistant documents almost none of that surface.

Measured at the time of the fix — the drift that turned the repo red was:

autoarray  120 -> 121   + InterpolatorDelaunayNN, validate   - TransformerNUFFTPyNUFFT
autofit    149 -> 159   + AbstractClipper, AbstractScaler, ApproxUpdater,
                          ClipperNone, ClipperPriorBox, DynamicUpdater,
                          FactorUpdater, NSS, ScalerNone, ScalerPriorWidth,
                          SimplerUpdater
                        - database

Not one of those 14 symbols is cited anywhere in wiki/, skills/ or
modes/.

The decision to make

Two coherent options; this task is to choose one deliberately and implement
it
, not to guess:

  1. Gate --check-version on removals only. A symbol disappearing can break
    a doc; a symbol appearing cannot. Report additions as informational, fail
    only on removals from the surface.
  2. Accept that --scope all subsumes it as a gate. Demote --check-version
    to informational, and let --scope all be the thing that can fail the
    workflow.

Whichever is chosen, the baseline-regeneration story should be documented in
skills/ac_audit_skill_apis.md so the next person hitting a red knows whether
regenerating is the right response or a papering-over.

Do not "fix" this by pinning to a released stack

Already considered and rejected on 2026-08-24.

Context worth reading first

PyAutoMind/complete/2026/08/wiki-currency-baseline-drift.md

Activity

  1. Jammy2211 commented on Aug 24, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    PR #26 merged (de4ac2d). wiki-currency and boundary both green on the PR.

    Option 1 chosen — gate on removals — and the fact that decided it against the leaner option 2 is that the baseline stored only a hash and a count, never the names. A red printed exactly public API surface changed: autoarray, autofit, so reconstructing what moved meant worktrees at the baseline's own commits and a hand diff. Recording 449 names (12 KB) kills the noise and makes every future red self-diagnosing — worth more than the simplification option 2 buys.

    • Baseline records symbols per module; _api_hash split so hash and names derive from one sorted list.
    • Additions print and pass; any removal fails and names the symbol.
    • Deliberately not narrowed to removals of cited symbols — --scope all already computes that, and two mechanisms answering one question is how they drift apart.
    • Both backward-compatibility paths gate rather than guess: a pre-ci: make --check-version report a real symbol diff and gate on removals only #25 baseline keeps the old all-or-nothing behaviour (assuming a change additive would wave a real removal through), and a module absent from the baseline entirely is reported distinctly.

    The regenerated baseline is a pure schema upgrade. Every per-module hash and every version is byte-identical to the one PR #23 wrote — so it records no API change, only the names behind the hashes already there. --check-version was already clean against today's main before regenerating, which independently confirms #23's fix is still valid.

    The caveat, restated: this would not have prevented the original red. Both removed symbols were uncited, so a removals-only gate still goes red on them. What changes is that the red now arrives with the names attached, and the twelve irrelevant additions no longer trigger it.

    One scope note. skills/ac_audit_skill_apis.md — where the task asked to document the regeneration story — did not exist. It was an unfinished clone item in PENDING.md, with AGENTS.md (×3), modes/maintainer.md and skills/ac_setup_environment.md all linking to it: five broken links. Written here from audit_skill_apis.py itself rather than adapted from the lensing sibling, registered in skills/README.md, symlinked into .claude/skills/ (mode 120000), and both PENDING.md entries ticked.

    Verified against the real CTI stack (autonerves/autoarray/autofit 2026.8.17.1 from source main, autocti 2024.11.13.2, arcticpy 2.6): all five checks pass — --check-version clean, --scope all 31/31 symbols, --lint-idioms 52 files clean, --check-provenance 0 errors, --check-citations 0 missing. Unit tests: 11/11 in test_check_version.py, and the full-suite failure set is identical to main (13 pre-existing "no installed stack" failures, none added).


    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