fix(function): report code-placeholder compiler invariants as server failures - #8402
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…failures Overlapping source edits and exhausted parser-sentinel/Python-marker allocation are broken compiler invariants, not problems in the user's code, but they threw CodePlaceholderCompileError and the Function route answered them with 422 like a user syntax error. They now throw a sibling CodePlaceholderInvariantError, which the route's instanceof check does not match, so it falls through to the existing 500 path. User placeholder and syntax errors keep their 422.
…pile error User code can occupy every sentinel a short placeholder could take, so running out of them is the code's fault, not a compiler invariant.
8405d02 to
6bbc799
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
applySourceEdits) and exhausting the Python marker attempts (each marker is a hash of the code itself, so user code cannot occupy them)CodePlaceholderCompileError, so the Function route answered them with 422 exactly like a user syntax errorCodePlaceholderInvariantError. It deliberately does not extendCodePlaceholderCompileError, so the route's onlyinstanceofcheck doesn't match it and it falls through to the existing 500 path (the same path other unexpected compiler crashes already take). A subclass or akindflag would have kept matching that check and stayed 422Type of Change
Testing
CodePlaceholderInvariantErrorand notCodePlaceholderCompileError(fails on the previous code)$xyz$sentinel beforereturn {{a}}still rejects withCodePlaceholderCompileErrorChecklist