Skip to content

fix: release archive lock on Windows - #1769

Open
kikeprzn wants to merge 2 commits into
Fission-AI:mainfrom
kikeprzn:fix-windows-archive-lock
Open

fix: release archive lock on Windows#1769
kikeprzn wants to merge 2 commits into
Fission-AI:mainfrom
kikeprzn:fix-windows-archive-lock

Conversation

@kikeprzn

@kikeprzn kikeprzn commented Sep 2, 2026

Copy link
Copy Markdown

Summary

Fixes openspec archive leaving .openspec-archive.lock behind on Windows after a successful archive.

On the affected Windows/NTFS setup, Node reports different dev values for the same lock file depending on how it is statted:

  • FileHandle.stat({ bigint: true }).dev reports the real volume id
  • fs.lstat(path, { bigint: true }).dev reports 0n

The cleanup check required both dev and ino to match, so it never unlinked the lock file even though the archive had completed successfully. The next archive was then blocked by the stale claim.

This change treats dev: 0n as an unavailable device id while still requiring the inode and lock-file contents to match before deleting the claim.

Testing

  • pnpm exec vitest run test/core/archive.test.ts
  • pnpm run lint
  • pnpm run build
  • node bin/openspec.js validate fix-windows-archive-claim-release --strict

Notes

Generated with Codex using GPT-5.6.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue on Windows where archive operations could leave behind a temporary claim file after completing successfully.
    • Archive cleanup now safely handles platforms that do not report a device identifier, while protecting claims that changed during processing.
  • Tests
    • Added regression coverage for successful claim cleanup on Windows-like filesystem behavior.

@kikeprzn
kikeprzn requested a review from a team as a code owner September 2, 2026 23:45
@kikeprzn
kikeprzn requested review from alfred-openspec and removed request for a team September 2, 2026 23:45
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 78527d41-7f9d-4652-8f89-d6985163061b

📥 Commits

Reviewing files that changed from the base of the PR and between fbd4160 and 9451350.

📒 Files selected for processing (6)
  • openspec/changes/fix-windows-archive-claim-release/.openspec.yaml
  • openspec/changes/fix-windows-archive-claim-release/proposal.md
  • openspec/changes/fix-windows-archive-claim-release/specs/cli-archive/spec.md
  • openspec/changes/fix-windows-archive-claim-release/tasks.md
  • src/core/archive.ts
  • test/core/archive.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The archive claim release logic now tolerates dev: 0n path statistics while preserving inode, content, and repeated-stat checks. OpenSpec documentation and regression coverage describe and verify the behavior.

Changes

Archive claim release

Layer / File(s) Summary
Archive claim cleanup contract
openspec/changes/fix-windows-archive-claim-release/*
The archive specification defines claim creation, failure handling, successful claim cleanup, and protection against changed claims. The proposal and task list record the implementation plan.
Cross-platform claim identity check
src/core/archive.ts
isSameArchiveClaimFile matches inode values when device values match or either value is 0n. releaseArchiveClaim uses the helper for ownership and repeated-stat checks.
Windows claim release regression
test/core/archive.test.ts
The test simulates dev: 0n for the claim path and verifies that successful archive execution removes the claim.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🔵 Low · up to 94513

This change fixes stale archive locks on Windows while retaining inode, nonce, and repeated identity checks before cleanup. A bounded risk remains because device identity is optional on the affected platform, so concurrent lock replacement behavior is not fully demonstrated; merge is reasonable with explicit owner awareness and follow-up coverage.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (4 skipped: 4 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: releasing the archive lock on Windows.
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: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (4 skipped: 4 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

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