Skip to content

tests: add e2e routing wiring test harness - #4249

Merged
Pratham-Mishra04 merged 1 commit into
devfrom
06-10-tests_add_e2e_routing_wiring_test_harness
Jun 11, 2026
Merged

tests: add e2e routing wiring test harness#4249
Pratham-Mishra04 merged 1 commit into
devfrom
06-10-tests_add_e2e_routing_wiring_test_harness

Conversation

@Pratham-Mishra04

@Pratham-Mishra04 Pratham-Mishra04 commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Briefly explain the purpose of this PR and the problem it solves.

Changes

  • What was changed and why
  • Any notable design decisions or trade-offs

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

Describe the steps to validate this change. Include commands and expected outcomes.

# Core/Transports
go version
go test ./...

# UI
cd ui
pnpm i || npm i
pnpm test || npm test
pnpm build || npm run build

If adding new configs or environment variables, document them here.

Screenshots/Recordings

If UI changes, add before/after screenshots or short clips.

Breaking changes

  • Yes
  • No

If yes, describe impact and migration instructions.

Related issues

Link related issues and discussions. Example: Closes #123

Security considerations

Note any security implications (auth, secrets, PII, sandboxing, etc.).

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

Summary by CodeRabbit

  • Documentation
    • Added a Model Catalog Wiring Tests guide and clarified API management runner behavior for merging extra Postman collections; new default: no extra collections loaded in the default run.
  • Tests
    • Introduced a generated routing-wiring Postman collection, a shared collection-builder for polling/cleanup/assertions, and improved e2e runners (seed parsing, env forwarding, timeouts, CI-friendly reporting and per-scenario cleanup).

@Pratham-Mishra04
Pratham-Mishra04 requested a review from a team as a code owner June 10, 2026 13:43
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d22c587c-d1bb-49a1-826e-f1885a5a6987

📥 Commits

Reviewing files that changed from the base of the PR and between d742bbb and fe0a474.

📒 Files selected for processing (6)
  • tests/e2e/api/README.md
  • tests/e2e/api/collections/bifrost-routing-wiring.postman_collection.json
  • tests/e2e/api/runners/build-routing-wiring.mjs
  • tests/e2e/api/runners/individual/run-newman-routing-wiring-tests.sh
  • tests/e2e/api/runners/lib/collection-builder.mjs
  • tests/e2e/api/runners/run-newman-api-tests.sh

📝 Walkthrough

Walkthrough

Adds Postman-based E2E wiring tests for model-catalog routing: a reusable collection-builder library, a scenario-matrix generator that emits routing collections, a Newman runner that executes them with seed-env handling and polling, and README updates documenting scenarios and regeneration.

Changes

E2E Routing Wiring Test Infrastructure

Layer / File(s) Summary
Collection builder library
tests/e2e/api/runners/lib/collection-builder.mjs
Provides Postman pre-request/test generators (run_id, credential checks), polling with exponential backoff, mutation/cleanup assertions, URL/request/item assembly, and collection build/write helpers.
Routing wiring test generator
tests/e2e/api/runners/build-routing-wiring.mjs
CLI script defining provider/key catalogs, helper generators, a comprehensive SCENARIOS matrix, and expandScenario() to produce sequenced Postman items (setup, routing requests, log polling/assertions, distribution checks, deterministic cleanup).
Newman test execution runner
tests/e2e/api/runners/individual/run-newman-routing-wiring-tests.sh
Bash v4+ runner that verifies prerequisites, parses seed env (no source), forwards selected env-vars to Newman, increases timeouts for polling, supports CI reporter behavior, captures Newman exit code, and writes HTML reports.
Documentation and help text
tests/e2e/api/README.md, tests/e2e/api/runners/run-newman-api-tests.sh
Adds "Model Catalog Wiring Tests" guide covering wiring contract, scenarios, run instructions, prerequisites, naming/run-id rules, async polling/backoff, per-scenario cleanup, regeneration workflow; rewords --extra-collection help text to describe externally maintained API e2e coverage.

Sequence Diagram(s)

sequenceDiagram
  participant Generator as build-routing-wiring.mjs
  participant CollectionBuilder as collection-builder.mjs
  participant Newman as run-newman-routing-wiring-tests.sh
  participant Bifrost as Bifrost API
  Generator->>CollectionBuilder: buildCollection(expandedScenarios, extraVariables)
  CollectionBuilder->>Generator: writes Postman collection JSON
  Newman->>Bifrost: executes collection requests (mutations, routing, reads)
  Bifrost->>Newman: responses and async logs
  Newman->>Newman: pollTest / exponential backoff for eventual consistency
  Newman->>Reports: generates HTML reports and exit code
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • akshaydeo
  • danpiths

Poem

🐰 I hopped through collections bright and sparking,
Scenarios stitched, no detail lacking,
I poll and wait with patient cheer,
Newman runs and reports appear,
Cleanup clears the garden — tests embarking.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is a blank template with no author-provided content, missing all required sections including summary, changes, type of change selection, and implementation details. Fill in all template sections: provide a summary of the routing wiring test harness purpose, detail the changes made (collection generator, runner scripts, builder module), select the change type (Chore/CI), mark affected areas, and describe testing instructions.
Linked Issues check ⚠️ Warning The linked issue #123 is about File API support for providers, which is completely unrelated to the routing wiring test harness implementation shown in the file changes. Remove the unrelated Files API issue #123 or link the correct issues related to routing/wiring tests, governance model catalog, or the specific features being tested by this harness.
Docstring Coverage ⚠️ Warning Docstring coverage is 79.17% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding an e2e routing wiring test harness, which aligns with the file changes (test scripts, generators, and runner modifications).
Out of Scope Changes check ✅ Passed All changes are in-scope: a new test harness with generator scripts, collection builders, runner scripts, and documentation updates for e2e routing wiring tests—no unrelated features or logic changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 06-10-tests_add_e2e_routing_wiring_test_harness

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

Safe to merge after fixing the assertRoutingTrail polling loop — on a trail-assertion failure the test hangs for 900 s instead of retrying a bounded number of times and proceeding to cleanup.

The assertRoutingTrail step 2 omits its pollPrerequest, leaving __cur_poll_attempt stale. Every retry reads the same counter value so the loop never exits cleanly. The two scenarios using assertRoutingTrail will hang rather than fail cleanly on any assertion error. The rest of the collection and runner are correct.

tests/e2e/api/runners/build-routing-wiring.mjs — the assertRoutingTrail step 2 item construction at line ~485.

Important Files Changed

Filename Overview
tests/e2e/api/runners/build-routing-wiring.mjs Generates the routing/wiring Postman collection; assertRoutingTrail step 2 omits pollPrerequest, causing an infinite retry loop when the trail assertion fails.
tests/e2e/api/runners/lib/collection-builder.mjs Shared Postman collection builder; polling, cleanup, and mutation helpers look correct. The pollTest/pollPrerequest contract relies on __cur_poll_attempt being set by pollPrerequest before each request.
tests/e2e/api/runners/individual/run-newman-routing-wiring-tests.sh Runner script for the routing wiring collection; seed env parsing silently skips malformed lines (already flagged in previous review).
tests/e2e/api/README.md New 'Model Catalog Wiring Tests' section references three file paths that don't exist in the repo; the files actually added by this PR have no documentation entry.
tests/e2e/api/runners/run-newman-api-tests.sh Minor documentation wording change (enterprise-only to extra); no functional impact.
tests/e2e/api/collections/bifrost-routing-wiring.postman_collection.json Machine-generated Postman collection output; inherits the assertRoutingTrail polling bug from the generator.

Reviews (3): Last reviewed commit: "tests: add e2e routing wiring test harne..." | Re-trigger Greptile

Comment on lines +119 to +122
ci_normalized="$(printf '%s' "${CI:-}" | tr '[:upper:]' '[:lower:]')"
if [ "$ci_normalized" = "1" ] || [ "$ci_normalized" = "true" ]; then
cmd+=(--reporter-cli-no-failures false)
fi

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.

P2 --reporter-cli-no-failures false is a no-op, comment is misleading

The comment says "In CI keep going past failures so every scenario's cleanup folder runs", but --reporter-cli-no-failures false is Newman's default behavior — it only controls whether the CLI reporter prints failure output, not whether Newman bails on failures. Newman only stops on failures if --bail is passed, which this script never does. Cleanup folders already run unconditionally because there is no --bail flag in the command.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

const arr = (ids) => "[" + (ids || []).map((kid) => jsKeyName(sid, kid)).join(", ") + "]";
const lines = [`var seen = (pm.collectionVariables.get('dist_${sid}') || '').split(',').filter(Boolean);`];
if (step.expectKeyIds) {
lines.push(`${"var"} mustServe = ${arr(step.expectKeyIds)};`);

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.

P2 ${"var"} in template literal is an unusual pattern

`${"var"} mustServe = …` embeds the string literal "var" via template interpolation, producing the same output as writing var directly. All adjacent lines emit var declarations as regular string content without this workaround; consider aligning the style.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +69 to +85
while IFS= read -r line || [ -n "$line" ]; do
[[ "$line" =~ ^[[:space:]]*# ]] && continue
[[ -z "${line//[[:space:]]/}" ]] && continue
[[ "$line" != *=* ]] && continue
key="${line%%=*}"
value="${line#*=}"
[[ ! "$key" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]] && continue
# Unwrap outer single quotes written by the seed writer and undo its
# '\''-escape; also tolerate plain double-quoted values.
if [[ "$value" == \'*\' ]]; then
value="${value:1:${#value}-2}"
value="${value//\'\"\'\"\'/\'}"
elif [[ "$value" == \"*\" ]]; then
value="${value:1:${#value}-2}"
fi
seed_env_values["$key"]="$value"
done < "$SEED_ENV_PATH"

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.

P2 Seed env parsing silently drops errors that the sibling runner treats as fatal

The new runner silently skips malformed seed-env lines (missing =, invalid variable name) with continue, while run-newman-api-tests.sh prints a red error and exits for the same conditions. A misconfigured seed file will cause the routing tests to silently ignore credentials and fail later with an opaque upstream error rather than a clear diagnostic message.

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/e2e/api/README.md (1)

29-188: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Documentation mismatch: README documents the wrong test suite.

The README section "Model Catalog Wiring Tests" (lines 29-36, 134-188) documents files that don't exist in this PR:

  • bifrost-model-catalog-wiring.postman_collection.json (documented)
  • build-model-catalog-wiring-collection.py (documented, Python)
  • run-newman-model-catalog-wiring-tests.sh (documented)

But this PR implements different files:

  • bifrost-routing-wiring.postman_collection.json (actual)
  • build-routing-wiring.mjs (actual, JavaScript)
  • run-newman-routing-wiring-tests.sh (actual)

The test focus is also different:

  • Model Catalog Wiring (documented): Tests that management-API mutations (add/update/delete provider and key) propagate into the catalog read endpoints (/api/models, /api/models/details).
  • Routing Wiring (implemented): Tests that governance × model-catalog rules produce correct routing decisions (VK allow/deny, key gating, aliases, distribution, cross-provider load balancing) verified via extra_fields.routing_info and stored logs.

The section title, file names, and scenario descriptions need to be updated to match the actual "Routing Wiring Tests" implemented in this PR.

Suggested fix

Replace the section title and file references:

-### Model Catalog Wiring Tests
+### Routing Wiring Tests

 | Path | Description |
 |------|-------------|
-| `collections/bifrost-model-catalog-wiring.postman_collection.json` | Generated collection asserting that management-API mutations (add/update/delete provider and key, toggle key, alias) propagate into the model catalog read endpoints. **Generated — do not hand-edit.** |
-| `runners/build-model-catalog-wiring-collection.py` | Generator for the collection above. Holds the scenario spec (the source of truth) and emits the JSON. |
-| `runners/individual/run-newman-model-catalog-wiring-tests.sh` | Script to run the model-catalog wiring collection. |
+| `collections/bifrost-routing-wiring.postman_collection.json` | Generated collection asserting that governance × model-catalog routing rules produce correct routing decisions (VK gates, key gating, aliases, distribution, cross-provider LB). **Generated — do not hand-edit.** |
+| `runners/build-routing-wiring.mjs` | Generator for the collection above. Holds the scenario spec (the source of truth) and emits the JSON. |
+| `runners/individual/run-newman-routing-wiring-tests.sh` | Script to run the routing wiring collection. |

And update the detailed section starting at line 134:

-### Model Catalog Wiring Tests
+### Routing Wiring Tests

-These tests cover the path **HTTP mutation → config write → server-side catalog
-hook → read endpoint**: the wiring that keeps the model catalog (`/api/models`,
-`/api/models/details`) in sync with provider and key changes made through the
-management API. Each scenario stands up an isolated custom provider backed by a
-real upstream (OpenAI), drives a sequence of mutations, and asserts the catalog
-reflects each one.
+These tests cover **governance × model-catalog routing decisions**: verifying
+that virtual key gates, key-level model restrictions, aliases, and cross-provider
+load balancing produce correct routing outcomes. Each scenario stands up an
+isolated custom provider backed by a real upstream (OpenAI), configures keys
+and optional virtual keys, drives inference requests, and asserts the route via
+`extra_fields.routing_info` (synchronous) and stored logs (asynchronous).

-What it covers (one scenario per contract):
+What it covers (30+ scenarios):

-- **Add provider + key** — a gated key surfaces its allowed model.
-- **Update key model set** — changing a key's allow-list re-gates the catalog.
-- **Disable / re-enable key** — a disabled key drops its models; re-enabling restores them.
-- **Delete one of two keys** — only the deleted key's models drop; the sibling's survive.
-- **Delete provider** — the provider and its models disappear from the catalog.
-- **Alias resolution** — an inference call via a key alias routes to the underlying model.
+- **VK allow/deny** — VK allowed_models whitelist/blacklist controls routing.
+- **VK key restriction** — VK key_ids pins routing to specific keys.
+- **Key gating** — key-level models/blacklist filters routing candidates.
+- **Distribution** — weighted key selection across multiple keys.
+- **Cross-provider LB** — governance load-balances bare models across VK providers.
+- **Aliases** — key aliases resolve to underlying model IDs.
+- **Standard providers** — Azure/Bedrock/Vertex routing (serial-only, global providers).

 Run locally (from this directory):

 ```bash
-./runners/individual/run-newman-model-catalog-wiring-tests.sh
+./runners/individual/run-newman-routing-wiring-tests.sh

And update lines 177-182:

```diff
-- To change or extend the scenarios, edit
-  `runners/build-model-catalog-wiring-collection.py` and re-run it, then commit
-  both the script and the regenerated collection:
+- To change or extend the scenarios, edit `runners/build-routing-wiring.mjs`
+  and re-run it, then commit both the script and the regenerated collection:

   ```bash
-  python3 runners/build-model-catalog-wiring-collection.py
+  node runners/build-routing-wiring.mjs
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @tests/e2e/api/README.md around lines 29 - 188, Docs currently describe
"Model Catalog Wiring Tests" and reference
bifrost-model-catalog-wiring.postman_collection.json,
build-model-catalog-wiring-collection.py, and
run-newman-model-catalog-wiring-tests.sh, but the PR implements routing wiring
assets; update the README to rename the section/title to "Routing Wiring Tests",
replace file references with bifrost-routing-wiring.postman_collection.json,
runners/build-routing-wiring.mjs, and
runners/individual/run-newman-routing-wiring-tests.sh, and revise the scenario
description to reflect routing-focused assertions (extra_fields.routing_info,
stored logs, VK allow/deny, key gating, aliases, distribution, cross-provider
load balancing) and change the example invocation from "python3
runners/build-model-catalog-wiring-collection.py" to "node
runners/build-routing-wiring.mjs".


</details>

<!-- cr-comment:v1:87198bd0f0bf19df3849ecf0 -->

</blockquote></details>

</blockquote></details>
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@tests/e2e/api/README.md`:
- Around line 29-188: Docs currently describe "Model Catalog Wiring Tests" and
reference bifrost-model-catalog-wiring.postman_collection.json,
build-model-catalog-wiring-collection.py, and
run-newman-model-catalog-wiring-tests.sh, but the PR implements routing wiring
assets; update the README to rename the section/title to "Routing Wiring Tests",
replace file references with bifrost-routing-wiring.postman_collection.json,
runners/build-routing-wiring.mjs, and
runners/individual/run-newman-routing-wiring-tests.sh, and revise the scenario
description to reflect routing-focused assertions (extra_fields.routing_info,
stored logs, VK allow/deny, key gating, aliases, distribution, cross-provider
load balancing) and change the example invocation from "python3
runners/build-model-catalog-wiring-collection.py" to "node
runners/build-routing-wiring.mjs".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c84be7bb-162f-4276-a232-bce8c76bca41

📥 Commits

Reviewing files that changed from the base of the PR and between 726422e and 0e59caa.

📒 Files selected for processing (6)
  • tests/e2e/api/README.md
  • tests/e2e/api/collections/bifrost-routing-wiring.postman_collection.json
  • tests/e2e/api/runners/build-routing-wiring.mjs
  • tests/e2e/api/runners/individual/run-newman-routing-wiring-tests.sh
  • tests/e2e/api/runners/lib/collection-builder.mjs
  • tests/e2e/api/runners/run-newman-api-tests.sh

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/e2e/api/README.md`:
- Around line 152-182: README contains incorrect script and regeneration
instructions: replace the local run command reference
"run-newman-model-catalog-wiring-tests.sh" with
"run-newman-routing-wiring-tests.sh", change the regeneration script reference
"build-model-catalog-wiring-collection.py" to "build-routing-wiring.mjs", and
update the regeneration command from "python3 ... .py" to "node ... .mjs" so the
README uses the Node CLI and correct script names.

In `@tests/e2e/api/runners/build-routing-wiring.mjs`:
- Around line 249-254: The template literal `${"var"}` in function
distAssertLines is redundant; replace the expression when pushing the
declaration for mustServe so it uses a plain keyword (e.g., change
lines.push(`${"var"} mustServe = ${arr(step.expectKeyIds)};` to lines.push("var
mustServe = " + arr(step.expectKeyIds) + ";")) so the code reads the same as the
later `var only = ...` line and avoids the needless template expression; update
the lines.push call that builds `mustServe` accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f69226a7-25f5-4511-958f-654f901815a4

📥 Commits

Reviewing files that changed from the base of the PR and between 0e59caa and d742bbb.

📒 Files selected for processing (6)
  • tests/e2e/api/README.md
  • tests/e2e/api/collections/bifrost-routing-wiring.postman_collection.json
  • tests/e2e/api/runners/build-routing-wiring.mjs
  • tests/e2e/api/runners/individual/run-newman-routing-wiring-tests.sh
  • tests/e2e/api/runners/lib/collection-builder.mjs
  • tests/e2e/api/runners/run-newman-api-tests.sh

Comment thread tests/e2e/api/README.md
Comment on lines +152 to +182
Run locally (from this directory):

```bash
./runners/individual/run-newman-model-catalog-wiring-tests.sh
```

Requirements:

- Bifrost running at `{{base_url}}` (default `http://localhost:8080`), ideally
against a clean config store so no pre-existing `catwiring-*` providers linger.
- `openai_api_key` available — either in the seed env file (`generated/seed.env`
or `$BIFROST_E2E_SEED_ENV`) or exported in the shell. Scenarios whose required
credentials are missing skip themselves rather than fail.

Notes:

- Every resource is named `catwiring-openai-<scenario>-<run-id>`, where the
run-id is built once per run from `e2e_seed_prefix` plus a timestamp nonce, so
parallel runs never collide and a failed run leaves no blocking state.
- The catalog's live-model cache is populated asynchronously by the key hooks, so
every post-mutation read polls with exponential backoff (up to 8 attempts)
instead of asserting immediately.
- Each scenario has a cleanup folder that deletes its provider (cascading to its
keys); it runs even when a mid-scenario step fails, and accepts 200/204/404.
- To change or extend the scenarios, edit
`runners/build-model-catalog-wiring-collection.py` and re-run it, then commit
both the script and the regenerated collection:

```bash
python3 runners/build-model-catalog-wiring-collection.py
```

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.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Regeneration instructions reference wrong filename and language.

The regeneration workflow and local run instructions have the same filename mismatches:

  • Line 155: Script path should be ./runners/individual/run-newman-routing-wiring-tests.sh (not run-newman-model-catalog-wiring-tests.sh).
  • Line 177: Comment references editing runners/build-model-catalog-wiring-collection.py but should reference runners/build-routing-wiring.mjs.
  • Line 181: Regeneration command shows python3 runners/build-model-catalog-wiring-collection.py but should be node runners/build-routing-wiring.mjs per the stack context (Node.js CLI, not Python).

These instructions are non-functional as written.

📝 Proposed fix for regeneration instructions
   - To change or extend the scenarios, edit
-    `runners/build-model-catalog-wiring-collection.py` and re-run it, then commit
+    `runners/build-routing-wiring.mjs` and re-run it, then commit
     both the script and the regenerated collection:
   
     ```bash
-    python3 runners/build-model-catalog-wiring-collection.py
+    node runners/build-routing-wiring.mjs
     ```

And for the local run command:

   ```bash
-  ./runners/individual/run-newman-model-catalog-wiring-tests.sh
+  ./runners/individual/run-newman-routing-wiring-tests.sh
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @tests/e2e/api/README.md around lines 152 - 182, README contains incorrect
script and regeneration instructions: replace the local run command reference
"run-newman-model-catalog-wiring-tests.sh" with
"run-newman-routing-wiring-tests.sh", change the regeneration script reference
"build-model-catalog-wiring-collection.py" to "build-routing-wiring.mjs", and
update the regeneration command from "python3 ... .py" to "node ... .mjs" so the
README uses the Node CLI and correct script names.


</details>

<!-- fingerprinting:phantom:triton:puma -->

<!-- cr-comment:v1:7a1bfbdaacc8eecff983a87d -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment on lines +249 to +254
function distAssertLines(sid, step) {
const arr = (ids) => "[" + (ids || []).map((kid) => jsKeyName(sid, kid)).join(", ") + "]";
const lines = [`var seen = (pm.collectionVariables.get('dist_${sid}') || '').split(',').filter(Boolean);`];
if (step.expectKeyIds) {
lines.push(`${"var"} mustServe = ${arr(step.expectKeyIds)};`);
lines.push("mustServe.forEach(function (e) { if (seen.indexOf(e) < 0) throw new Error('key ' + e + ' never served; observed ' + JSON.stringify(seen)); });");

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.

🧹 Nitpick | 🔵 Trivial | 💤 Low value

Remove unnecessary template literal.

Line 253 uses ${"var"} which evaluates to "var" — the template expression is redundant. Compare to line 257 which correctly uses var only = ... directly.

♻️ Simplify
-  lines.push(`${"var"} mustServe = ${arr(step.expectKeyIds)};`);
+  lines.push(`var mustServe = ${arr(step.expectKeyIds)};`);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/e2e/api/runners/build-routing-wiring.mjs` around lines 249 - 254, The
template literal `${"var"}` in function distAssertLines is redundant; replace
the expression when pushing the declaration for mustServe so it uses a plain
keyword (e.g., change lines.push(`${"var"} mustServe =
${arr(step.expectKeyIds)};` to lines.push("var mustServe = " +
arr(step.expectKeyIds) + ";")) so the code reads the same as the later `var only
= ...` line and avoids the needless template expression; update the lines.push
call that builds `mustServe` accordingly.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Pratham-Mishra04 commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

Merge activity

  • Jun 11, 7:18 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 11, 7:19 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jun 11, 7:19 AM UTC: @Pratham-Mishra04 merged this pull request with Graphite.

@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 06-10-tests_add_e2e_routing_wiring_test_harness branch from d742bbb to fe0a474 Compare June 11, 2026 07:18
@Pratham-Mishra04
Pratham-Mishra04 merged commit 2e70b73 into dev Jun 11, 2026
13 of 15 checks passed
@Pratham-Mishra04
Pratham-Mishra04 deleted the 06-10-tests_add_e2e_routing_wiring_test_harness branch June 11, 2026 07:19
akshaydeo pushed a commit that referenced this pull request Jun 12, 2026
## Summary

Briefly explain the purpose of this PR and the problem it solves.

## Changes

- What was changed and why
- Any notable design decisions or trade-offs

## Type of change

- [ ] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [ ] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

Describe the steps to validate this change. Include commands and expected outcomes.

```sh
# Core/Transports
go version
go test ./...

# UI
cd ui
pnpm i || npm i
pnpm test || npm test
pnpm build || npm run build
```

If adding new configs or environment variables, document them here.

## Screenshots/Recordings

If UI changes, add before/after screenshots or short clips.

## Breaking changes

- [ ] Yes
- [ ] No

If yes, describe impact and migration instructions.

## Related issues

Link related issues and discussions. Example: Closes #123

## Security considerations

Note any security implications (auth, secrets, PII, sandboxing, etc.).

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable




<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **Documentation**
  * Enhanced e2e API testing docs with a new Model Catalog Wiring Tests section, detailed scenarios, run/seed instructions, skipping behavior, async polling/cleanup, and guidance for merging extra Postman collections.

* **Tests**
  * Added comprehensive end-to-end routing/wiring test generation and runners covering provider/key configs, virtual-key routing, distribution/load-balancing, polling/cleanup, reports, and CI-friendly execution.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

Files API Support

2 participants