Skip to content

Deduplicate enclave credential and model-budget test fixtures - #11964

Merged
lpcox merged 2 commits into
mainfrom
copilot/fix-duplicate-code-fixtures
Nov 22, 2026
Merged

lpcox merged 2 commits into
mainfrom
copilot/fix-duplicate-code-fixtures

Conversation

@lpcox

@lpcox lpcox commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Three boundary tests repeated invocation-plan and policy fixtures; duplicated GITHUB_PAT setup and cleanup risked drift that could weaken credential-isolation coverage.

  • Fixtures: Add local, typed makeInvocationPlan(overrides) and makeAgentPolicy(overrides) factories while preserving boundary assertions.
  • Environment isolation: Centralize token handling in async-safe withGithubPat, restoring the prior value in finally. Add regression coverage for unset, empty, and populated values after success, synchronous throws, and promise rejection.
const plan = makeInvocationPlan();
const policy = makeAgentPolicy({ model: token });

@lpcox lpcox changed the title [WIP] Refactor duplicate code in boundary test fixtures Deduplicate enclave credential and model-budget test fixtures Nov 22, 2026
@lpcox
lpcox marked this pull request as ready for review November 22, 2026 22:39
Copilot AI adaptive review requested due to automatic review settings November 22, 2026 22:40

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.

🟢 Approval recommended

No active review issues are recorded for this test-only refactor that consolidates fixtures and environment cleanup.

No open issues 🎉

What changed in this PR

This test-only refactor addresses #11961 by reducing duplicated fixtures and centralizing environment cleanup in the Cloud Hypervisor enclave boundary tests.

Changes:

  • Adds typed invocation-plan and agent-policy factories with optional overrides.
  • Centralizes GITHUB_PAT handling in an async-safe helper that restores its prior value in finally.
  • Adds restoration coverage for unset, empty, and populated values after success, synchronous throws, and promise rejection while preserving existing boundary assertions.
File Description
src/​cloud-hypervisor/​host-enclave-executor.bounded-result.test.ts Deduplicates fixtures and token handling, and adds environment-restoration regression coverage.

Review effort: Balanced (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 merged commit e1ba95e into main Nov 22, 2026
47 of 50 checks passed
@lpcox
lpcox deleted the copilot/fix-duplicate-code-fixtures branch November 22, 2026 23:25
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.

[Duplicate Code] Credential and model-budget boundary test fixtures repeated three times in host-enclave-executor.bounded-result.test.ts

3 participants