Skip to content

fix: accept draft writes whose context is a long comment anchor - #6162

Merged
leaf-agent merged 1 commit into
mainfrom
fix/draft-context-length
Nov 16, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/draft-context-length

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

#6124 moved drafts to the page's server and bounded a write's context at 1024 characters. A selection composer's context is composer: 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. In test_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 on main from #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 current main, passes on its parent 17948f1e1, and passes with this change. tests/process/test_drafts.py passes 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

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
@leaf-agent
leaf-agent merged commit 9a44689 into main Nov 16, 2026
6 checks passed
@leaf-agent
leaf-agent deleted the fix/draft-context-length branch November 16, 2026 11:11
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant