Skip to content

NRA replaces the debt ratchet: delete refactor-audit submodule, pinned_audit and ratchet entry points - #3634

Merged
trissim merged 6 commits into
mainfrom
refactor/nra-replaces-ratchet
Oct 30, 2026
Merged

trissim merged 6 commits into
mainfrom
refactor/nra-replaces-ratchet

Conversation

@trissim

@trissim trissim commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

1 commit, 42 files, +168/-231. Deleted: the refactor-audit submodule (.gitmodules, gitlink), src/agent_comms/pinned_audit.py (22 lines), PinnedAudit (15 lines), MainTree.pinned, tools/debt_ratchet.py and tools/client_ratchet.py. Every "ratchet" entry point in agent-comms is gone. The audit is now NominalRefactorAdvisor's package, nominal_refactor_advisor.audit, and its comparison is audit.gate.

Paired NRA branch: feat/absorb-refactor-audit (fork A) moves refactor-audit's scripts/audit and references/patterns into NRA. This PR can't go green until that branch holds nominal_refactor_advisor.audit. The lock currently resolves the branch to c17cb4ab, which is NRA main.

Consumers, before → after

Consumer Before After
phase_evidence.py from agent_comms.pinned_audit import SKILL, ForeignAbsenceProbe, GodFunction, ParsedModule, audit from nominal_refactor_advisor import audit + audit.findings/audit.source_measures names
AuditPatternPresent grep in the submodule tree at the commit main's gitlink pins (MainTree.pinned) regex count over the installed nominal_refactor_advisor.audit sources; MainTree.pinned deleted (no other caller)
Slop.catalog() (hook, unit instructions) files(skills)/refactor-audit/references/patterns files("nominal_refactor_advisor.audit")/patterns
tools/agent_comms_project.py PinnedAudit extracts the pinned submodule into every revision tree deleted; each revision's reader imports the installed NRA audit
tools/stored_formats.py, repairs.py, module_layers.py agent_comms.pinned_audit.audit, audit.ratchet.* nominal_refactor_advisor.audit, audit.gate.*
tests (guards/test_agent_comms_gate.py renamed, store_lock_graph, boundary_decoding, carry, phase_evidence) pinned_audit NRA package; the archive-has-no-submodule assert is deleted (no submodule left)
CI debt-ratchet.yml, debt-ratchet-cache.yml, pip install -e src/agent_comms/skills/refactor-audit, submodules: recursive nra-gate.yml, nra-gate-cache.yml; installs drop the submodule; job nra-gate keeps check names debt-src/debt-tools for the merge-queue ruleset
Rules and skill text submodule worktree ritual (storage-and-cleanup), "pinned refactor-audit catalog" ritual deleted; NRA catalog path

Dependency

nominal-refactor-advisor moves from the dev extra to runtime dependencies, because phase_evidence and slop run in the installed runtime and the wheel no longer carries the audit. It sits beside the existing metaclass-registry @ git+...@main runtime git dependency (allow-direct-references). uv.lock and stack/uv.lock are relocked, and stack resolves tree-sitter 0.26.0 → 0.25.2 to meet NRA's tree-sitter-python<0.26. The native pin is unchanged: NativeBuildInputs.require_pinned passes.

Required before merge

  1. Fork A's NRA branch lands nominal_refactor_advisor.audit (with gate, patterns/); then relock.
  2. Last commit: flip @feat/absorb-refactor-audit → @main in pyproject.toml once NRA merges, and relock uv.lock + stack/uv.lock.
  3. Paired Toad change: .github/workflows/ci.yml:49 runs .core-ratchet/tools/client_ratchet.py from Core main, so it has to call tools/nra_client_gate.py the moment this merges.

Proof (no local pytest, gate or mypy run)

  • git grep -n "pinned_audit\|skills/refactor-audit\|debt_ratchet\|refactor-audit" -- src tools tests .github → empty.
  • Import probe, run against NRA main plus refactor-audit's package copied under the fixed names into a scratch dir: agent_comms, phase_evidence, slop, plan_phases, unit_instructions, agent_comms_hooks.skill, stored_formats, module_layers, agent_comms_project and repairs all import. Slop.catalog() reads 52 pattern IDs. AuditPatternPresent(^class StoreLockCalls\() → True, and a missing class → False. The real proof is this PR's CI once fork A's branch holds the package.

Not folded in: #3630 (ClientSources/--ci-inputs). Those classes exist only on #3566, which merges first.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RnH6dS2Kmg1WxNnAc78YHA

…d_audit and ratchet entries

agent-comms measured itself with refactor-audit, vendored as a git submodule under
src/agent_comms/skills/refactor-audit and loaded by sys.path surgery in
agent_comms.pinned_audit. NominalRefactorAdvisor now owns that audit package
(nominal_refactor_advisor.audit, comparison in audit.gate), so agent-comms imports it
as an ordinary runtime dependency and the submodule, its loader and every
"ratchet" entry point are deleted.

- .gitmodules, the submodule gitlink and src/agent_comms/pinned_audit.py: deleted.
- tools/agent_comms_project.py: PinnedAudit and AUDIT deleted; RevisionReader places
  only the revision's reader, which imports the installed NRA audit.
- phase_evidence.AuditPatternPresent counts in the installed NRA audit package;
  the now-unused MainTree.pinned is deleted.
- Slop.catalog() reads nominal_refactor_advisor.audit/patterns; the session hook and
  unit instructions read it through that one owner.
- tools/debt_ratchet.py -> tools/nra_gate.py, tools/client_ratchet.py ->
  tools/nra_client_gate.py, debt-ratchet{,-cache}.yml -> nra-gate{,-cache}.yml;
  check names debt-src/debt-tools kept for the merge-queue ruleset.
- nominal-refactor-advisor moves from the dev extra to runtime dependencies,
  pinned to feat/absorb-refactor-audit until that branch merges; uv.lock and
  stack/uv.lock relocked (native pin unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dS2Kmg1WxNnAc78YHA
Copilot AI balanced review requested due to automatic review settings October 30, 2026 03:21

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

trissim and others added 4 commits October 30, 2026 00:10
skill.py: keep main's paper1-first deal order and this branch's NRA catalog index wording.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dS2Kmg1WxNnAc78YHA
NRA #155 deletes the audit's ParsedModule(path, text, tree, name); both users build
ast_tools.ParsedModule and read .module/.file_path/.source. MainTree.module() goes
through modules(), so one construction site parses and caches every blob.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dS2Kmg1WxNnAc78YHA
nominal-refactor-advisor c17cb4ab -> b542c5a2 (main with nominal_refactor_advisor.audit),
tree-sitter 0.25.2 -> 0.26.0, in uv.lock and stack/uv.lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dS2Kmg1WxNnAc78YHA
Dropping submodules: recursive left four actions/checkout steps with a bare with:,
which GitHub rejects as an invalid workflow, so neither ci.yml nor nra-gate.yml ran
on this PR at any head.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dS2Kmg1WxNnAc78YHA
@github-actions

Copy link
Copy Markdown

debt-tools at eb54778, every finding:

::warning file=tools/agent_comms_project.py::LintFindings +1 (warns, never blocks)
::warning file=tools/repairs.py::LintFindings +1 (warns, never blocks)
::warning file=tools/stored_formats.py::LintFindings +1 (warns, never blocks)
grew TypeErrors:tools/stored_formats.py +4
found LintFindings:tools/agent_comms_project.py at tools/agent_comms_project.py:8 (I001 [*] Import block is un-sorted or un-formatted)
found LintFindings:tools/repairs.py at tools/repairs.py:14 (I001 [*] Import block is un-sorted or un-formatted)
found LintFindings:tools/stored_formats.py at tools/stored_formats.py:10 (I001 [*] Import block is un-sorted or un-formatted)
found TypeErrors:tools/stored_formats.py at tools/stored_formats.py:32 (Argument 1 to "declared" of "StoredFormat" has incompatible type "Any | list[JsonValue] | dict[str, JsonValue] | str | int | float | None"; expected "int"  [arg-type]) tools/stored_formats.py:32 (Generator has incompatible item type "list[JsonValue] | dict[str, JsonValue] | str | int | float | Any | None"; expected "str"  [misc]) tools/stored_formats.py:34 (Argument 2 to "declared" of "StoredFormat" has incompatible type "list[JsonValue] | dict[str, JsonValue] | str | int | float | None"; expected "dict[object, object]"  [arg-type]) tools/stored_formats.py:34 (Argument 3 to "declared" of "StoredFormat" has incompatible type "list[JsonValue] | dict[str, JsonValue] | str | int | float | None"; expected "Iterable[str]"  [arg-type])

@trissim
trissim enabled auto-merge October 30, 2026 05:07
… by type

Under pinned_audit the audit module was Any to mypy, so StoredFormat.declared took a
JsonValue version and dict[str, JsonValue] fields unchecked; NRA's typed package shows
the 4 errors. The match is the decoder of that JSON, so its patterns narrow: int() version,
list() required filtered to str keys, fields as dict[object, object]. Import blocks that
swapped pinned_audit for nominal_refactor_advisor are sorted (I001).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dS2Kmg1WxNnAc78YHA
@trissim
trissim added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit ed0eb81 Oct 30, 2026
9 checks passed
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