Skip to content

Separate NFS home staging policy from copy mechanics - #11907

Merged
lpcox merged 3 commits into
mainfrom
copilot/refactor-stage-nfs-home
Nov 21, 2026
Merged

lpcox merged 3 commits into
mainfrom
copilot/refactor-stage-nfs-home

Conversation

@lpcox

@lpcox lpcox commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

stageNfsHome combined validation, credential exclusions, descriptor-based copying, and tool staging. This split isolates the security-sensitive policy and reduces the orchestration module from 307 to 65 lines.

  • Exclusions: Isolate credential denylist construction and canonical symlink-target expansion.
  • Copy mechanics: Move fd primitives and recursive copying together; extract the buffered transfer loop to reduce nesting.
  • Tool staging: Isolate path normalization, ancestor deduplication, and parent-directory creation.
  • Compatibility: Preserve public exports, exclusion-before-open ordering, symlink handling, inode checks, permissions, and descriptor cleanup.
  • Regression coverage: Keep existing assertions unchanged; add short-write and copy-failure cleanup cases.

@lpcox lpcox changed the title [WIP] Refactor stageNfsHome into exclusion, copy, and tool-staging modules Separate NFS home staging policy from copy mechanics Nov 21, 2026
@lpcox
lpcox marked this pull request as ready for review November 21, 2026 16:38
Copilot AI adaptive review requested due to automatic review settings November 21, 2026 16:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Security-sensitive NFS staging spans multiple modules, requiring human review of credential exclusion before opening files, pinned-descriptor and symlink-race guarantees, and cleanup on root-squashed Docker/gVisor homes.

No open issues 🎉

What changed in this PR

Refactors NFS home staging into focused modules, addressing #11902 while preserving public exports and existing staging behavior.

Changes:

  • Separate credential exclusions, descriptor-based copying, and tool-path staging.
  • Reduce stageNfsHome to validation and orchestration; extract the buffered file-transfer loop.
  • Add regression coverage for short writes and descriptor cleanup after copy failures.
File Description
src/​nfs-home.ts Preserves public exports and coordinates staging.
src/​nfs-home.test.ts Adds short-write and copy-failure cleanup tests.
src/​nfs-home-tools.ts Handles tool-path selection, deduplication, and destination directories.
src/​nfs-home-exclusions.ts Builds credential exclusions and expands canonical symlink targets.
src/​nfs-home-copy.ts Houses descriptor helpers, recursive copying, and buffered transfers.

Review effort: Max (adaptive)

@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@lpcox

lpcox commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot merge main, resolve conflicts, and address review feedback

Copilot AI commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@copilot merge main, resolve conflicts, and address review feedback

Merged main cleanly as two-parent commit 6275fc5; reviewed the NFS exclusion, descriptor, symlink, and cleanup paths. There were no open inline review threads. Targeted tests and lint could not run because npm could not install dependencies under the available Node 20 runtime; the PR workflow is still in progress.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 94.41% 94.41% ➡️ +0.00%
Statements 93.04% 93.03% 📉 -0.01%
Functions 93.62% 93.58% 📉 -0.04%
Branches 87.36% 87.36% ➡️ +0.00%
📁 Per-file Coverage Changes (3 files)
File Lines (Before → After) Statements (Before → After)
src/commands/main-action-cleanup.ts 97.9% → 96.9% (-1.03%) 98.0% → 97.0% (-0.99%)
src/routing/bootstrap.ts 91.0% → 90.0% (-1.00%) 86.6% → 85.3% (-1.34%)
src/nfs-home.ts 90.6% → 91.2% (+0.59%) 85.9% → 91.9% (+5.96%)
✨ New Files (3 files)
  • src/nfs-home-copy.ts: 88.0% lines
  • src/nfs-home-exclusions.ts: 100.0% lines
  • src/nfs-home-tools.ts: 97.9% lines

Coverage comparison generated by scripts/ci/compare-coverage.ts

@lpcox
lpcox merged commit 5fffbba into main Nov 21, 2026
39 of 41 checks passed
@lpcox
lpcox deleted the copilot/refactor-stage-nfs-home branch November 21, 2026 18:10
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.

[Refactoring] Split stageNfsHome in nfs-home.ts into exclusion, copy, and tool-staging modules

3 participants