fix: surface server error body & cap scenarios#324
Conversation
SavioBS629
left a comment
There was a problem hiding this comment.
Claude Code Review (automated) — 2 inline finding(s). Full report in the PR comment below. Verdict: Failed - see PR comment.
| export const BULK_CREATE_MAX_BATCH = 10; | ||
|
|
||
| // Cap scenarios per document (mirrors TCG's former maxScenariosPerDocument=10). | ||
| export const MAX_SCENARIOS_PER_DOCUMENT = 10; |
There was a problem hiding this comment.
[High] Scenarios beyond this cap are silently discarded
When the backend returns more than 10 distinct scenarios, canAcceptScenario rejects every new scenario id once the map holds 10 — those scenarios and all their test cases are dropped (scenario branch never creates the entry; testcase branch skips fetchTestCaseDetails). bulkCreateTestCases then reports "…in N of <total>" where <total> is the capped count, so a 14-scenario document reports "10 of 10" — the user never learns 4 were dropped.
The real backend constraint is 10 IDs per fetch-details request, already handled correctly by chunkArray(ids, TC_DETAILS_MAX_BATCH). This separate per-document scenario cap looks reverse-engineered from a constant that doesn't exist on the backend.
Suggestion: Drop MAX_SCENARIOS_PER_DOCUMENT capping entirely. If a safety valve is genuinely wanted, track dropped scenario ids and surface them in the result string, and justify the value against the backend.
Reviewer: stack:code-review
| }, | ||
| body: payload, | ||
| }); | ||
| results[id] = resp.data; |
There was a problem hiding this comment.
[Low] Dead results map
results[id] = resp.data is written but results is never read or returned (bulkCreateTestCases returns resultString). So the "only last batch's resp.data kept" concern is not a regression — the value was already unused — but the write is now misleading dead code.
Suggestion: Remove the results variable entirely.
Reviewer: stack:code-review
Claude Code PR ReviewPR: #324 • Head: 5f37f10 • Reviewers: stack:code-review SummaryPMAA-147 hardens the Test Case Generator (TCG) flow: batches test-case-detail fetches and bulk-create into chunks of ≤10, caps scenarios per document at 10, adds an 8-minute poll deadline, rewrites Review Table
Findings
Verdict: FAIL — the polling rewrite, instrumentation, auth, and multi-tenant rules are clean and the suite passes, but scenarios beyond the cap of 10 are silently discarded with the user told "N of N", a data-loss-without-surfacing path (High). Resolve that (most likely by removing the cap) before merge. |
No description provided.