Preserve 400 classification for malformed /api/upload bodies - #166
Merged
Conversation
CopilotAI
changed the title
[WIP] Preserve client-error status for malformed upload bodiesPreserve 400 classification for malformed Jul 2, 2026
/api/upload bodiesBigSimmo
marked this pull request as ready for review
July 2, 2026 10:27
BigSimmo
enabled auto-merge
July 2, 2026 10:27
Uh oh!
There was an error while loading. Please reload this page.
BigSimmo pushed a commit
that referenced
this pull request
Jul 31, 2026
Three conflicts, resolved by evidence rather than by side-preference. scripts/ensure-codex-cloud-git-remote.mjs and tests/codex-cloud-setup.test.ts: took main's version. The branch carried its own fix for the same defect (5aa3d6c, judging origin safety from the configured remote URL) on top of main's #1497, so neither side was obviously newer. main's version introduces a configuredOriginUrl() helper, already covers the url.*.insteadOf case the branch's extra test was written for, and passes 12/12 locally — verified before choosing, since taking a side wholesale is only safe when the other side's content is genuinely subsumed. This also clears the two codex-cloud-setup failures this branch has carried all session. docs/outstanding-issues.md: fifth id collision on this branch. main has since claimed #151-#153 — the exact ids these rows previously held — and now runs to #164. main's rows are kept and the follow-ups renumber to #165 (adopt a consolidated answer-home notice block), #166 (answer mode ships no verify-before-use caveat) and #167 (verify:pr-local exits 0 when its build step refuses to run), with their three cross-references and the marker (168) following. check:outstanding-issues: 165 rows (50 open, 115 archived), unique ids, next-id=168 above the highest, no ids deleted from base 23465d5. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NPyFcMfn1jMmphr6AqiWBg
BigSimmo pushed a commit
that referenced
this pull request
Jul 31, 2026
… rows CodeRabbit found row #165 claiming its follow-ups "were renumbered again to #156/#157/#158" — ids that now belong to unrelated rows on main. A reference that resolves to the wrong row is worse than none in a ledger whose whole job is to be followable later. Two fixes: - Dropped the renumbering trail entirely rather than updating it. It listed superseded ids that main has since reissued, and it went stale again on the very next sync; the row now states that renumbering happened and why, without naming numbers that no longer mean anything. - Corrected a second stale reference the earlier renumber missed: row #165 pointed at #157 for the privacy sign-off that variant F would need. That is the answer-mode caveat row, now #166. The earlier pass only rewrote three known cross-reference phrasings and did not catch this one. Verified by extracting every backtick id reference from the three rows: #165 and #166 now point at each other and #167 at #120, all live. check:outstanding-issues: 165 rows (50 open, 115 archived), unique ids, next-id=168 above the highest, no ids deleted from base 3b4872f. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NPyFcMfn1jMmphr6AqiWBg
BigSimmo pushed a commit
that referenced
this pull request
Aug 12, 2026
…re-scope the wave plan Archived with source evidence: - #166 the verify-before-use caveat ships (verification-notice.tsx:52, rendered unconditionally by AnswerCard at answer-card.tsx:108). I reported this row as open twice before reading the code; the archive says so. - #208 buildAnswerClipboardText composes renderCopyText rather than replacing formatAnswerRenderCopyText (answer-copy-payload.ts:121-138). - #216 AnswerCard is adopted on the answer surface and the manifest agrees. Re-scoped #250: its wave plan names A1 rows that are now closed and hygiene rows that are in flight, so as written it misdirects. Recorded what actually remains (#147, #117, #118, #98, #189). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017paT42ZVMf8jaLtkjFxdy5
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 freeto 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.
Summary
/api/uploadwas regressing malformed upload requests into generic 500s whenrequest.formData()threw before file-field validation. This change restores 400 client-error behavior for invalid upload bodies and preserves 5xx classification for real backend failures.request.formData()failures asPublicApiErrorwith status400(invalid_form_data).jsonError(error)in the route catch path so storage/database errors are not coerced to 400.400and no storage/database side effects.500for document/job insert failures.Verification
npm run verify:cheapnpm run verify:uiwhen UI, routing, styling, browser behavior, reduced-motion, or forced-colors behavior changednpm run verify:releasebefore release or handoff confidence claimsnpm run format:checknpm run check:production-readinesswhen clinical workflow, privacy, environment, Supabase, source governance, or deployment behavior changednpm run check:deployment-readinesswhen deployment startup, hosting, or rollout behavior changedClinical Governance Preflight
Complete this section when the change touches ingestion, answer generation, search/ranking, source rendering, document access, privacy, production env, or clinical output.
Clinical KB Database(sjrfecxgysukkwxsowpy)Notes