Skip to content

Refactor enclave smoke debug collection into focused modules - #11951

Merged
lpcox merged 6 commits into
mainfrom
copilot/refactor-collect-enclave-smoke-debug
Nov 22, 2026
Merged

lpcox merged 6 commits into
mainfrom
copilot/refactor-collect-enclave-smoke-debug

Conversation

@lpcox

@lpcox lpcox commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

The 1,398-line collector mixed evidence projection, filesystem safety, credential redaction, publication, and CLI handling on a security-sensitive CI path. This refactor separates those responsibilities without changing collection policy or public interfaces.

  • Module boundaries

    • Extract projections, safe filesystem access, redaction, and publication into focused modules.
    • Share constants and validation helpers without circular dependencies.
  • Compatibility and deployment

    • Preserve the CLI entry path and all 31 exports.
    • Install sibling modules with root ownership, 0700 directory permissions, and 0600 file permissions.
    • Update workflow setup, compiled locks, and the pinned installation example.
  • Regression coverage

    • Split the companion suite by responsibility, preserving existing cases and assertions.
    • Add focused coverage for facade identity, isolated loading, UTF-8 rejection, and redaction depth bounds.

@lpcox lpcox changed the title [WIP] Refactor collect-enclave-smoke-debug.cjs into focused modules Refactor enclave smoke debug collection 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.

🟡 Changes recommended

Duplicated fixture setup in projections.test.ts and publication.test.ts risks inconsistent updates when the journal or diagnostics schema changes.

1 open issue
What changed in this PR

Refactors AWF’s security-sensitive enclave smoke diagnostics collector into focused modules, addressing #11944 while preserving the existing entrypoint and public interfaces.

Changes:

  • Separate evidence projections, filesystem validation, credential redaction, publication, and CLI handling.
  • Split regression tests by responsibility and add focused compatibility and boundary checks.
  • Update workflows and deployment documentation to install sibling modules with protected ownership and permissions.
File Description
scripts/​ci/​test-cloud-hypervisor-enclave-workflow.test.ts Verify module triggers and test selection.
scripts/​ci/​smoke-enclave-workflow.test.ts Assert protected module installation.
scripts/​ci/​smoke-enclave-copilot-workflow.test.ts Assert protected Copilot smoke installation.
scripts/​ci/​enclave-agent-regression.test.ts Check collector deployment permissions.
scripts/​ci/​collect-enclave-smoke-debug/​safe-fs.test.ts Cover filesystem safety and UTF-8 rejection.
scripts/​ci/​collect-enclave-smoke-debug/​safe-fs.cjs Isolate safe filesystem access and decoding.
scripts/​ci/​collect-enclave-smoke-debug/​redaction.test.ts Cover credential redaction and recursion limits.
scripts/​ci/​collect-enclave-smoke-debug/​redaction.cjs Isolate credential sanitization and auth-field validation.
scripts/​ci/​collect-enclave-smoke-debug/​publication.test.ts Preserve collection and publication regression coverage.
scripts/​ci/​collect-enclave-smoke-debug/​publication.cjs Isolate collection, retention, and failure publication.
scripts/​ci/​collect-enclave-smoke-debug/​projections.test.ts Preserve session and runtime projection coverage.
scripts/​ci/​collect-enclave-smoke-debug/​projections.cjs Isolate closed evidence projections and schemas.
scripts/​ci/​collect-enclave-smoke-debug/​common.cjs Share bounds, constants, and validation helpers.
scripts/​ci/​collect-enclave-smoke-debug/​collector.test-utils.ts Share fixtures and isolated deployment setup.
scripts/​ci/​collect-enclave-smoke-debug/​cli.test.ts Preserve dispatcher and identity-binding coverage.
docs/​cloud-hypervisor-foundation.md Document pinned entrypoint and sibling-module installation.
.github/​workflows/​test-cloud-hypervisor-enclaves.yml Include module changes and split test suites.
.github/​workflows/​smoke-enclave-cloud-hypervisor.md Install protected sibling modules.
.github/​workflows/​smoke-enclave-cloud-hypervisor.lock.yml Synchronize compiled installation steps and metadata.
.github/​workflows/​smoke-enclave-cloud-hypervisor-copilot.md Install modules for the Copilot smoke workflow.
.github/​workflows/​smoke-enclave-cloud-hypervisor-copilot.lock.yml Synchronize compiled Copilot installation steps and metadata.
.github/​workflows/​daily-agent-runtime-regression.yml Deploy modules alongside the protected collector.

Review effort: Max (adaptive)

Comment on lines +27 to +28
journal.record({ invocationId, entryId: 'script', state: 'cleanup-pending' });
if (terminal) journal.record({ invocationId, entryId: 'script', state: 'terminal', outcome: 'executor-failure' });
@lpcox

lpcox commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address review feedback

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

Copilot AI commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Moved the shared fixture setup, journal helper, and common diagnostics envelope into collector.test-utils.ts and updated both suites to use it. Commit: 04587a9.

@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

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-11951 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 09d3bf1

Copilot AI commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@copilot address all review feedback and fix these failing ci checks https://github.com/github/gh-aw-firewall/actions/runs/45050687683/job/137295165746?pr=11951 and https://github.com/github/gh-aw-fi...

Fixed the unused uid/gid binding and the CI-only stream-size test scope reuse in commit 6520151. The targeted suite could not run locally because the sandbox dependency install failed with incomplete packages, but the fix reproduces the exact EEXIST root cause and is whitespace/secret checked.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 94.45% 94.59% 📈 +0.14%
Statements 93.08% 93.25% 📈 +0.17%
Functions 93.64% 93.74% 📈 +0.10%
Branches 87.37% 87.61% 📈 +0.24%
📁 Per-file Coverage Changes (5 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/bounded-execution/finite-schema.ts 81.7% → 82.2% (+0.49%) 78.9% → 79.4% (+0.44%)
src/bounded-execution/strict-json-parser.ts 83.5% → 88.3% (+4.85%) 68.8% → 77.3% (+8.44%)
src/cloud-hypervisor/diagnostics.ts 89.2% → 100.0% (+10.79%) 87.8% → 100.0% (+12.20%)
src/bounded-execution/finite-disclosure.ts 54.2% → 93.8% (+39.59%) 51.8% → 94.6% (+42.86%)
✨ 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 8164fd5 into main Nov 22, 2026
44 of 46 checks passed
@lpcox
lpcox deleted the copilot/refactor-collect-enclave-smoke-debug branch November 22, 2026 18:24
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 scripts/ci/collect-enclave-smoke-debug.cjs into focused modules

4 participants