Repository navigation
fix: accept draft writes whose context is a long comment anchor - #6162
Merged
Merged
Conversation
A selection composer's draft context is `composer:` plus its anchor, which quotes the passage, so a comment on more than about a thousand characters exceeded the 1024-character `context` bound #6124 put on `/api/draft`. The server refused every write with 400, and that draft never reached the server, so other tabs and devices never saw it. The context now has no upper bound, as the anchor it names has none. test_a_selection_of_the_whole_page_still_finds_its_passage failed on the 400s before this change and passes after it. Refs #3985
This was referenced Nov 16, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 16, 2026
…-refusal check (#6173) `test_a_late_refusal_cannot_restore_an_attempt_another_tab_settled[None]` failed in push run [43877886146](https://github.com/max-sixty/leaf/actions/runs/43877886146) because the test refused the first tab's send before that tab had heard that the draft was settled. The test holds the first tab's state read, so that tab learns about the second tab's send only from the drafts read the same news look starts. The test waited for the *server* to hold the draft settled (`until_draft_settled`), which says nothing about what the tab has heard. When the refusal won the race, `keepRefusedWords` still found the tab's unsettled record carrying the refused attempt. It raised the error on the reply field rather than in the panel, so the panel wait ran until the held state read's 120 s timeout turned it into "Lost the connection — reconnecting". The test now waits on the tab's own copy, through `draftHasContent`, which `check-api.js` now exports. `loadDraft` (`heard_draft`) can't answer this, because it hides a generation while the tab is sending it. Product code is unchanged. Verification on this runner: the test failed 16 of 17 runs on `main` and on commits back to #6162, each time with the CI diagnostic. With the change, it passed 11 of 11. CI passed this test at `e65b8507e`, so it's timing-dependent, not a regression from a recent commit. Refs #3985 — automated triage Co-authored-by: leaf-agent <[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.
#6124 moved drafts to the page's server and bounded a write's
contextat 1024 characters. A selection composer's context iscomposer:followed by its anchor, and the anchor quotes the passage. So for a comment on a passage longer than about a thousand characters, the server refused every draft write with 400. That draft never reached the server, so another tab or device never saw it. Intest_a_selection_of_the_whole_page_still_finds_its_passage, select-all gives a 16,713-character context, and the 400s fail the test at teardown. That failure is onmainfrom #6124 on (run 43835820738).The context now has no upper bound, because the anchor it names has none. The stored record's shape is unchanged.
The test fails on
8b68c6d76(#6124) and on currentmain, passes on its parent17948f1e1, and passes with this change.tests/process/test_drafts.pypasses too.The same run's other #6124 regression,
test_a_back_gesture_never_throws_away_unsent_words(the words watch reports the back-closed editor's words as lost), has a different cause and is not touched here.Refs #3985 — automated triage