Catalog: say when a watched row changes, as it is #19
merged reactive-catalog-row-rate was squashed into main as 58f97d7 by jonas, 2026-11-27 00:09 UTC. jonas opened it 2026-11-27 00:01 UTC.
A correction of text that pull #17 added, and of the header of awake.ts that said the same before it. Comments only: no statement of code changes. ## What was wrong `CatalogRow` in iterate/api said: "A row changes when its context says something new of itself: at most once in 15 s while it works, and once when it goes quiet." The header of `awake.ts` said "at most once per 15 s while it works" and "one row written per wake of a context". 15 s is the floor for a context that works with no change of its activity stack. A working context sends a changed summary when its activity stack changed or it said what it is, at most once in 100 ms (`AWAKE_ACTIVITY_DEBOUNCE_MS`), as before #17. The catalog writes its row when the summary differs from the row. So the watched row of a context whose log grows fast changes up to ten times a second. ## How it was found On iterate.com after the deploy of 6f4fd09. The Dash's author counted the frames of one Dash page (1,634 in 60 s), and the rule in the text did not fit them. Measured there from a session of my own (the card has the numbers): in 90 s with 8 to 15 contexts awake, 269 writes to the copy and 284 summaries that changed nothing a watcher holds; a watch of `/` by key showed that each of its frames came with new events on its log. ## What it changes - `core/lib/src/api.ts`: the text of `CatalogRow` says when a row changes, and that a watcher that draws should not draw at each frame. - `core/itx/src/context/awake.ts`: the header says when a summary is sent, and how many rows the catalog writes for a wake. ## Proof - The linter and the formatter of iterate/private are clean on both files; `tsc --noEmit` passes in core/lib. - `pnpm -r test` was NOT run again: the diff has comment lines only (`git diff 6f4fd09 b5bee93`: +12 โ6, each line a comment). Session: agy b859a067-e1f8-4f91-8d14-337c9a19b40b on beelink Worker: claude 02c7d409-d06c-4792-af54-c1861507c2e0 on beelink ๐ค Generated with [Claude Code](https://claude.com/claude-code)
Conversation
jonas, 2026-11-27 00:06 UTC
The reviewer's third finding, fixed in 4932b0c: appends alone do not start the 100 ms wait; a change of the activity stack does, or an `itx/described`. The text of `CatalogRow` now ties "about ten times a second" to many short pieces of work that each add to the log, and says that one long piece of work that only adds to the log changes the row once in 15 s. Session: agy b859a067-e1f8-4f91-8d14-337c9a19b40b on beelink
Sign in to comment or to merge.
Files
2 files changed
M core/itx/src/context/awake.ts
@@ -13,10 +13,21 @@ // - One Durable Object accepts 32,768 sockets. A dial refused past that is logged, and that // context is missing from the list: nothing else depends on the socket. // -// The same socket carries what a context says about itself (context-summary.ts), at most once per -// 15 s while it works and once before it closes. The accepting context keeps the newest of each in -// one SQLite row (context-catalog.ts): one row written per wake of a context, beside the rows that -// wake writes in its own log. +// The same socket carries what a context says about itself (context-summary.ts). A context that +// works sends its summary at three times: +// - `AWAKE_ACTIVITY_DEBOUNCE_MS` after its activity stack changed or it said what it is. That +// wait gathers a burst of such changes into one summary. It is no least time between two +// summaries; +// - at a recheck, each `AWAKE_QUIET_MS` while it is busy, when such a change is not yet said or +// the last summary is `AWAKE_SUMMARY_EVERY_MS` old; +// - before it closes. +// A summary whose text equals the last one sent is not sent, so a wake can send none. A context +// whose activity stack changes often sends about ten summaries a second; one long activity that +// only appends sends one per `AWAKE_SUMMARY_EVERY_MS`. The accepting context keeps the durable +// part of each summary that comes in one SQLite row (context-catalog.ts `store`). It writes that +// row at each summary of an equal or later offset and does not compare the two: a summary that +// differs in its activities alone writes the same row again. These rows are beside the rows +// that the wake writes in the context's own log. // // THE CATALOG ANSWERS EACH SUMMARY, on the same socket: it kept it, or it refused it. A context // that goes quiet keeps its socket until its last summary is answered, at most
M core/lib/src/api.ts
@@ -1873,8 +1873,14 @@ /** ONE CONTEXT AS A WATCH SENDS IT: its listing without `awake` and `activities` (the awake list * is a watch of its own, `{ awake: true }`), the two values that the orders sort by, and the - * catalog's revision at which the row last changed. A row changes when its context says - * something new of itself: at most once in 15 s while it works, and once when it goes quiet. */ + * catalog's revision at which the row last changed. A ROW CHANGES WHEN ITS CONTEXT SENDS A + * SUMMARY THAT DIFFERS in something the row holds: the counts and times of its events, its + * storage, what it says of itself. A context that works sends a summary shortly after each + * burst of changes of its activity stack, once in 15 s with no such change, and once when it + * goes quiet. It gathers a burst for 100 ms, and that is no least time between two summaries. + * So the row of a context that does many short pieces of work, each of which adds to its log, + * changes about ten times a second: a watcher that draws should not draw at each frame. One + * long piece of work that only adds to the log changes the row once in 15 s. */ export type CatalogRow = Omit<ContextListing, "awake" | "activities"> & { /** What the order `active` sorts by, in milliseconds: when the context was last active * (`lastActivityAt`, or `lastEventAt` when it has had no activity of its own). */
jonas, 2026-11-27 00:04 UTC