Skip to content

fix(windows): allow archive publication under pinned directories - #226

Open
metaphorics wants to merge 3 commits into
stabilize/canonical-receipt-toolsfrom
stabilize/windows-archive-publication
Open

metaphorics wants to merge 3 commits into
stabilize/canonical-receipt-toolsfrom
stabilize/windows-archive-publication

Conversation

@metaphorics

@metaphorics metaphorics commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Change

Publish staged archives through an existing synchronous file handle using a same-parent, non-replacing native rename. Keep FILE_SHARE_READ-only pins on directories and archives. Hold the staging file exclusively until publication so neither its contents nor its parent can change during the operation.

The native call uses a validated leaf name, null RootDirectory, aligned UTF-16 storage, and DELETE access on the staging handle. It avoids reopening the write-denying parent. Native errors become Win32 I/O errors; unsafe code remains inside the Windows cache-guard module and its existing optional capability.

Add Windows-native PR CI and a regression covering a supplementary Unicode filename, denial of a directory writer before any child exists, blocked directory relocation and archive mutation, and successful operations after releasing the guards.

Review correction

The initial directory-write-sharing approach was rejected after a valid P1 reparse-point finding. a1cf753 restored read-only sharing and introduced handle-based publication; 15b2b09 keeps the staging identity exclusive. The finding is replied to and resolved.

Validation

  • Native Windows ownership/publication job passed on 15b2b09: https://github.com/gosuda/bamTiScript/actions/runs/35512990261/job/106084169648
  • Windows MSVC all-targets check and Clippy with warnings denied passed.
  • Linux native package tests passed 62/62.
  • Formatting and diff checks passed.
  • The aggregate stack passed 4,397 library tests with four existing ignores, 58 real-process CLI E2E tests, and the isolated 27-case interpreter/JIT/AOT differential corpus.

The earlier Windows release run 35511205071 reproduced the archive sharing violation after the ownership fix passed. The corrected native job now passes. Full release-build validation has been dispatched separately and is not yet claimed successful.

Stack

Depends on #225. Ready for review after native Windows validation; not merged.

Post-Deploy Monitoring & Validation

Require Windows native boundary and the full Windows CLI release job to pass before merge. Writable handles to held directories, mutation of held archives, or relocation of held directories remain security regressions. Do not add write/delete sharing, broad retries, or skip negative tests to make a job green.

@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: fb151f2a-5841-4236-a7e2-069fa0a5c018

📥 Commits

Reviewing files that changed from the base of the PR and between 2bf90c4 and 15b2b09.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • crates/bamts-native/Cargo.toml
  • crates/bamts-native/src/cache_guard/windows.rs

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-20T13:23:11.015373Z 15b2b09 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The PR correctly fixes the Windows ERROR_SHARING_VIOLATION by conditionally allowing FILE_SHARE_WRITE for directories while maintaining read-only sharing for archives. The implementation maintains critical security invariants by never sharing DELETE permissions, preventing held directories from being renamed and held archives from being modified. The new test coverage validates both the fix and the security guarantees. The changes are minimal, focused, and ready for merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65005c8661

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/bamts-native/src/cache_guard/windows.rs Outdated
@metaphorics
metaphorics marked this pull request as draft September 20, 2026 13:06
@metaphorics
metaphorics marked this pull request as ready for review September 20, 2026 13:20
@metaphorics
metaphorics added this pull request to stack #227 September 20, 2026 21:26
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