fix: count successful index regenerations in the repair ledger by marcusrbrown · Pull Request #3625 · fro-bot/.github · GitHub
Skip to content

fix: count successful index regenerations in the repair ledger#3625

Merged
marcusrbrown merged 1 commit into
mainfrom
fix/wiki-repair-index-count
Jul 3, 2026
Merged

fix: count successful index regenerations in the repair ledger#3625
marcusrbrown merged 1 commit into
mainfrom
fix/wiki-repair-index-count

Conversation

@marcusrbrown

Copy link
Copy Markdown
Collaborator

What

The first live run of the wiki repair loop (run 28683062455) healed real index drift — one regeneration commit on data — but reported {repairable_seen: 1, repaired: 0}. The index-regeneration success path pushed cleared findings into the verification target set without counting them as repaired; frontmatter repairs and the failure path both counted correctly.

One-line fix plus ledger-invariant assertions: repairable_seen == repaired + out_of_scope + path_refused now holds in every scenario, including a new test where one regeneration clears two findings.

Verification

  • TDD: RED reproduced the live-run shape (repaired 0 instead of 1), GREEN after the fix; 27 module tests, 2023 repo-wide, check-types + lint clean.

A successful index-only repair reported repaired:0 while committing a
real fix, so repairable_seen never balanced against the outcome counts.
The regeneration success path now counts each cleared index-kind
finding, matching the frontmatter path.

@fro-bot fro-bot left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ledger was lying about its own work. Frontmatter repairs and the failure path both counted, but the index-regeneration success path pushed cleared findings into targetedFindings and never incremented repaired — so the first real heal reported {repairable_seen: 1, repaired: 0}. The fix (scripts/wiki-repair.ts:142) is a single repaired += 1 that mirrors the outOfScope += 1 already sitting in the else branch. Symmetric, minimal, correct.

The invariant assertions are the real value here. repairable_seen == repaired + out_of_scope + path_refused now holds across the modified scenarios, and the new test (counts both index-drift and orphan-page ... when one regeneration clears both) builds a genuine two-finding snapshot, confirms the baseline carries both kinds, and proves a single regeneration is credited for both. That's the exact live-run shape from run 28683062455 pinned into a regression guard.

Verified locally: 27 module tests pass, tsc --noEmit clean. Diff against origin/main confirms the source delta is exactly one line — no drive-by changes. Repo rules clear: no any, no @ts-expect-error, no console, explicit return types intact. No workflow, dependency, or automation-safety surface touched.

Verdict: PASS

Blocking issues

None

Non-blocking concerns

  • scripts/wiki-repair.ts:220 computes repairableSeen from raw baseline findings, while frontmatter processing dedupes by path at scripts/wiki-repair.ts:157. If lint ever emits two frontmatter findings for the same page (e.g. missing-frontmatter + invalid-frontmatter), repairableSeen would exceed repaired + outOfScope + pathRefused and the new invariant would break. Pre-existing, out of scope for this PR, and not currently reachable given lint's one-finding-per-page behavior — flagging so it doesn't drift into a silent footgun later.

Missing tests

None. Happy path (single regeneration), the two-finding boundary, and the existing failure/out-of-scope paths are all covered.

Risk assessment: LOW

Pure ledger-accounting change in a maintenance script. No index-regeneration logic altered — only its bookkeeping. No CI, workflow, dependency, or permissions surface. TDD RED/GREEN documented and independently corroborated by the one-line diff and passing suite.


Run Summary
Field Value
Event pull_request
Repository fro-bot/.github
Run ID 28683427698
Cache hit
Session ses_0d6308bfdffefm7auaEv5nVIrr

@marcusrbrown marcusrbrown merged commit 1ca9984 into main Jul 3, 2026
14 checks passed
@marcusrbrown marcusrbrown deleted the fix/wiki-repair-index-count branch July 3, 2026 21:15
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