You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cleanup: collapse duplicated reporting, and make two guards sound
Quality pass over the preceding six commits. No behaviour change except where
noted; two of these close gaps the first versions left open.
**Two guards were unsound.**
`scanForSymlinkedComponent` tested `Type() == 0` for "a regular file where a
directory belongs", which is a blocklist of one: a FIFO, socket or device node
at `.claude` came back clean and doctor printed nothing, while os.Root and every
hook install fail on it. Now an allowlist of the traversable shapes
(`traversableComponent`), which is what the .entire scan's doc argues for at
length — an allowlist a rejected type can enter by setting an extra bit is not
an allowlist. fs.ModeIrregular stays tolerated: a Windows junction arrives as
bare ModeIrregular and a cloud placeholder directory as ModeDir|ModeIrregular,
and both are traversable.
`RemoveDir` refused an `AllProtectedDirs()` entry, which is a blocklist and
misses the case that matters: that list holds `.opencode` and `.github/hooks`
but not `.opencode/plugins`, `.pi/extensions` or `.github`, so a future agent
whose config sits one level below its root still got
`RemoveAll(".opencode/plugins")` — the user's other plugins. Stated positively
instead: the directory has to be one Entire named. Every agent root and shared
intermediate fails that; pi's `.pi/extensions/entire` passes because Entire
created it.
**Duplication.**
`printCappedList` replaces four inline copies of the same capped-list loop in
doctor.go (three added by 761b87d, one pre-existing in
checkEntireDirSymlinks), so the off-by-one truncation contract is written once.
`testutil.SkipWithoutSymlinks` replaces six copies of the Windows symlink skip
in three different wordings. `agentHelpSkillTemplate` is back to one switch on
agentName, so a fourth agent cannot get a path with no body. The three
worktreeFileName tests are one table, which also makes them agree visibly with
worktreedir's four cases one layer down — and writing it out caught a wrong
expectation of mine: a RELATIVE in-repo link never reaches the resolve, because
os.Root follows it, so the fast path returns the original name.
**Waste and dead state.**
readCapped asked `utf8.ValidString` over the whole 6KB prefix up to four times
to find a rune boundary; `utf8.RuneStart` at the cut answers the same question
by looking at one byte (2081ns -> 2ns measured) and removes the whole-prefix
fallback with it. A new test pins the floor, since a file of nothing but
continuation bytes must still keep its content.
The `vercelJSONName == ""` back-fill was dead — with either value the branch it
guarded was skipped — so the name is now the sole presence signal and
`loadVercelConfigIfPresent` says out loud that no vercel.json means nothing to
read. worktreeFileName's third not-exist exit is gone: after a successful
EvalSymlinks the re-stat can only fail on a race, which is not a state worth
reading as absent. The guard test's helper returns the sorted slice both callers
built by hand, dropping `sortedPackageDirs`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 01M1GW5MCC47ZC1M29PTWJZ9Z2
0 commit comments