Skip to content

Split AI-credit guard tests into four focused suites - #11837

Merged
lpcox merged 5 commits into
mainfrom
copilot/refactor-ai-credits-guard-tests
Nov 20, 2026
Merged

lpcox merged 5 commits into
mainfrom
copilot/refactor-ai-credits-guard-tests

Conversation

@lpcox

@lpcox lpcox commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

The 1,800-line AI-credit guard suite mixes tariff accounting, steering notices, promotions, and pricing resolution. Separate these concerns without changing production behavior.

  • Focused coverage: Move existing cases into tariff, notices, promotions, and pricing-fallback suites; preserve all assertions and parameterized cases.
  • State isolation: Give each suite independent guard/catalogue resets and environment/mock cleanup.
  • Integration: Update publication and maintenance selectors, regression assertions, and documented commands; regenerate the affected workflow lock without unrelated configuration changes.

@lpcox lpcox changed the title [WIP] Refactor tests for ai-credits-guard into focused suites Split AI-credit guard tests into four focused suites Nov 19, 2026
@lpcox
lpcox marked this pull request as ready for review November 19, 2026 17:00
Copilot AI adaptive review requested due to automatic review settings November 19, 2026 17:00

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

The refactor leaves pricing-source provenance pointing to a deleted test file, so the active metadata reference must be updated to a valid durable evidence source.

1 open issue
What changed in this PR

This PR refactors the monolithic AI-credit guard test suite into four focused suites while preserving production behavior and updating publication, maintenance, workflow, and documentation references.

Changes:

  • Split tariff accounting, steering notices, promotions, and pricing fallback tests into separate suites.
  • Added independent per-suite state and environment cleanup.
  • Updated selectors, regression assertions, workflow commands, documentation, and the affected workflow lock.
File Description
scripts/​model-information/​publication.test.ts Updates publication test selectors to use the four focused AI-credit guard suites.
scripts/​model-information/​maintenance-command.test.ts Updates maintenance command expectations for the focused guard test suites.
scripts/​model-information/​maintenance-command.cjs Runs the four focused API-proxy guard suites during maintenance validation.
scripts/​ci/​model-api-mapping-updater-workflow.test.ts Updates workflow regression assertions for the new test selectors.
docs/​model-catalogue-publication.md Documents the focused test command used during model catalogue publication.
docs/​adr/​0004-model-information-management.md Updates ADR validation commands to reference the focused suites.
containers/​api-proxy/​guards/​ai-credits-tariff.test.js Contains tariff accounting and budget-enforcement tests.
containers/​api-proxy/​guards/​ai-credits-promotions.test.js Contains time-bound AI-credit promotion tests.
containers/​api-proxy/​guards/​ai-credits-pricing-fallback.test.js Contains model resolution, fallback, warning, and priceability tests.
containers/​api-proxy/​guards/​ai-credits-notices.test.js Contains steering-warning and low-credit notice tests.
containers/​api-proxy/​guards/​ai-credits-guard.test.js Removes the superseded monolithic AI-credit guard test suite.
.github/​workflows/​publish-model-catalogue.yml Runs the focused guard suites during catalogue publication validation.
.github/​workflows/​model-api-mapping-updater.md Updates the scheduled maintenance workflow test command.
.github/​workflows/​model-api-mapping-updater.lock.yml Updates the compiled workflow lock with the revised validation command.

Review effort: Lite (adaptive)

@@ -0,0 +1,699 @@
const {
@lpcox

lpcox commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address review feedback

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

Copilot AI commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Updated the pricing provenance to cite the existing tariff suite. Commit: 08fcc81.

@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 19, 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-11837 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 172cc8e

@lpcox

lpcox commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot merge main and resolve conflicts, then fix the failing build verification and root unit test ci checks

lpcox and others added 2 commits November 19, 2026 23:42
…redits-guard-tests

# Conflicts:
#	.github/workflows/model-api-mapping-updater.lock.yml

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

Copilot AI commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@copilot merge main and resolve conflicts, then fix the failing build verification and root unit test ci checks

Merged main in ef9dd76 and regenerated the six stale model projections in 93947b9, addressing the common cause of the build and root-test failures. The generated catalogue check passes; both CI workflows are rerunning now.

@lpcox
lpcox merged commit f2ee5ea into main Nov 20, 2026
39 of 41 checks passed
@lpcox
lpcox deleted the copilot/refactor-ai-credits-guard-tests branch November 20, 2026 00:12
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 containers/api-proxy/guards/ai-credits-guard.test.js into focused suites

3 participants