Skip to content

Fix: Skip a chmod-based archive test on Windows - #1887

Merged
mrsabath merged 1 commit into
rossoctl:mainfrom
michaljacovi:windows-ci-skip-chmod
Nov 16, 2026
Merged

mrsabath merged 1 commit into
rossoctl:mainfrom
michaljacovi:windows-ci-skip-chmod

Conversation

@michaljacovi

@michaljacovi michaljacovi commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1520.

Problem

main's go-ci-windows job has been red since #1876 and #1878 merged
minutes apart. Neither PR's CI saw the other. The run on ea6bed14 fails
one test:

--- FAIL: TestWriteSession_FailedEraseKeepsNumbering
    import_test.go:367: LastSeq = 0, want the 4 reserved

The test makes the erase fail with os.Chmod(a.data, 0o500), a read-only
data directory. Windows ignores that permission, so the erase succeeds.

What changed

One line: the test now skips on Windows through skipWithoutUnixModes, like
the 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 of ea6bed14:
go test ./session/archive/... passes, with this test skipped. On
ea6bed14 itself, the same run fails only this test, with the error above.
go vet ./session/archive/... passes with GOOS windows, linux and darwin.

Assisted-By: Claude (Anthropic AI) [email protected]

Summary by CodeRabbit

  • Tests
    • A file-cleanup test now skips on platforms that do not support Unix file modes.

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]>
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The archive test now calls skipWithoutUnixModes before setting up the read-only-directory failure scenario.

Changes: Archive test platform guard

Layer / File(s) Summary
Guard the failure scenario
core/session/archive/import_test.go
The test skips on platforms without Unix file modes before setting up the read-only-directory failure scenario.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other · Severity of issue fixed: Low

Possibly related PRs

Suggested reviewers: huang195, rubambiza

Merge Risk: Minimal · up to c5cbf

This change only skips one archive test on Windows, where the Unix permission bits it relies on are ignored. It has no production impact and is safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Fix: Skip a chmod-based archive test on Windows" matches the main change. The PR makes TestWriteSession_FailedEraseKeepsNumbering skip on Windows through skipWithoutUnixModes, because Windo…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Fix: Skip a chmod-based archive test on Windows" matches the main change. The PR makes TestWriteSession_FailedEraseKeepsNumbering skip on Windows through skipWithoutUnixModes, because Windows ignores the Unix permission bits the test uses to force an erase failure. The title names the affected test type, the platform, and the action. It is specific and does not use vague terms. The change is a single one-line addition in core/session/archive/import_test.go, and the title describes it accurately.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 83a5e366-c06a-4dd3-8784-e71d00e69d37
Commits

Reviewing files that changed from the base of the PR and between ea6bed1 and c5cbfb9.

Files selected for processing: 1

  • core/session/archive/import_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 mrsabath added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 16, 2026

@mrsabath mrsabath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mrsabath
mrsabath merged commit 0ffd667 into rossoctl:main Nov 16, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants