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
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. |
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 still silently discarded (unresolved)
Both the scenario and testcase branches gate on canAcceptScenario(scenariosMap, sc.id, MAX_SCENARIOS_PER_DOCUMENT). When the backend returns >10 distinct scenarios, the extras and all their test cases are dropped, and bulkCreateTestCases reports "…in <doneCount> of <total> scenarios" where total is the capped Object.keys(scenariosMap).length — so a 14-scenario doc reports "10 of 10" with no truncation notice.
The real backend constraint is 10 IDs per fetch-details request, already enforced by chunkArray(ids, TC_DETAILS_MAX_BATCH). This separate per-document scenario cap is reverse-engineered from a constant that isn't a real hard backend limit, and it's untested (no test covers the drop path).
Suggestion: Remove MAX_SCENARIOS_PER_DOCUMENT + the canAcceptScenario gating entirely. If a per-document cap is genuinely required, surface it — track the true incoming count and append "Note: N scenarios exceeded the per-document limit and were not created" to the result string, plus a test asserting the >10 case.
Reviewer: stack:code-review
| if (sc) { | ||
| if ( | ||
| sc && | ||
| canAcceptScenario(scenariosMap, sc.id, MAX_SCENARIOS_PER_DOCUMENT) |
There was a problem hiding this comment.
[High] Drop site for the silent scenario cap
This canAcceptScenario(..., MAX_SCENARIOS_PER_DOCUMENT) gate (and the matching one in the scenario branch) silently skips every scenario past the 10th — fetchTestCaseDetails is never called for it and its test cases are never created. Combined with the capped total in the result string, the user gets no signal that data was dropped. See the config.ts comment for the full finding and suggested fix.
Suggestion: Remove the per-document cap (chunking already handles the real per-request limit), or surface dropped scenarios in the result string.
Reviewer: stack:code-review
Claude Code PR ReviewPR: #324 • Head: 039dbd0 • Reviewers: stack:code-review SummaryRe-review of PMAA-147 TCG hardening (batch ≤10, deadline-bounded polling rewritten to recursive Review Table
Findings
Resolved since prior review
Verdict: FAIL — the recursive- |
No description provided.