Repository navigation
fix(content): drop an out-of-range Length hint instead of refusing the run, and test the editor's Fix and hand-off calls (#1552 follow-ups) - #1553
Merged
Conversation
…e run, and test the editor's Fix and hand-off calls (ansvisor#1552 review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
approved these changes
Oct 26, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with a follow-up.
The #1552 review's two items:
- A Length of 0 makes the API refuse the run: Done.
- The editor's two calls aren't tested: Done. One test has a small gap (follow-up 1).
What I checked:
- Why it goes before the API deploy. I confirmed it.
- Main's routes refuse
overLength: { count, max: 0 }. I parsed main's realfixBodyandhandOffBody(zod 4.3.6), and both fail onoverLength.max. So they answer 400invalid. - The web on main sends that body whenever a draft's Length is 0 and its page isn't empty. That covers every hand-off (Hand off and the automatic one) and Remove AI traces' own Fix.
- So if the API is deployed from main without this, those runs fail.
- The web half alone stops the requests once Vercel deploys it. The server half covers pages opened before the merge.
- Main's routes refuse
- The server (
server/src/lib/content-agent.js:135-141)..optional().catch(undefined)sits on the field. The same parse with this PR's schemas:max: 0,count: -1,count: 1.5,'long'andnullall parse, with nooverLength;- a valid hint is kept as it was;
- with no field, there's still no key.
- Nothing else is hidden. With
max: 0plus another bad field, the request is still refused, and the issue names only that field. I tried emptyrules, a badbrandId, an empty text rule, badsourcesand badlocked. For the hand-off I tried emptyitems, an unknownoriginand a key outsideHANDOFF_KEYS. - The hand-off gets the same.
handOffInputisfixRulesInput.omit({ rules }).extend(…), so it keeps the field as it is, and the route's.extend({ brandId })does too. A dropped hint leaves the key asundefined.handOffDraftpasses it on only when set (content-handoff.js:85), andoverLengthLine(undefined)is''. - A Length rule sent (
:994) gives no line. Without one the line is said as before. Main's and this PR's prompts are the same byte for byte when no Length is sent, with or without the hint, and when a Length is sent with no hint. Hand-off keys can't belength, so the skip only matters for Fix.
- The web (
web/src/lib/content/rules.ts:832-835).status.max >= 1drops the hint only for a Length of 0.lengthBand(1)already gives a top of 1, and the Rules tab takes whole numbers only.- Fix open rules was already safe: a Length of 0 isn't held (
lengthOutOfReachneeds a target above 0), so it's sent as a rule.
- Tests.
- The new cases for the change fail without it:
- the server's three dropped values and the Length-rule prompt check (checked against main's modules);
- the hand-off parse of
max: 0; overLengthForwith a Length of 0;- the page test's Length-0 hand-off, which sends
max: 0on main.
- The page tests' other cases cover #1552's two calls, and they fail if a call stops sending the field.
- Hand off: 100 sends
max: 120, and a Length equal to the page's own count sends none. - Fix: in that fixture the Length is held. A rewrite's floor (the H1's 20 characters plus a 100-character summary) is past 24, so the hint goes, with
max: 24.
- Hand off: 100 sends
- I read the web tests but didn't run them.
- The new cases for the change fail without it:
- Speed and AI budget. No new regex, no loop on the page's text, and no new model call.
- Merge.
- Before the API deploy. Users see no change. The prod API strips
overLength, so the web stops sending a hint the API ignores today.
Follow-up:
- The Fix test passes on either branch (
page.test.tsx:6701-6705).- The
ifaccepts both outcomes: the Length sent with no hint, or the Length held with the hint. In this fixture the Length is held, so only theelseruns. - If the fixture changes so the Length isn't held, the test still passes but stops checking the call.
- Fix: state the branch:
expect(sent.rules.map((r: { key: string }) => r.key)).not.toContain('length'); expect(sent.overLength).toEqual({ count: expect.any(Number), max: 24 });
- The
7 of 12 tasks
gkhngyk
pushed a commit
that referenced
this pull request
Oct 27, 2026
#1553 review) (#1558) Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Summary
Follow-ups from the review of #1552 (merged). These should go in before the API deploy that carries #1552.
1. A Length of 0 no longer makes the API refuse the run.
lengthBand(0)is 0–0, so every page reads as long withmax: 0.overLength: { count, max: 0 }.max: 0, so once the API was deployed those runs would answer 400invalid.content-agent.js):overLengthis.optional().catch(undefined): a value out of range is dropped and the run goes on. This also covershandOffInput, which extends the same schema.lengthrule is among the rules, since the line says the Length isn't.rules.ts):overLengthForreturns undefined when the band's top is under 1.2. The editor's calls are tested (
page.test.tsx):overLength: { count, max: 120 };Related issue
Follow-up to #1552 (no issue).
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
overLength.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): 0 errors; the 6 warnings were already on mainyarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Also run:
yarn test(427 files, 4,068 tests);yarn build, before the last edits, which were comments and tests only.Server tests:
max: 0, a negative count and a string parse to nooverLength, and the rest of the input is kept;lengthrule sent;Web tests:
overLengthForgives nothing for a Length of 0.Pre-push review
A review agent read the change. It checked zod 4.3.6 against the real
fixBodyandhandOffBody:Fixed from it:
🤖 Generated with Claude Code