readest/apps/readest-app/LESSONS.md
Huang Xin f1b1a490cb
chore(agent): lessons from 2026-10-14 to 10-15 (#6842)
Reviews the 19 commits from 3cc39ad7a to 61ef15e00. Nothing was reverted,
reopened or fixed again, and CI was green and finished before every merge.

- New: test a selector or matcher against inputs, not its own text (#6828).
- New: keep a fix in shared rendering code to the reported trigger
  (#6712, #6797), seen on a second day.
- New: replies post as the maintainer, so never mention "the maintainer"
  (three Reply Desk edits on 10-14). The triage skill's verdict table that
  asked for that wording is reworded.
- Seen again: runnable real-use checks listed as "not run" (#6791, #6801).
- Promoted rule, new evidence: community PRs #6799, #6830, #6833, #6834 and
  #6835 merged with no record of what ran.
- Done right: #6813 (Nix hashes in the PR), #6828 (fixed the sibling
  selectors too).

Checked: no behaviour change (agent files only). Every sha and PR number
cited was looked up on main or GitHub; Reply Desk wording was compared
draft against edited.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 17:42:12 +02:00

7.9 KiB
Raw Permalink Blame History

Lessons from merged work

Agents write, review and merge most of Readest's code. Each day the merged commits are reviewed for what had to be fixed again, what shouldn't have merged and what was verified too thinly (the nightly-review skill). What we learned is kept here. Read this before changing code. Each lesson is a rule, then the evidence. "Seen" counts the days a review found it. A lesson seen on 3 or more separate days moves into acceptance.

From 2026-10-04 to 10-14 (86 commits, through v0.12.16), most fixes didn't need a second try. The ones that did came from bundled PRs, checks listed but not run, and a change verified in one mode or on one device. Three lessons were seen on a third day and moved into the rules: one PR one goal, merge the reviewed head with a record of what ran, and check a UI change under every mode and form factor it ships to.

From 2026-10-14 to 10-15 (19 commits), nothing was reverted, reopened or fixed again, and every merge had green CI. What went wrong was thinner. Checks that could have run here were listed as "not run". All five community PRs merged with no record of what ran. A selector test checked only the selector's text, which let a regression ship. Reply drafts spoke of "the maintainer" as someone else. Two earlier lessons came back: real-use checks, and keeping a fix to its trigger.

Reading the report

Reproduce on the reporter's OS and app version before calling a report unreproducible or fixed.

  • Done right: bb55cda8b (#6770). The iOS share failed for the reporter but not on iOS 18.7/27.0; replaying the plugin on an iOS 16.4 simulator found URL(string:) returns nil for spaces and non-ASCII there. It fixed the Send, quote-card and image-share siblings too, and listed "not verified on an iOS 16 device".
  • Done right: on #6773, the "still broken on 0.12.16" video turned out to be an older build once the version was checked.

Fix the class, not the sample

When you fix a behavior on one surface, find every surface with the same mechanism and fix them together, or file them.

  • d69176a7a (#6642) kept the library's scroll position across opening a book. OPDS feeds had the same remount bug (#6673), fixed separately 5 days later in a39f46daf (#6683); Settings had its own fix in #6389. There are now three implementations.
  • 2a1bef125 (#6711): #6672's CJK widow/orphan fix lived in a chunk skipped under Use Book Layout, so the page-bottom gap came back in that mode.
  • 122d1dda3 (#6708): footnote popups ignored Full Justification off under Override Book Layout, while the reader respected it (#6636).
  • Done right: 19d6c70c3 (#6828) fixed the footnote-icon indent and also dropped the two older selectors from #1568 that ignored text the same way.
  • Seen 2× (2026-10-04, 2026-10-09).

In shared rendering code, change only what the reported trigger needs, and show the rest is unchanged. This is the other half of fixing the class: the same mechanism everywhere, nothing beyond it.

  • #6712: the first fix also rewrote light backgrounds and dark-mode fills in every mode. The maintainer cut it to Override Book Color on, and a09e06913 (#6765) proved everything else byte-identical to main.
  • #6797: the maintainer's note on the reply draft was "can we narrow it further". ab2da5916 (#6801) then kept the two-axis clip for nowrapped rules that size their own box.
  • Seen 2× (2026-10-13, 2026-10-14).

When you tighten a validator or trust boundary, grep every caller and the values it actually passes.

  • #6343 made /api/kosync reject server URLs with a path. BookOrbit passes {server}/api/v1/koreader, so its web progress sync returned 400 for about three weeks, as did sub-path KOSync servers. Fixed in c307cfd79 (#6698), which kept the allowlist and added mounted-path tests.
  • Seen 1× (2026-10-10).

Code that reads a section document survives a remount: the document can briefly have no root.

  • 7893fa916 (#6674)'s ink re-anchor effect destructured doc.documentElement; during the sign-in detour it threw, reloaded the app and stopped Read Aloud. Fixed in e4af64912 (#6758), reproduced on an Android release build before and after.
  • Seen 1× (2026-10-13).

Dependencies and builds

A PR that adds or bumps a dependency runs every build target before merge: the Nix package (pnpmDeps.hash) and the web server build (pnpm build-web), not only the PR's CI.

  • 44803443a (#6686) added music-metadata with 10 green checks. Main's Nix build then failed (ERR_PNPM_NO_OFFLINE_TARBALL, fixed in 3f45c2333, #6688) and the web server build failed on strtok3 (fixed in 6025a29c8, #6699).
  • Done right: 6025a29c8 (#6699) named the build it ran and checked no strtok3 reference was left in the server chunks.
  • Done right: 9fd7a4820 (#6813) refreshed pnpmDeps.hash and cargoHash in the PR itself. It also showed the compiled prose CSS was byte-identical after overriding postcss-selector-parser.
  • Seen 1× (2026-10-09).

Verification

Run the real-use checks you list, and the failure, limit and scale paths of a new feature, before merging. An unchecked box you could have run is not done.

  • e51ca5ca0 (#6738) merged with "download the chapter being read…" unchecked. 23 minutes later 2ea1a5328 (#6739) fixed two issues found testing it on production: a resumed download used Edge instead of the session's voice, and a failed start left a dead player open.
  • 0409a6172 (#6720)'s test plan covered one successful chapter download. d2875c5ac (#6736) fixed what users met next day: progress frozen at 0/0, failed downloads that never retried, unexplained quota refusals, and a ~50 s wait before the first job on a long chapter.
  • "Not run" is for checks that can't run here. 9f0866f1a (#6791) listed "listening in the app with a real voice" as not run, though Read Aloud works on dev-web. e58e324ea (#6801) listed "a browser re-check after the narrowing commit" as not run, though its repro EPUB had just run on dev-web.
  • Seen 2× (2026-10-12, 2026-10-14).

Test a selector or matcher against the inputs it must match and reject, not against its own text.

  • #6281's test for the image-paragraph indent exemption only checked that getStyles contained the selector strings. :only-child ignores text nodes, so from v0.12.10 a paragraph holding a footnote icon lost its indent. 19d6c70c3 (#6828) fixed it. Its test runs the rule over ten paragraph shapes and fails on main for five of them.
  • Seen 1× (2026-10-15).

A full-suite failure that "passes when rerun alone" is a bug to file, not a pass.

  • bb55cda8b (#6770) merged on "only load-induced 5s timeouts, and those files pass when rerun alone", with no issue naming the cause.
  • Seen 1× (2026-10-13).

List what wasn't run, plainly.

  • Done right: 53b438055 (#6625): "Not exercised on a device, to avoid renaming groups in a synced test library."
  • Done right: a39f46daf (#6683) gives the failure without the fix (expected +0 to be 4000) and explains why #6642's approach can't work for VirtuosoGrid.

Replies

Replies post under the maintainer's account: write as the maintainer, never about "the maintainer".

  • On 10-14 the maintainer edited three drafts (#6728, #6743, #6784) from "noted it for the maintainer to decide on" to "noted it as a feature request". The note on #6784 said: "I'm the maintainer, so rephrase this". The triage skill's verdict table asked for that wording; it is reworded with this lesson.
  • Seen 1× (2026-10-14).

Moved to the rules

Seen on three or more days; the rules and their evidence are in acceptance and a review checks each one.

  • One PR, one goal (10-04, 10-13, 10-14).
  • Merge only the reviewed head, after the last review pass is answered, with a record of what ran (10-04, 10-08, 10-09, 10-11, 10-13, 10-15).
  • Check a UI change under every mode and form factor it ships to (10-05, 10-09, 10-14).