Skip to content

Refresh script: the references inventory refuses symlinks; reclaim deletes only the writer's files; safer restore and lock; malformed boards refused - #672

Merged
bompus merged 2 commits into
mainfrom
hr-inventory-symlinks-20261121
Nov 21, 2026
Merged

bompus merged 2 commits into
mainfrom
hr-inventory-symlinks-20261121

Conversation

@bompus

@bompus bompus commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #671, from an independent review of its final head and the nine points of a second review of the same files. Each point was reproduced with a test that fails on the previous code before the fix.

Deletion and leak first:

  • Leak (critical): the references inventory skipped symlinks and any .refresh* name, so a private input there passed --check and would be copied to hosts. It now refuses any symlink, counts every file name at every depth, and leaves out only the script's own lock and work files at the top level.
  • Deletion (critical): reclaiming an abandoned transaction checked names only, then removed the folder recursively, so a marked folder holding new-0/notes.txt lost the notes. It now lstat-checks every entry (marker and plain new-<n> files only), unlinks them one by one and removes the folder with a plain rmdir; a folder holding anything else is left alone, and a new-<n> link is never followed.

Reliability:

  • Rollback: a failed rename restored the earlier file by truncating it in place and then deleted the before image. It now stages a copy beside the target and renames it over, and when a restore fails keeps the before images and names their folder in the error.
  • Stale lock: recovery compared the pid alone, so a later holder with a reused pid lost its lock. It now compares the whole record (pid and token) under the recovery lock and rechecks that the owner is gone.
  • Before images: an interrupted run left the old catalog in the temporary directory. Before images now live in one private folder per references folder, and the next write removes what a killed run left.
  • Import: --from-file rewrote a valid snapshot that was not in canonical form. An import now leaves the snapshot's bytes alone; a plain run or --fetch writes it.

Board data:

  • A live board is parsed with the same duplicate-key-refusing parser as a saved one.
  • A row with a missing model, harness, effort or date, or a present measurement that is not a number, refuses the refresh instead of becoming the text "undefined" or an absent value.
  • The spec's board task states {plantedTotal}, so the task text and the metric always name the total the snapshot holds. The generated catalog is unchanged for today's 105.

bun run check and bun test skills/hr-code-review (399 tests) pass, as does test/doc-rules.test.mjs. A fetch of the live board in a scratch copy builds and passes --check.

@bompus bompus added the author:anthropic Pull request written by a anthropic model label Nov 21, 2026

@bompus-ai-review bompus-ai-review Bot 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.

Bompus AI Review (Gemini 4 Neon): 0 finding(s).

…through a staged copy and keeps before images on failure, compares the whole stale-lock record, removes an interrupted run's before images, import leaves the snapshot alone, refuses malformed board rows and a repeated key in a fetched board, states the planted total once
@bompus bompus changed the title Panel recommendations: the references inventory refuses symlinks and counts every file name Refresh script: the references inventory refuses symlinks; reclaim deletes only the writer's files; safer restore and lock; malformed boards refused Nov 21, 2026

@bompus-ai-review bompus-ai-review Bot 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.

Bompus AI Review (Gemini 4 Neon): 0 finding(s).

Review 2: findings below high are posted only within 3 lines of a change since 3c41943.

@bompus
bompus merged commit 427c78b into main Nov 21, 2026
2 checks passed
@bompus
bompus deleted the hr-inventory-symlinks-20261121 branch November 21, 2026 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:anthropic Pull request written by a anthropic model

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant