Three defects on the contributor head, none of them present on the base:
- test/docsync's TestEngdocsAndRootMarkdownLinks fails: the generated
divergence-ledger doc links http-client-backend.md, an architecture
spec this repository does not carry. Name it in a code span instead,
in ledgerDocPreamble, and regenerate the doc (-update-ledger-doc).
- TestCAFileHygieneRefusesGroupWritableFile fails under umask 022:
os.WriteFile's 0o660 passes through the umask, so the file lands 0640,
is never group-writable, and TransportForFile accepts it. Chmod it
explicitly. Its acceptance twin had the same gap on its file (only the
explicitly chmodded directory reached the user-private-group
exception), so chmod that file too: a mutant that drops the exception
for files alone passed the old test under umask 022 and fails the new
one.
- That acceptance twin calls the unix-only isUserPrivateGroup from
ca_test.go, which carries no build constraint, so the package's tests
do not compile for GOOS=windows. Move it, otherwise verbatim, into
ca_permissions_unix_test.go beside the other isUserPrivateGroup tests.
Review fixes (iteration 1):
- Encode dispatched through nine case arms of op/shape conjunctions
(cyclomatic 24). Switch on an (op, shape) struct key instead, and move
the getIssue and search-bridge arms into encodeGetIssue and
encodeSearch. The arms are disjoint, so dispatch and every error string
are unchanged. Cyclomatic 24 -> 10.
- EventStream.Next kept four accumulators and the per-field switch in
one loop (cognitive 27). Gather the accumulators into sseEvent and
fold each field line, per-event cap included, in applyField. Next
cognitive 27 -> 12; applyField is 11/11.
- The CA hygiene walk joined a relative symlink target onto the textual
containing directory, so with a/link -> ../b/c and b/c/x -> ../y it
resolved a/y where the kernel opens b/y: a valid CA was refused, or a
hygienic file at a/y was checked and read instead. readLinkTarget joins
onto the directory's EvalSymlinks path, taken after that directory's
own ancestors passed the hop-by-hop check. The regression test plants
a decoy at a/y; a lexical-join mutant reads it and fails.
- SaveTarget wrote a relative CAFile that every later LoadTarget
refuses. Both now go through checkCAFileAbsolute, so SaveTarget refuses
first, with LoadTarget's own message, and writes nothing.
- Document the cached transport TransportFor and TransportForFile return
as shared and read-only.
Review fixes (iteration 2):
- The walk still dropped a ".." inside a symlink target textually:
filepath.Join cleans a relative target, and an absolute target's
ancestors come from filepath.Dir, while the kernel takes that ".."
from wherever the component before it really leads. Both reviews
rated the relative leaf as a wrong-file read, and it is one: with
x/d -> ../e/s, x/L -> d/../y read a decoy at x/y where the kernel
opens e/y. The other three shapes are hygiene bypasses: an absolute
leaf target x/d/../y, and an ancestor link to d/../dir or x/d/../dir
with the CA at x/L/y, each read a file in a world-writable e that the
walk never checked. readLinkTarget now refuses a target with a ".."
after any other component, relative or absolute; a leading run of
".." is still taken from the directory's physical path. The test pins
all four shapes behind a control that refuses e/y named directly, and
a table pins hasInteriorDotDot's boundary. Mutants that drop the
refusal, limit it to relative targets, refuse every "..", or count
"." as a component each fail.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>