Skip to content

Split Cloud Hypervisor diagnostics into focused modules - #11954

Merged
lpcox merged 2 commits into
mainfrom
copilot/refactor-split-diagnostics-module
Nov 22, 2026
Merged

lpcox merged 2 commits into
mainfrom
copilot/refactor-split-diagnostics-module

Conversation

@lpcox

@lpcox lpcox commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

The 661-line diagnostics module mixes output capture, filesystem trust-boundary checks, artifact staging, socket readiness, and collection.

  • Module boundaries: Extract each concern into a dedicated module, keeping path-safety logic together for review.
  • Compatibility: Retain an explicit re-export facade; existing callers, public exports, and helper implementations remain unchanged.
  • Regression coverage: Add focused checks for facade identity, bounded capture, unsafe source rejection, and socket readiness.

@lpcox lpcox changed the title [WIP] Refactor diagnostics.ts into focused modules Split Cloud Hypervisor diagnostics into focused modules Nov 22, 2026
@lpcox
lpcox marked this pull request as ready for review November 22, 2026 17:24
Copilot AI adaptive review requested due to automatic review settings November 22, 2026 17:24

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

The module split rewires privileged diagnostic persistence and public enclave redaction across Cloud Hypervisor and Docker, warranting further review of their trust-boundary interactions.

No open issues 🎉

What changed in this PR

Addresses #11945 by splitting AWF’s Cloud Hypervisor diagnostics into focused modules while preserving existing callers, public exports, and helper behavior.

Changes:

  • Separates output capture, filesystem safety, artifact staging, socket readiness, and collection.
  • Retains an explicit compatibility facade in diagnostics.ts.
  • Adds regression checks for export identity, bounded capture, unsafe sources, and socket readiness.
File Description
src/​cloud-hypervisor/​diagnostics.ts Replaces implementations with explicit re-exports.
src/​cloud-hypervisor/​diagnostics.test.ts Checks facade exports and implementation identity.
src/​cloud-hypervisor/​diagnostics-staging.ts Extracts artifact staging and evidence preservation.
src/​cloud-hypervisor/​diagnostics-readiness.ts Extracts API socket readiness polling.
src/​cloud-hypervisor/​diagnostics-readiness.test.ts Covers retries, deadlines, access errors, and launcher exits.
src/​cloud-hypervisor/​diagnostics-paths.ts Groups directory validation and secure audit persistence.
src/​cloud-hypervisor/​diagnostics-collect.ts Extracts collection orchestration and its context type.
src/​cloud-hypervisor/​diagnostics-capture.ts Extracts bounded stream and file capture.
src/​cloud-hypervisor/​diagnostics-capture.test.ts Covers capture limits, unsafe sources, and read errors.

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.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 94.45% 94.49% 📈 +0.04%
Statements 93.08% 93.13% 📈 +0.05%
Functions 93.64% 93.68% 📈 +0.04%
Branches 87.38% 87.40% 📈 +0.02%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/nvx/one-shot-process.ts 84.0% → 81.5% (-2.47%) 76.8% → 74.7% (-2.11%)
src/cloud-hypervisor/diagnostics.ts 89.2% → 100.0% (+10.79%) 87.8% → 100.0% (+12.20%)
✨ New Files (5 files)
  • src/cloud-hypervisor/diagnostics-capture.ts: 95.2% lines
  • src/cloud-hypervisor/diagnostics-collect.ts: 96.0% lines
  • src/cloud-hypervisor/diagnostics-paths.ts: 92.9% lines
  • src/cloud-hypervisor/diagnostics-readiness.ts: 100.0% lines
  • src/cloud-hypervisor/diagnostics-staging.ts: 94.2% lines

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

@lpcox
lpcox merged commit 2dc91f5 into main Nov 22, 2026
48 of 50 checks passed
@lpcox
lpcox deleted the copilot/refactor-split-diagnostics-module branch November 22, 2026 17:53
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/cloud-hypervisor/diagnostics.ts into focused modules

3 participants