Repository navigation
Conversation
ymichael
force-pushed
the
bb/live-data-stack-8-automations-thr_n2p6uq8hfm
branch
from
October 17, 2026 01:24
d1451b6 to
8414615
Compare
ymichael
added a commit
that referenced
this pull request
Oct 17, 2026
ymichael
force-pushed
the
bb/live-data-stack-8-automations-thr_n2p6uq8hfm
branch
from
October 17, 2026 03:36
91b10be to
9facbda
Compare
ymichael
changed the base branch from
bb/live-data-stack-2-plugin-reads-and-writes-on-cor-thr_agngjehcrj
to
bb/live-data-stack-5-theme-preview-thr_x3tzyie8jq
October 17, 2026 03:36
This was referenced Oct 17, 2026
ymichael
force-pushed
the
bb/live-data-stack-5-theme-preview-thr_x3tzyie8jq
branch
from
October 17, 2026 04:51
421881d to
0f7ca0b
Compare
ymichael
added a commit
that referenced
this pull request
Oct 17, 2026
ymichael
added a commit
that referenced
this pull request
Oct 17, 2026
ymichael
force-pushed
the
bb/live-data-stack-8-automations-thr_n2p6uq8hfm
branch
from
October 17, 2026 04:51
9facbda to
a67a476
Compare
ymichael
force-pushed
the
bb/live-data-stack-5-theme-preview-thr_x3tzyie8jq
branch
from
October 17, 2026 05:19
0f7ca0b to
c436076
Compare
ymichael
added a commit
that referenced
this pull request
Oct 17, 2026
ymichael
added a commit
that referenced
this pull request
Oct 17, 2026
ymichael
force-pushed
the
bb/live-data-stack-8-automations-thr_n2p6uq8hfm
branch
from
October 17, 2026 05:19
a67a476 to
7bc91a0
Compare
ymichael
force-pushed
the
bb/live-data-stack-5-theme-preview-thr_x3tzyie8jq
branch
from
October 19, 2026 22:20
c436076 to
1499b19
Compare
ymichael
added a commit
that referenced
this pull request
Oct 19, 2026
ymichael
added a commit
that referenced
this pull request
Oct 19, 2026
ymichael
force-pushed
the
bb/live-data-stack-8-automations-thr_n2p6uq8hfm
branch
from
October 19, 2026 22:20
7bc91a0 to
e3857cf
Compare
ymichael
force-pushed
the
bb/live-data-stack-5-theme-preview-thr_x3tzyie8jq
branch
from
October 19, 2026 22:49
1499b19 to
71fa0c7
Compare
ymichael
added a commit
that referenced
this pull request
Oct 19, 2026
ymichael
added a commit
that referenced
this pull request
Oct 19, 2026
ymichael
force-pushed
the
bb/live-data-stack-8-automations-thr_n2p6uq8hfm
branch
from
October 19, 2026 22:49
e3857cf to
2e416a7
Compare
ymichael
added a commit
that referenced
this pull request
Oct 20, 2026
…mutations (#5640) ## Human comments ## What was wrong **Stack 1 of 14.** Merge order: #5640 → #5658 → #5688 → #5661 → #5669 → #5666 → #5659 → #5660 → #5663 → #5667 → #5668 → #5677 → #5673 → #5670. When a core write changes data that other screens or clients show, someone has to remember to refresh every query that depends on it. Today each write does this by hand: a cache-owner module plus a system change kind (for UI preferences, `ui-preferences-changed`, routed through the realtime registry). Plugins have no equivalent at all, which is #4944. This is step 1 of a stack that replaces #5582. Here, a contract declares what a read depends on and what a write changes, and the client refreshes from those declarations. The plugin hooks in later steps will be thin wrappers over this same core path. ## What changed - **`@bb/domain`:** a new `ContractTagDeclarations` type with `tags(input, output)` and `invalidates(input, output)`. It contains types only. - **`@bb/hono-typed-routes`:** - `defineRoute` accepts these declarations. - After a 2xx JSON response, `typedRoutes` publishes the route's `invalidates` tags through a new `invalidateTags` option. - Registering a route that declares `invalidates` throws if that option is missing. - **Server:** `hub.notifyTags` batches tags within a microtask and sends `{type:"changed", entity:"tags", tags}` to every connected client. This is a new message between the server and the app; the daemon is untouched, so `HOST_DAEMON_PROTOCOL_VERSION` is unchanged. - **New `@bb/query-tags` package:** - Tags are registered on queries through `meta`. - `invalidateTags` refreshes the queries whose data carries a matching tag, within a scope. Core uses `core`. - A read that is in flight restarts only if an overlapping invalidation arrives during it. - `runTaggedMutation` settles only after the affected active reads have re-read. That includes a first load whose tags aren't known yet, which the reference branch got wrong. - **App:** - The realtime cache effects pass `tags` messages to `invalidateTags`, and hold them while the tab is hidden. - A small `route-tags.ts` adapter connects route contracts to these reads and mutations. - **UI preferences, which prove the mechanism:** - The read declares `ui-preferences`, and update and reset invalidate it. - The sync engine saves through `runRouteMutation`. - `ui-preferences-cache-owner.ts`, the `ui-preferences-changed` change kind and its registry entry are deleted. - The sync keeps each acknowledged entry, so a failed re-read neither reverts the preference nor bases the next write on a stale revision. Not in this PR: plugin SDK hooks, plugin RPC, plugin WebSocket targets and the CLI. Those come in later steps of the stack, each with its first caller. ## How you verified - `pnpm exec turbo run build typecheck lint test --filter='...[origin/main]' --continue`: 296/296 tasks passed. - Lint has no errors, and the app's warnings match `origin/main`. - New tests in `@bb/query-tags` cover tag matching, scope isolation, stale inactive queries, in-flight races, and refresh failure and recovery. - The first-load race test fails against the reference implementation. - `@bb/hono-typed-routes` tests: invalidations are published only after 2xx JSON responses, and registration fails without the publisher. - Two isolated browser profiles against a source server: a preference write in one refreshed the footer preferences in the other, and a composer draft survived the refresh. - Two WebSocket clients with no subscriptions both received the `tags` message after an HTTP write. - Sidebar perf, five paired samples per checkout with 3,000 threads, against `origin/main`: | Metric | Main median (range) | Branch median (range) | | --- | ---: | ---: | | Mount, ms | 410 (404–419) | 408 (359–412) | | Pin, ms | 72 (71–73) | 71 (70–73) | | Status patch, ms | 69 (69–71) | 70 (69–73) | | Membership refresh, ms | 103 (103–107) | 107 (103–108) | | Query observers | 13 | 13 | The ranges overlap and the number of query observers is unchanged. These samples were taken before the unused pieces were removed; removing them deleted code paths without changing the read path. Part of #4944 > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ymichael
force-pushed
the
bb/live-data-stack-5-theme-preview-thr_x3tzyie8jq
branch
from
October 20, 2026 19:47
71fa0c7 to
37a95ea
Compare
ymichael
added a commit
that referenced
this pull request
Oct 20, 2026
ymichael
force-pushed
the
bb/live-data-stack-8-automations-thr_n2p6uq8hfm
branch
from
October 20, 2026 19:47
2e416a7 to
1d78119
Compare
ymichael
added a commit
that referenced
this pull request
Oct 20, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/live-data-stack-5-theme-preview-thr_x3tzyie8jq
branch
from
October 20, 2026 21:19
37a95ea to
12738d4
Compare
ymichael
force-pushed
the
bb/live-data-stack-8-automations-thr_n2p6uq8hfm
branch
from
October 20, 2026 21:19
1d78119 to
3e8d4c8
Compare
Collaborator
Author
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.
Human comments
What was wrong
Automations owned signal listeners, refresh timers, request guards, and pagination snapshots. Background failures could discard loaded views or hide errors, run starts did not refresh script detail, and returning to detail could reuse stale script content.
Stack 9 of 13, stacked on #5663. #5640 is merged and #5688 is folded into #5658. Review only this PR's commits. Merge order: #5658 → #5661 → #5669 → #5666 → #5659 → #5660 → #5663 → #5667 → #5668 → #5677 → #5673 → #5670.
What changed
Declare tags/keyTags/invalidates on the RPC contract, use the shared query/keyed-query/mutation hooks, and replace producer signals with scoped RPC invalidations. Overview, detail, drafts, and run rows survive refresh errors with inline Retry. Run starts refresh script detail, and returning to detail rereads its file.
Run history retains loaded positional windows through refresh and failed Load more, without a skeleton or gaps when a new run shifts page boundaries. This deliberately retains older pages after refresh; pagination failures use inline Retry instead of only a toast, following the plan's error rule. The new
automations_run_pagesRPC is available through SDK/CLI and documented; existing cursor pagination remains available. UI mutations now wait for matched active reads rather than issuing extra manual refreshes.A separate mechanism commit adds opt-in
refetchOnMountto the SDK query hook, with an SDK-owned regression test and SDK version 0.6.66. The Plugin Guide and API audit document it. No daemon protocol or persisted schema changes.How you verified
pnpm exec turbo run build typecheck lint test --filter='...[origin/main]' --continue: 318 successful tasks, 292 cached, 2m23.694s. Automations: 139 passing tests; Plugin SDK: 378 passing tests. Both SDK version checks pass. The SDK mount-refresh negative control fails without the forwarding change.Source CLI also verified UI pause persistence, the new batch RPC's distinct positional windows, and existing cursor pagination. The full report and evidence are at
/Users/michael/.bb/thread-storage/thr_n2p6uq8hfm/automations-report.md. Earlier implementation failures were fixed. One transient server build-failure-status test passed on its focused rerun and in the final full run. Synthetic fixtures and isolated processes/store were removed.Diff from the supplied step 2 base: +502 / −379 (881 changed lines); 281 test/support lines. Commits:
50fc276461(mechanism),d1451b661e(automations). Committed locally; not pushed.Part of #4944
🤖 Generated with Claude Code