Skip to content

Fix overlay ctime stat cache#20

Merged
elithrar merged 3 commits into
mainfrom
opencode/fix-stat-cache-ctime
Jun 8, 2026
Merged

Fix overlay ctime stat cache#20
elithrar merged 3 commits into
mainfrom
opencode/fix-stat-cache-ctime

Conversation

@elithrar

@elithrar elithrar commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Supersedes #17 by preserving Git's ctime stat-cache guard for writable overlay files and hardening the related overlay rename paths.

The original issue was that overlay metadata let caller-controlled mtime stand in for ctime, so Git could miss dirty files after same-size rewrites that restored mtime. This keeps ctime independent and makes rename/reconcile behavior preserve that invariant instead of creating stale overlay state.

  • Preserve separate overlay ctime for writes, truncates, mtime updates, and renames.
  • Keep tracked rename metadata coherent across chained renames, HEAD changes, and stale overlay reconciliation.
  • Preserve untracked create renames, while treating create/symlink renames over existing base files as local modifications.
  • Reject unsupported file/directory rename combinations instead of creating overlay entries that shadow the wrong base type.
  • Clean up stale rename whiteouts and directory tombstones safely, including wildcard and UTF-8 path cases.

Tests: go build ./cmd/artifact-fs; go vet ./...; go test ./...; AFS_RUN_E2E_TESTS=1 go test -run '^TestE2EGitStatusDetectsSameSizeRewriteAfterMtimeRestore$|^TestE2EGitCommitTrackedRename$|^TestE2E$' -v .

@elithrar elithrar self-assigned this Jun 8, 2026
@elithrar elithrar merged commit 083e55e into main Jun 8, 2026
5 checks passed
@elithrar elithrar deleted the opencode/fix-stat-cache-ctime branch June 8, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant