Skip to content

Refactor NVX cleanup registry into focused modules - #11748

Merged
lpcox merged 5 commits into
mainfrom
copilot/refactor-split-cleanup-registry
Nov 17, 2026
Merged

lpcox merged 5 commits into
mainfrom
copilot/refactor-split-cleanup-registry

Conversation

@lpcox

@lpcox lpcox commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

The cleanup registry mixed durable state management with security-sensitive process, network, and account checks. This refactor separates those concerns while preserving cleanup behavior and public APIs.

  • Helper modules: Extract process-identity capture/comparison, network-state checks, and pending-account validation.
  • Handle operations: Replace nested closures with focused private methods and a shared record-update method.
  • Regression coverage: Add direct helper tests and durable handle-update checks.

@lpcox lpcox changed the title [WIP] Refactor cleanup registry into focused modules Refactor NVX cleanup registry into focused modules Nov 17, 2026
@lpcox
lpcox marked this pull request as ready for review November 17, 2026 18:49
Copilot AI adaptive review requested due to automatic review settings November 17, 2026 18:49

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.

🟡 Changes recommended

Success-path tests are missing for the five capture operations, leaving interface/namespace routing, custom ipPath forwarding, and persisted paths and stage flags unverified.

1 open issue
What changed in this PR

Refactors NVX cleanup internals so the durable registry coordinates state while focused modules handle process identity, network checks, and account validation.

Changes:

  • Extract helper functions into three dedicated modules.
  • Replace nested handle operations with private methods and a shared record-update method.
  • Add direct helper tests and durable-update regression coverage.
File Description
src/​nvx/​cleanup-registry.ts Delegates helper checks and simplifies handle operations.
src/​nvx/​cleanup-registry.test.ts Adds persistence and process-stage assertions.
src/​nvx/​cleanup-process-identity.ts Extracts process identity capture and comparison.
src/​nvx/​cleanup-process-identity.test.ts Tests identity parsing, capture, and matching.
src/​nvx/​cleanup-network-state.ts Extracts interface checks and forwarding-rule construction.
src/​nvx/​cleanup-network-state.test.ts Tests network checks and rule arguments.
src/​nvx/​cleanup-account-validation.ts Extracts pending-account validation and path-existence checks.
src/​nvx/​cleanup-account-validation.test.ts Tests account validation and filesystem error handling.

Review effort: Max (adaptive)

Comment on lines +177 to +180
captureNetworkPlan: (plan) => this.captureNetworkPlan(record, layout, plan),
captureNetworkResource: (resource) => this.captureNetworkResource(record, resource, ipPath),
captureRunDirectory: () => this.captureRunDirectory(record, layout),
captureCgroup: () => this.captureCgroup(record, layout),

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.

Added the requested durable capture coverage in 9c076f8. Test execution remains blocked by package-feed DNS resolution.

@lpcox

lpcox commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address review feedback

Copilot AI commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Added the durable success-path coverage in commit 9c076f8. The targeted Jest run could not start because dependencies are not installed and package-feed DNS resolution failed.

@lpcox

lpcox commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot merge main and resolve conflicts then make sure all review feedback has been addressed

…t-cleanup-registry

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

@copilot merge main and resolve conflicts then make sure all review feedback has been addressed

Merged main in 301ef2a without conflicts and verified the review coverage in 9c076f8. Tests remain blocked by package-feed DNS resolution.

@github-actions

github-actions Bot commented Nov 17, 2026 •

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.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 94.18% 94.35% 📈 +0.17%
Statements 92.80% 92.96% 📈 +0.16%
Functions 93.37% 93.57% 📈 +0.20%
Branches 87.16% 87.34% 📈 +0.18%
📁 Per-file Coverage Changes (3 files)
File Lines (Before → After) Statements (Before → After)
src/commands/main-action-cleanup.ts 96.9% → 97.9% (+1.03%) 97.0% → 98.0% (+0.99%)
src/nvx/cleanup-record.ts 84.1% → 86.9% (+2.80%) 81.2% → 83.8% (+2.57%)
src/nvx/cleanup-registry.ts 54.1% → 68.4% (+14.33%) 55.7% → 68.8% (+13.13%)
✨ New Files (3 files)
  • src/nvx/cleanup-account-validation.ts: 100.0% lines
  • src/nvx/cleanup-network-state.ts: 100.0% lines
  • src/nvx/cleanup-process-identity.ts: 100.0% lines

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

@lpcox
lpcox merged commit dcd21c8 into main Nov 17, 2026
42 of 44 checks passed
@lpcox
lpcox deleted the copilot/refactor-split-cleanup-registry branch November 17, 2026 23:06
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 src/nvx/cleanup-registry.ts into focused modules

3 participants