fix(config): batch Windows migration ACL copies - #229
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 12 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe migration flow now exclusively prepares backup and candidate files, applies verified Windows security descriptors to both in one batch, writes synchronized contents through pre-opened handles, and performs phase-aware cleanup. Tests cover candidate creation collisions and batched ACL verification. ChangesWindows migration ACL flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant MigrationCommand
participant FileSystem
participant WindowsACL
participant PowerShell
MigrationCommand->>FileSystem: Create backup and candidate exclusively
MigrationCommand->>WindowsACL: Copy descriptors to both targets
WindowsACL->>PowerShell: Run batch ACL operation
PowerShell-->>WindowsACL: Verify each target descriptor
WindowsACL-->>MigrationCommand: Return verification result
MigrationCommand->>FileSystem: Write synchronized backup and candidate contents
Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
8100d2c to
46b9c71
Compare
46b9c71 to
acdfc64
Compare
acdfc64 to
3390463
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/cli/migrate-config.ts (1)
477-503: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winHandle descriptor-phase failures explicitly
MigrationFilePreparationError.phase === "descriptor"still falls through to the generic backup-creation message, which obscures the ACL verification failure. Add a dedicated branch here so Windows descriptor errors report the right cause.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/cli/migrate-config.ts` around lines 477 - 503, Update the catch handling around MigrationFilePreparationError to add a dedicated branch for phase === "descriptor" before the generic restoredError path. Restore the held source through restoreAndEscalate and report a migrationWriteError describing the Windows descriptor or ACL verification failure, while preserving the existing candidate-phase and generic error behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/windows-config-acl.test.ts`:
- Line 21: Add a test covering NUL-byte rejection in the batch path of
copyWindowsConfigSecurityDescriptors, verifying that a NUL in either target is
rejected while preserving the existing happy-path coverage.
---
Outside diff comments:
In `@src/cli/migrate-config.ts`:
- Around line 477-503: Update the catch handling around
MigrationFilePreparationError to add a dedicated branch for phase ===
"descriptor" before the generic restoredError path. Restore the held source
through restoreAndEscalate and report a migrationWriteError describing the
Windows descriptor or ACL verification failure, while preserving the existing
candidate-phase and generic error behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 07069b31-b0a0-4069-9486-f3f9ce1b7d1e
📒 Files selected for processing (5)
src/cli/migrate-config.tssrc/cli/windows-config-acl.tstests/config-migration.test.tstests/windows-config-acl.test.tstests/windows-config-migration-acl-failure.test.ts
|
Addressed CodeRabbit's review in
Focused ACL/migration tests, typecheck, lint, and diff validation pass; full current-head CI is rerunning. |
|
Final validation on current head 775c114: all Linux, macOS, Windows Node 20/22/24, quality, Verify, package, and CodeRabbit status checks are green. Windows OAuth/Console target timings are 3.339s (Node 20), 2.785s (Node 22), and 3.308s (Node 24); no retries were used. CodeRabbit's newest status reports Review rate limited, so it did not produce a fresh review on the final two commits. Its prior review is approved, its only thread is resolved, and an independent local read-only review found no blockers. I also attempted a local Claude Code review, but its noninteractive process produced no response and was stopped rather than treated as approval. This documents the rate-limit exception before merge. |
Summary
Fixes #228. Windows Console native-OAuth onboarding could exceed Vitest's five-second boundary while the guarded config-replacement transaction serially launched three trusted PowerShell ACL operations.
The fix keeps private transaction-directory creation separate, exclusively creates empty backup and candidate files, then copies and verifies the held source descriptor onto both in one bounded trusted helper invocation. No configuration content is written until that verification succeeds.
Security impact
shell: false, trusted System32 PowerShell, minimal environment, bounded request data, and fail-closed ACL handling remain intact.Validation
npm testnpm run test:corenpm run test:coveragenpm run lintnpm run typechecknpm run buildnpm run smoke:clinpm run check:packnpm run test:packageScope
Removed the temporary timing diagnostic now that the production boundary is fixed. No timeout increases, retries, skips, or weakened Windows containment are included.