feat(runner): live shape checks for the two AI endpoints (DEV-2203) - #187
Open
danielzytohoc wants to merge 4 commits into
Open
feat(runner): live shape checks for the two AI endpoints (DEV-2203)#187danielzytohoc wants to merge 4 commits into
danielzytohoc wants to merge 4 commits into
Conversation
panels.spec.ts and style-apply's recorded payloads prove the drawers; nothing proved the deployed chain — worker → LiteLLM → model → whitelist — returns something usable at all. Two API-level calls, one file, double-gated (E2E_BASE_URL + E2E_AI=1): /api/chat answers with the documented shape, /api/theme answers with a whitelist-clean, non-empty suggestion (an empty 200 is the DEV-2497 class of quiet failure). The theme whitelist assertion imports the product's own generated TOKEN_KEYS, so a sanitiser regression fails here too. A 429 skips rather than fails: both endpoints share the 8/min-per-IP bucket with real users, and traffic is not a product failure. The chat body uses relative file paths on purpose — the validator silently drops unsafe paths and an all-dropped map fails as 'files are required' (this spec's first live run found that the hard way).
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 90e69fd. Configure here.
added 3 commits
August 17, 2026 08:35
…gbot #187) Both endpoints sit behind the budget gate as well as the per-IP bucket: an anonymous caller gets 401 budget_login_required at anon_blocked and 503 budget_exhausted at new_blocked/closed. Those are spend policy, not the AI chain — the same class as a 429 — so they skip. A 503 chat_unavailable stays a failure: a missing gateway key IS the product being broken.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Seventh in the DEV-2203 series. Stacked on #186.
What
e2e/ai-live.spec.ts— two API-level tests, double-gated (E2E_BASE_URL+E2E_AI=1), that prove the deployed gateway chain returns something usable (never an opinion on content quality):POST /api/chat→ 200 with the documented shape: non-emptymessage,edits/references/pagesarrays.POST /api/theme("corporate green") → 200 with a whitelist-clean suggestion — every token key must be in the product's own generatedTOKEN_KEYS, palette keys must match the ramp grammar — and the suggestion must move at least one thing (an empty 200 is the DEV-2497 class of quiet failure).429 →
test.skip: both endpoints share the 8/min-per-IP bucket with real users.Verification
Both passed against production (7.6 s / 7.9 s, ~2 LLM calls). Skip behavior verified without the gates. First live run caught a subtlety now documented in the spec: the chat validator silently drops non-relative file paths and then refuses the all-dropped map as "files are required".
Note
Low Risk
Test-only addition with env gates; no production code paths changed, though runs consume live API quota when enabled.
Overview
Adds
e2e/ai-live.spec.ts, a Playwright suite that hits the deployedPOST /api/chatandPOST /api/themeendpoints (not the UI drawers) to verify the worker → LiteLLM → model chain returns usable responses.Tests run only when
E2E_BASE_URLandE2E_AI=1are set (real LLM spend, shared 8/min IP rate limit). 429 and budget_* refusals skip instead of failing; other errors (e.g. missing gateway key) still fail.Chat: expects 200 with non-empty
messageand arrayedits,references,pages; uses relative-only file paths so the validator does not drop the whole map.Theme: expects 200, token keys in generated
TOKEN_KEYS, palette keys matching the ramp grammar, and at least one change across tokens/palette/config (non-empty “corporate green” suggestion).Reviewed by Cursor Bugbot for commit c9f0ea5. Bugbot is set up for automated code reviews on this repo. Configure here.