Skip to content

fix(content): read what the last rewrite came to by the editor's count once it's decided too - #1526

Merged
gkhngyk merged 55 commits into
ansvisor:mainfrom
cihan-gyk:fix/last-rewrite-editor-count
Oct 26, 2026
Merged

gkhngyk merged 55 commits into
ansvisor:mainfrom
cihan-gyk:fix/last-rewrite-editor-count

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #1524. The PR's own changes are its commits after #1524's branch. This is a follow-up to #1521 (E, one count), found in the batched browser check of #1513–#1524.

The Rules panel's Length note reads what the page's last rewrite came to: "The last rewrite came to N, so another won't get there" (#1514). #1521 counts that rewrite the way the toolbar does, but only while it is the rewrite shown, matched by its suggestion id. Once it was decided and a later Fix batch was the one shown, the panel fell back to the API's own count, which runs a little over. In the check, the same rewrite read 3,110 while shown and then 3,146. On the live test page that would have been 6,617 → 6,725, the mismatch group E was about.

  • getLastPageRewrite also reads the rewrite's page (after_text, one row, on opening and once a new rewrite is shown). The editor counts it as its toolbar does (htmlChars), shown or decided.
  • The stored count is kept as a fallback for an empty page.
  • The suggestion id that matched the shown rewrite (LastRewrite.id) is no longer needed and is gone.

Related issue

Follow-up to the editor test findings 2026-10-25 (group E, #1521).

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. On a draft over its Length, run Rewrite page. While the rewrite is shown, note "The last rewrite came to N" in the Rules tab, and the card's "a → N characters".
  2. Accept or reject it, then run Fix open rules so a new batch shows.
  3. The Rules tab still says "came to N", the same number, not a slightly larger one.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/): 0 errors; the 6 warnings are in files this PR doesn't touch
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Web: yarn test and yarn build. The new test gives a decided rewrite with the API counting 1,250 and its page reading 1,200 in the editor. The panel says 1,200. The action's own tests now expect the page as well.

A pre-push review ran; its comment fixes are the last commit (lint, typecheck and yarn test rerun after it). One note it raised is left as is: 00285's header comment says the editor reads a number, not the rewritten page. CLAUDE.md says never to edit an existing migration, so it stays. after_chars still marks a rewrite made after 00285, and is the fallback count.

🤖 Generated with Claude Code

cihan-gyk and others added 30 commits October 25, 2026 21:35
…adings' answers and what the last rewrite came to, and offer a Length it can reach

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… for, keep its numbers on the row (00285), and read the floor's sections closer (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and count the last rewrite only within its Length's band and the same kept text (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er to rewrite the cited passages too when they hold the Length out of reach

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e back, release an unused hold, keep a cited-too miss as evidence, and offer it only when cited passages hold the Length (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he agent and Next step move on, and count open rules as the Rules tab does

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…es read the page, keep the Length's own words, and wait for the passages before dropping skips (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ion, not the next step, and say how many placeholders it leaves to fill

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aphs, and read a rewrite's once, not on every key (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y why a run left nothing, and show a failed last run on the card

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… id and kind, not by clocks, and clear a failed last run once another starts (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e rules before they're accepted, and say which rule met now one would break

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…age as it is now, and count a rewrite's Length as its own line reads it (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…wasn't given or drops a name a passage has

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…give claims only to sources the page or its input names, and put a rewrite's as a placeholder (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…editor shows them, and hold the rules chip until its count stands

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aracters as the toolbar counts them, and the run's rule count

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…for the brief and catalog before the rules' count, hold the panel's counts with it, and read the shown rewrite's Length by the editor's count (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s open suggestions for the page before, and drop a batch's card once the page no longer has it

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e left open never holds the next run out of sight

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…estions when they can't be set aside, and hold History while the agent works or a decision saves (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… a sweep on the step under way, a line on what it does, and the page drawn in

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, true without an outline, and silent on rules or sources read none of; even step spacing; steadier tests (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hich runs as a Fix, with its steps and Stop

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a Start's write doesn't stand in for it; the rewrite prop says what it reads (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t once it's decided too, not only while it's shown

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ents say when it's read and who counts it (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Merged the PR below it forward (c149612), which brings in main now that #1514–#1519 are in. No conflicts; its diff against main is its own files again.

Checks after the merge:

@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 26, 2026

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

The new head, c149612, only merges #1524's new head (ea8b63c), and through it main. Re-merging its parents (b96e755 and ea8b63c) is clean and gives the commit's tree (c6e37e6c), so the merge hides nothing. Its own change against #1524 is the same as in round 31, line for line. With its stack, it merges cleanly on main. The verdict stands.

@gkhngyk
gkhngyk merged commit a31a71c into ansvisor:main Oct 26, 2026
4 of 5 checks passed
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.

2 participants