Skip to content

test(configuration): consolidate the save-rule tests - #2604

Merged
freeqaz merged 3 commits into
mainfrom
test-consolidate-35
Oct 16, 2026
Merged

freeqaz merged 3 commits into
mainfrom
test-consolidate-35

Conversation

@freeqaz

@freeqaz freeqaz commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

tests/integration/configuration-controller.test.mjs took 24 commits in five days (#2341-#2436, #2582, #2594) as the Configuration and Preset save rules grew: URL userinfo, baseUrl scheme and slashes, literal secrets in sensitive slots, provider/model selection, size limit, stale generation. Each rule family brought its own fixture, refusal loop and message helpers, and each table ran on whichever save paths its author picked: some on Configuration create only, some on create and Preset save, a few on create, update and Preset save. #2394 and #2396 were exactly that kind of gap: a rule that ran on one save path but not another.

Change

Test-only; one file.

  • One refusal check, every save path. refusedOnSave(context, values, message, { item, sentinel }) asserts the 400, INVALID_REQUEST and the exact message (and that no answer echoes the sentinel) on Configuration create, an update of an existing Configuration, and a Preset save. Every refusal table now runs through it, so each row is pinned on all three paths:
    • model provider baseUrl/api, models-not-a-list, model selection off the primary provider (incl. Dedicated Codex rows): create (+ one update row) -> create, update, Preset;
    • the 33-row baseUrl authority/slashes/numeric-host table: create only -> all three;
    • env-map userinfo, git config proxy, MCP header, Gateway key slots, sensitive slots, header-name rows: create + Preset -> all three;
    • the 15 widened credential header names: create only, prefix regex -> all three, exact message.
  • refusedAtSaveAndDeploy shares the roster and Kubernetes-settings flow (refused on create and update, an older row still reads, deploy refuses it, an update that keeps it is refused); assertRefused, acceptedOnSave, assertNothingStored, savePreset, saveFixture replace per-test copies.
  • Rows built from their JSON pointer. at("/channels/telegram/botToken", sentinel) replaces 5-15-line nested literals; the pointer also names the refused field.
  • Refusal texts (setting, userinfo, literalKey, literalHeader, literalModelKey, absoluteUrl, modelApi, gatewayPassword, approval policy texts) are defined once.
  • Dropped as exact duplicates: two rows of "Without Kubernetes Compute, ..." (models: {} and a record of model rows with a literal x-api-key); "Configuration HTTP refuses a model provider models setting that is not a list" runs both, on the same fixture and on more paths, and its "list first" row moved there too.
  • Two tests ("Configuration HTTP names a model provider baseUrl or api ..." and "... models setting that is not a list") moved from the in-memory backend without Compute to the Filesystem save fixture with a ready Compute, because Preset saves need it; their rules do not depend on Compute. The in-memory backend gained a no-op validateValues so the model-provider test can save Presets.
  • "Configuration save and Kubernetes deployment refuse caller-owned credentials ..." is left as it is, because Draft implementation: managed outbound HTTPS for dedicated Gateways #2518 edits it.

Verification

main b580f8e this PR 62adc95
Lines 5071 4036 (-20.4%)
Test names (TAP, all levels) 234 234, identical
Mutants killed (of 371) 290 290, the same set (on 176023d and on the head 62adc95)
20 runs at 2 CPUs 20/20, mean 5.67 s 20/20, mean 6.15 s (head 62adc95)

Risks

Test-only. Every refusal now also runs on paths it did not before; all hold today. A future rule added on one path only will fail these tables, which is the intent. Probing the deploy path for rows an older release stored found one gap outside this PR: deployment admits a stored model provider baseUrl that every save refuses (ftp://..., or one slash after the scheme); it is tracked separately and not changed here.

Share one refusal check across Configuration create, update and Preset save,
build slot rows from their JSON pointer, and hoist the refusal texts and the
Filesystem save fixture. Test names are unchanged.
…e the refusal check

The Dedicated Codex apiKey, allowlist and media rows now run on create, update
and Preset save. The size, stored-credential and plaintext cases use the
shared refusal check.
Keep realistic sibling fields (a proxy's enabled, a process's command and an
exec secret source) beside the rows at() builds, take options objects in
assertRefused and refusedAtSaveAndDeploy, share storedRowAgent, give the two
slot helpers one argument order, write the models-list setting paths out,
restore the zero-width space escape, and name the large-roster refusal with
literalKey. The two Configuration HTTP baseUrl and models-list tests now use
the Filesystem save fixture with a ready Compute, because Preset saves need
it; their rules do not depend on Compute.
@freeqaz
freeqaz requested a review from a team as a code owner October 16, 2026 15:27
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@freeqaz
freeqaz temporarily deployed to integration-qa-pr October 16, 2026 15:27 — with GitHub Actions Inactive
@freeqaz
freeqaz temporarily deployed to integration-qa-pr October 16, 2026 15:27 — with GitHub Actions Inactive
@freeqaz
freeqaz temporarily deployed to integration-qa-pr October 16, 2026 15:27 — with GitHub Actions Inactive
@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR shares integration-test fixtures and assertions while extending refusal cases across Configuration creation, updates, and Preset saves.

Example: Saving a model provider with baseUrl "ftp://models.example/v1".

  • Before: This case checked Configuration creation.
  • After: The same case checks creation, update, and Preset save for the exact refusal message; product behavior stays unchanged.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A coherent consolidation supported by real in-process API coverage and passing required CI; reported mutation equivalence was not independently verified.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored, test-only change exercises existing HTTP admission through an in-process integration suite; it changes no shipped runtime behavior requiring separate live proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Uneven regression coverage can let Configuration and Preset save paths enforce different rules.
Reason: The existing area contributor's consolidation reduces duplication and protects previously demonstrated save-path gaps without changing product contracts.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR usefully consolidates save-rule coverage without changing production behavior; no actionable defect was found, and required CI passed for the reviewed head.

Priority: P3
Reviewed head: 62adc95e238f97ee5b81262dc529b1a8dd257689

Before merge

None.

Findings

None.

Agent review details

How this fits together

The integration suite sends authenticated requests through the controller's real HTTP handlers into OCC validation and selected Configuration and Compute Drivers, then checks responses and stored state.

flowchart TB
Rows[Refusal cases] --> Helper[Shared save assertions]
Helper --> HTTP[Controller HTTP handlers]
HTTP --> OCC[OCC admission]
OCC --> Rules[Shared and Driver rules]
Rules --> Result[Named refusal or accepted save]
Result --> Checks[Response and storage assertions]
Loading

Technical review

Best possible solution:

Retain the shared assertions and expanded save-path coverage while preserving independent expected messages and existing deployment-admission checks.

Do we have a high-confidence way to reproduce the issue?

This PR consolidates existing regression tests rather than repairing a new product bug; source inspection confirms the added requests reach the real save handlers.

Is this the best way to solve the issue?

The consolidation is appropriate: it reuses the existing integration boundary, preserves distinct inputs and expected refusals, and adds no production testing seams.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against df01c5fe9fd0.

Provenance checked

  • Shared controller fixture and deployment setup keeps the original intent (c16d222: test(configuration): share one controller app per driver shape across configuration cases #2331 shares expensive application and authentication setup while retaining per-case Namespaces, Drivers, grants, and audit sinks.)
  • Configuration and Preset refusal coverage keeps the original intent (fix(presets): run the model provider rules when a Preset is saved #2394: Preset saves previously skipped model-provider rules; this PR preserves those assertions and applies shared refusal checks across more save paths.)
  • Roster, model-policy, and Dedicated Codex cases keeps the original intent (9a5f37d: The earlier change added missing Preset roster checks and model-policy/media restrictions; the consolidation retains their inputs, acceptance cases, and deployment checks.)
  • Credential, URL, and sensitive-slot regression tables keeps the original intent (c28bd23: Earlier mutation-driven coverage pinned missed credential and URL refusals; the rewritten tables preserve their distinct values and independent expected results.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Free Wortley: Raw commit c16d222 adds tests/integration/configuration-controller.test.mjs:67 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c16d22221a4d; files: tests/integration/configuration-controller.test.mjs)
  • Steven Lee: Raw commit a68b43e adds tests/integration/configuration-controller.test.mjs:196 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: a68b43eeec85; files: tests/integration/configuration-controller.test.mjs)

Review metrics

Metric Value Why it matters
Production versus test changes Production 0; tests +935/-1970, net -1035 lines The reduction removes repeated setup and assertions while extending existing cases across additional save paths.

Labels

Label changes:

  • add P3: This is useful test maintenance with no production behavior change or urgent user-facing failure.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is useful test maintenance with no production behavior change or urgent user-facing failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 16, 2026, 11:41 AM ET / 15:41 UTC.

@freeqaz
freeqaz merged commit 26d3bcc into main Oct 16, 2026
31 checks passed
@freeqaz
freeqaz deleted the test-consolidate-35 branch October 16, 2026 15:43
@freeqaz-openai

Copy link
Copy Markdown
Collaborator

I found one coverage distinction worth preserving and opened the small follow-up #2606 after this landed. No production change or revert is proposed.

I temporarily made the shared model-provider validation depend on a Compute driver being selected. Before this consolidation, two tests correctly caught the API returning 201 instead of 400; on 62adc95e2, all 234 tests passed with the same deliberate fault. A selected Compute with no rules is not the same fixture as no Compute selected. This was a new mutation, not a discrepancy in the 371 reported here.

The follow-up restores one no-Compute HTTP create/update check using the new helpers. It fails for the deliberate fault, and the complete file on landed main passes 235/235 with the unmodified production code.

freeqaz pushed a commit that referenced this pull request Oct 16, 2026
…ed (#2606)

Restore the no-Compute-selected model-provider save case lost in #2604.

This branch was previously deployed

1 inactive deployment
integration-qa-pr — 62adc95e Deployed Oct 16, 2026 by freeqaz via QA advisory (kubernetes) #1413
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants