Skip to content

fix(planning): keep gapped register ids when syncing into a gapped ledger - #11371

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-7541-41132467472-1
Oct 30, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-7541-41132467472-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #7541

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Before this fix, sync-ledger and add-round --sync-ledger renumbered a ledger whose register ids had gaps (Q1, Q2, Q500, Q501) to Q1..Qn and moved each old id into a \[Q<old>\] prefix. Records citing those ids then pointed at the wrong question. Now numbering() keeps every Q<N> id when the ledger being merged into already has a gap in its register (ledger_gapped), as the owner decided (keep ids, do not refuse). Exports with no ledger, merges into a contiguous ledger, and id sets that are not all Q<N> are numbered as before. A wider version (keep every gapped Q<N> id everywhere) failed review: export-ledger would have written ledgers that scripts/check-open-questions.sh refuses for gaps, and it broke an existing test, so the rule was narrowed.

Not verified

  • Python test suites (test_exporters.py, test_round.py, including the ledger-legacy fixtures) were not executed: the lane allows no interpreter. Left to the PR's CI.
  • The review did not re-run after the fix that narrowed the rule; the narrowed change was checked only by reading callers, tests and fixtures.
  • Deviates from one refinement criterion: it asked numbering to keep gapped Q<N> ids in every case. The change keeps them only when the ledger being merged into is gapped, because keeping them everywhere made export-ledger with no ledger write ledgers the gate refuses, and it broke an existi
  • Finding for a person: scripts/check-open-questions.sh still exits 2 on any gap in register ids, so a gapped ledger such as the reporter's (Q1-Q200, Q500-Q522) stays ungradeable by the interview gate. That was already true before this change, and changing the gate's contiguity defense is outside th
  • A ledger the old bug already renumbered (contiguous Q<N> rows carrying \[Q&lt;old&gt;\] leads) is not repaired; it keeps its leads and numbering.
  • tidy: pass 4 (ai-slop) ran only its rubric read: the lane's Bash allowlist does not include ai-slop's detect.sh. Tidy also ran before the review-driven rework, so the rework lines were not tidied.
  • ai-slop deterministic detector not run on the changed markdown (same allowlist limit); a rubric read found no tells.

Fix

  • plugins/planning/surface/exporters.py: numbering(ids, gaps=False) keeps gapped Q&lt;N&gt; ids when gaps; new ledger_gapped(text) reads whether a ledger's register row numbers are Q1..Qn; register, merged_register and export_brief pass the ledger's gap state through; contiguous rename
  • plugins/planning/surface/test_exporters.py: tests for numbering with and without gaps, for ledger_gapped, and for merged_register keeping Q1, Q2, Q300 (ledger-only), Q500 with no \[...\] lead
  • plugins/planning/surface/test_round.py: new TestGappedLedgerIds: import-ledger then sync-ledger on a Q1, Q2, Q500, Q501 ledger keeps the four ids with no \[Q prefix; add-round --sync-ledger on a gapped ledger keeps Q1, Q2, Q300, Q500 and writes the new round's Q501 as the page assigned it
  • plugins/planning/skills/interview/context/surface.md: the Ids bullet states the new numbering rule
  • .changes/planning/fix-7541-sync-ledger-keeps-gapped-ids-5c2e9a17.md: patch changelog fragment (written by hand: new-changelog-fragment refuses on a detached HEAD)

Verification

The runner ran each check from the base copy against 76ca033:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • .lane/checks/bin/check-changelog-fragments: all 12 fragments valid (run after the last edit)
  • .lane/checks/bin/check-affected: 12 passed, 6 skipped over 5 changed files (run after the last edit)
  • fresh-context review subagent over the whole diff: found the gate conflict and a now-failing existing test (test_without_a_ledger_a_gap_keeps_the_register_number_and_adds_the_id); both resolved by narrowing the rule to gapped ledgers, which leaves that test's no-ledger path unchanged
  • Grep over plugins/planning/surface/tests/fixtures: every ledger-legacy fixture has contiguous row numbers, so the new rule does not change their path
  • Read of existing TestBriefIds.gapped and three_of_four ledgers: contiguous row numbers, so they are unaffected
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41132467472

Left out: the items under Not verified.

Related

#7541

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 76ca0338a355928315564f53f4ba0285baf9dae1: 0 finding(s), 0 as inline comments.

Security review of PR #11371 at 76ca033: no security issues found.

I read the full diff and the PR context. I ran no tests and no shell.

  • Scope: The change is local to the planning plugin's interview surface. exporters.py now keeps gapped Q<N> ids in numbering when the ledger being merged into already has a gap. The rest is tests, a doc line in surface.md and a changelog fragment.
  • Trusted paths: No changed file matches a trusted-path glob. The change touches no trust control, token scope, kill switch, merge hold, workflow, plugin manifest or userConfig key.
  • Instruction surface: surface.md is a skill context file, and the edit only adds a clause to the Ids bullet. It removes or softens no standing rule, so there is no instruction-surface deletion to check.
  • Data flow: The new code reads ledger row numbers and page ids and picks a register number for each. Ids that the QN pattern does not match still take the old renumbering path. The [<id>] lead still goes through clean(). Ledger-only ids come from extra, which excludes page ids, so a kept id does not collide with a page id. There are no new commands, paths, templates or credentials.
  • Cost: The change spends nothing.

manifest fields: no manifest touched.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 76ca0338a355928315564f53f4ba0285baf9dae1: 0 finding(s), 0 as inline comments.

No findings. I read the whole diff and the PR context, and I read parse_register, ledger_register, QN and every caller of numbering, register and merged_register in plugins/planning/surface/. I did not run any tests, and neither did the PR's author. The Python suites are author-claimed as left to CI.

Closing issue #7541

  • "A test imports a ledger with ids Q1, Q2, Q500, Q501, runs sync-ledger, and finds the same four ids with no [Q…] prefix added." This is met by test_sync_ledger_keeps_imported_gapped_ids (plugins/planning/surface/test_round.py).
  • "A test runs add-round --sync-ledger on a gapped ledger and finds the existing ids kept and the new round's ids matching the page." This is met by test_add_round_sync_keeps_gapped_ids_and_writes_the_page_ids.
  • "The existing interview surface tests, including the ledger-legacy fixtures, pass." I did not run them. The PR argues they are unaffected because every ledger-legacy fixture has contiguous row numbers. That is author-claimed, and I did not check the fixtures myself.

What I checked in the code

  • ledger_gapped(None) and an empty register both give False, because [] == list(range(1, 1)). Exports with no ledger therefore number exactly as before.
  • merged_register, register and export_brief all derive gaps from the same ledger text. The pos map used for ledger-only rows in export_brief therefore agrees with the numbering register uses for page rows.
  • numbering returns kept=True only when every id matches Q<N> and either gaps is set or the ids are already Q1..Qn. A mixed set such as ["Q7", "J1"] still renumbers, and the new test covers that case.

Known gaps, already disclosed in the PR and not counted as findings

  • A contiguous ledger that the page's gapped ids are synced into is still renumbered with [Q<old>] leads. This is the deliberate narrowing, chosen because of the check-open-questions.sh contiguity gate.
  • A ledger the old bug already renumbered is not repaired.

Spend: none. The change touches no billing, schedule or model settings.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 76ca0338a355928315564f53f4ba0285baf9dae1.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit c329051 Oct 30, 2026
55 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-7541-41132467472-1 branch October 30, 2026 22:11
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(planning): interview page sync-ledger renumbers register ids and breaks cross-file references

0 participants