Repository navigation
fix(pr-management): make the findings mod's link check read the harness stat shape - #2106
Merged
Merged
Conversation
…ss stat shape
The mod harness's `$.fs.stat` resolves `{ kind, size, mtimeMs, isLink }`, not
Node's `Stats`, so the `isSymbolicLink()` / `isFile()` probes never matched and
the curated sidecars were written through a link, or through a dangling one
that `$.fs.exists` reported as absent.
`classifyWriteTarget` judges each sidecar on `isLink` and `kind`, treats only
`ENOENT` as a missing file, and refuses on any other stat failure. The sync
and the cleanup both use it. The test mock now answers `stat` in the harness
shape, and new cases cover a dangling link, a directory and a failing stat.
Generated-by: Claude Opus 5
Claude-Session: https://claude.ai/code/session_01NyQq9UgHu7T8a8DfcfyP2M
potiuk
enabled auto-merge (squash)
November 15, 2026 13:11
2 tasks done
potiuk
added a commit
that referenced
this pull request
Nov 15, 2026
…2115) Bumps .last-sync to 18de45e and records what the specs did not yet describe: the two tools magpie-security-tools now ships (#2099), the POM DTD/entity refusal (#2105), audit-report gather --product-name (#2096), and how the findings mod decides a path is a link (#2106). Generated-by: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01NyQq9UgHu7T8a8DfcfyP2M
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<file>.curated.json,<file>.curated.keep) is not a link before writing it, because mod hooks run outside the sandbox. The check calledstat.isSymbolicLink()andstat.isFile(), which are Node'sfs.Statsmethods; the harness's$.fs.statresolves{ kind, size, mtimeMs, isLink }, so neither probe ever matched and the write always went ahead.classifyWriteTargetreads that shape: a link (to a file or to nothing) or a non-file is refused, onlyENOENTcounts as "not there yet", and any otherstatfailure refuses the write.syncCuratedStateToDiskandcleanCuratedFindingsFilesboth use it, and neither relies on$.fs.existsany more, which answers for what a path leads to.$is typedany, so nothing caught the mismatch. The default mock now answersstatin the harness shape, and new cases cover a dangling link, a directory and a failingstat.Found while re-reviewing #2080, which copied the same check; that PR got the same fix as a fixup commit.
Type of change
plugins/magpie-pr-management/hooks/)Test plan
claude plugin test plugins/magpie-pr-management: 86 passed.Linked issues
None.
Generative AI disclosure: prepared with Claude Code (Opus 5).
🤖 Generated with Claude Code