Repository navigation
Fix: Skip a chmod-based archive test on Windows - #1887
Conversation
main's go-ci-windows job fails since rossoctl#1876 and rossoctl#1878 merged: this test, from rossoctl#1876, makes the erase fail with chmod 0500 on the data directory. Windows ignores that permission, so the erase succeeds and LastSeq is 0 instead of 4. Neither PR's CI saw the other: rossoctl#1876 ran before the Windows job existed, and rossoctl#1878 ran before the test existed. It now skips on Windows through skipWithoutUnixModes, like the other archive tests that rely on Unix permission bits. Part of rossoctl#1520. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Michal Jacovi <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
clawgenti
left a comment
There was a problem hiding this comment.
Summary
The fix works. go-ci-windows failed on ea6bed14 and passes at this head, so the skip removes the one failure in the stated target case. The skip is the right granularity. The test's only way to make the erase fail is a read-only data dir, which Windows does not enforce, so there is nothing left to run there. Skipping the whole test matches prior_test.go:181, segment_test.go:82 and meta_test.go:57. I checked the other chmod-based archive tests for the same Windows problem. TestDelete_AFailedRename… and TestClear_AFailedRename… go through blockRenames, which has a Windows path that holds a segment open. The ones that read modes (segment_test.go, meta_test.go) already skip. Nothing else in ./session/archive/... depends on Unix modes without a guard, and bootstrap and cost/ledger have no chmod-based tests. I left one non-blocking suggestion inline: the same test also fails when run as root on Linux.
Author: michaljacovi (CONTRIBUTOR, repo permission admin, so maintainer)
Areas reviewed: Go tests (core/session/archive)
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing, including Go CI (Windows build, archive and ledger). Go CI (core peerproc, macOS) was still pending.
Verified locally (Linux, Go 1.26): go vet ./session/archive/ passes with GOOS linux and windows.
| // A failed write whose erase also fails keeps its numbering: the partial copy is still on disk, so | ||
| // a live event must not number into its seqs. | ||
| func TestWriteSession_FailedEraseKeepsNumbering(t *testing.T) { | ||
| skipWithoutUnixModes(t) // the erase fails through a read-only data dir, which Windows ignores |
There was a problem hiding this comment.
suggestion (non-blocking, not a regression): Root has the same blind spot as Windows. Run as root on Linux, the erase goes through the 0500 data dir and the test fails the same way. I reproduced it on this head (uid 0, go test ./session/archive/ -count=1): import_test.go:368: LastSeq = 0, want the 4 reserved, and it is the only failure in the package. The sibling case in prior_test.go:181-184 uses both guards:
skipWithoutUnixModes(t) // the erase fails through a read-only data dir, which Windows ignores
if os.Geteuid() == 0 {
t.Skip("root writes through a read-only directory")
}CI runs as a non-root user, so this does not affect any job today. It only matters for container or devcontainer runs as root.
mrsabath
left a comment
There was a problem hiding this comment.
Summary
One line, correct, and it unblocks main. I verified the diagnosis rather than
taking the description's word for it, and every claim holds.
The skip is legitimate, not a masked bug. The test's whole premise is
os.Chmod(a.data, 0o500) making the erase fail, then asserting the numbering
survives. On Windows Chmod only toggles the read-only attribute and a
directory ignores it, so the erase succeeds, the reserved seqs are released,
and LastSeq is 0 — the want the 4 reserved assertion fails on a premise
that cannot hold there, not on the behaviour under test. That is exactly what
skipWithoutUnixModes is for, and it is now the fifth archive test using it,
so this is consistent with the existing pattern rather than a new exception.
main really is red. The ci.yaml runs on main confirm it:
ea6bed147 failure 16:26Z <- current main
1300d93c2 success 16:19Z
3da79aa10 failure 15:43Z
676557d35 success 12:10Z
The root cause is as described. #1876 and #1878 merged minutes apart and
neither PR's CI saw the other, so the combination was never tested — a gap no
amount of per-PR review catches. I confirmed the shape independently: PR #1888
branches from the same base ea6bed14, does not touch import_test.go at all,
and still fails this one test; this PR touches only import_test.go and its
Windows job is green. So the failure is inherited from main, and this is the
fix for it.
Worth noting for #1520's benefit: the go-ci-windows job earned its place
within hours of landing. It caught a real cross-PR interaction that every other
job missed.
Priority: this should merge ahead of #1888, which stays red until it does
(the author documents that dependency in #1888's description — correctly).
No findings. Nothing inline.
Areas reviewed: Go (core/session/archive tests)
Commits: 1, signed-off, conventional prefix, 64-char subject
CI status: all checks passing, including Go CI (Windows build, archive and ledger)
Verification note: this sandbox could not git fetch, so I read the test at
c5cbfb9 through the GitHub API rather than from a possibly-stale local clone.
Part of #1520.
Problem
main's
go-ci-windowsjob has been red since #1876 and #1878 mergedminutes apart. Neither PR's CI saw the other. The run on
ea6bed14failsone test:
The test makes the erase fail with
os.Chmod(a.data, 0o500), a read-onlydata directory. Windows ignores that permission, so the erase succeeds.
What changed
One line: the test now skips on Windows through
skipWithoutUnixModes, likethe other archive tests that rely on Unix permission bits.
How it was tested
On Windows 11 (amd64, Go 1.27.0,
GOWORK=off), on top ofea6bed14:go test ./session/archive/...passes, with this test skipped. Onea6bed14itself, the same run fails only this test, with the error above.go vet ./session/archive/...passes withGOOSwindows, linux and darwin.Assisted-By: Claude (Anthropic AI) [email protected]
Summary by CodeRabbit