fix(audit): replace arch subsection in place instead of appending duplicates #138
Loading…
Reference in a new issue
No description provided.
Delete branch "t3code/audit-id-bug"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
A fresh
weekly-audit-missingrun followed byweekly-rebuild-missingreported that almost every package "already exists in the remote bucket", even though the audit had just flagged them as missing.Root cause: the audit's Forgejo-issue update matched the existing
### <arch>subsection by its bare header (### arm64) while writing headers with a(N missing, M to rebuild)suffix.The equality test never matched, so every run appended a new block instead of replacing the old one.
Issue #63 had accumulated 38 arch subsections under
## alpine-323where 2 are expected (75 total across the alpine platforms; body ~77k lines).fetch-rebuild-packages-from-issue.Rreads the first matching block, which was the oldest snapshot.So the rebuild kept re-checking a months-old list (180 packages, mostly already built), while the genuinely-missing packages, ~1921 for alpine-323/arm64 in the freshest block, were never fed to the rebuild and the backlog grew silently.
Changes
local/weekly-missing-binaries-audit.R: match arch subsections by prefix (^### <arch>( |$)) and remove all blocks for that arch before writing one fresh block. Accumulation now self-heals on every run.local/dedupe-audit-issue.R(new): one-off cleanup that collapses each## platformsection to the freshest block per arch across the three OS-family issues. SupportsDRY_RUN=1.local/fetch-rebuild-packages-from-issue.R: prefer the audit's freshly-written RDS (overwritten each run, immune to issue-body drift), falling back to issue parsing when absent.Validation
Simulated the dedupe logic against the live #63 body: 75 → 8 arch subsections, body 77k → 28k lines, and the kept alpine-323/arm64 block correctly resolves to
GARCH.X (3.0)(the stale first block held2.0).Follow-ups (not in this PR)
alpine-321is audited but has no row in the rebuild matrix (7,230 missing, never rebuilt).alpine-324section exists in the issue but is in neither matrix.The weekly audit matched the existing "### <arch>" issue subsection by its bare header ("### arm64") while writing headers with a " (N missing, M to rebuild)" suffix. The equality test never matched, so every run appended a fresh block instead of replacing the old one. Issue bodies accumulated dozens of stale subsections (alpine-323 had 38 where 2 are expected), and fetch-rebuild-packages-from-issue.R read the *first* block, feeding the rebuild a months-old list while the genuinely-missing packages were never rebuilt. - Match arch subsections by prefix and drop all blocks for the arch before writing one fresh block, so accumulation self-heals each run. - Add local/dedupe-audit-issue.R to collapse the already-accumulated duplicates in the existing issues (keeps the freshest block per arch). - Make fetch-rebuild-packages-from-issue.R prefer the audit's freshly-written RDS, falling back to issue parsing when it is absent.