Skip to content

feat(threads): show durable sync progress and diagnostics - #543

Merged
nixuuu merged 1 commit into
feat/thread-range-clientsfrom
feat/thread-range-progress
Nov 12, 2026
Merged

nixuuu merged 1 commit into
feat/thread-range-clientsfrom
feat/thread-range-progress

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Thread headers show an icon and compact remaining-record count in reserved space. Accessible labels expose the exact count or “Up to date”. Settings → Diagnostics reports durable applied/head sequences, remaining records, caught-up status and sanitized failure reason/code/frame size. Cached content and recovery actions are in #541.

The additive owner-scoped RPC returns at most 100 metadata rows/page (50 default), plus aggregates. Visible pages refresh every five seconds and stop in the background. It never reads transcripts or returns routes, private hosts, tokens or exception text. Migration 0123 stores failed-frame byte counts without successful-batch writes. The stack upgrades monotonically from dev's 0119 through mirror 0120/0121, clients 0122 and progress 0123. A real PostgreSQL regression test upgrades through each stage and verifies durable journal and failure state are preserved; no later migration can be silently skipped between squash commits.

Copy audit (docs/copy.md §8): indefinite syncing becomes “N records to go” / “Up to date”; readable failure summaries expose technical details only behind disclosure. Verb-led actions, sentence case, accessible labels and non-colour meaning checked. Browser review covers light/dark, desktop/phone widths and short/long names. Production mobile fingerprints are unchanged (JS/TS only): iOS 6ddec9ef559ee0095ac33e94ff9418a942053b17, Android 5f6eae3ab278f1cd543e9ed763f923a319b65ec9.

Final caps/cleanup verification: the opt-in real gateway-to-gateway memory check passed twice, 773 assertions per run. Each run uses separate home/viewer processes, native PostgreSQL within the same swap-disabled scope, 1/10/50 threads, five warm-up cycles and then twenty reconnect plus twenty real decode/write-failure cycles per thread count. Eight client watchers use the actual domain reducer and cached content. The largest history grows from 16 to 64 MiB. Tolerances were fixed before execution and unchanged: at most 4 MiB above warm-up, at most 1 MiB late-cycle drift. Worst observed values across both runs were 0.964 MiB / 0.787 MiB. Closed SequenceWindow count was zero throughout; scope swap was zero.

Threads Home peak over warm-up, MiB Viewer peak over warm-up, MiB Home late drift, MiB Viewer late drift, MiB
1 0.964 0.910 0.787 0.384
10 0.487 0.046 0.035 0.196
50 0.838 0.261 0.462 0.135

After growing history to 64 MiB, the median home/viewer GC heaps across the two runs are 77.26/75.50 MiB (1 thread), 77.86/74.69 MiB (10) and 79.61/75.23 MiB (50). Failure-phase viewer cycle 1 → 20 medians are 76.13 → 75.32, 74.31 → 74.56 and 74.91 → 75.08 MiB, respectively. This supplies repeated-failure evidence for the earlier post-failure comparison gap rather than attributing it to a proven per-failure leak. It is a finite retention check, not a proof against every possible native allocator leak.

Application bounds: process-wide reusable recent windows cap encoded record payload at 4 MiB (8 entries), with one pending window read and at most 8 pending range reads per actively viewed thread. Final close/invalidation/eviction releases references. Metadata queues cap count and bytes at 128 / 64 KiB and memoize lengths weakly. The mirror owns one 64-record/64 KiB batch per subscription until ACK/termination (15-second ACK timeout); no completed payload cache remains. Failure suppression is durable, at most 512 encoded bytes per stored failure, rather than a process-wide growing error map. Active head/cursor metadata remains scalar per actively mirrored thread and is released with the subscription. SQL prepared statements retain the dependency's existing 100-entry LRU per connection (gateway pool at most 10); failed plans are evicted. RSS also contains JIT/native/allocator high-water pages: no exact byte attribution of the earlier +13/+22 MiB RSS difference is claimed from a JS heap graph.

Latest steady sanity comparison after caps, dev 8cb743d2451b51a5af44de80ffe88f626056e555 versus stack a47fd0bf5e5ee447d113634a7e1fc0928aa5bd40: four accepted matched pairs, two complete ABBA blocks, no rejected pair. Workload and warm-up match the earlier full comparison's steady phase: 1,000 turns / ~16 MB output, eight remote watchers (four delayed 250 ms), five idle seconds, pre/post-watch GC checkpoints and 750 scripted-worker deltas at 20 ms. CPUs are pinned (home 2, viewer 3, driver 4, native PostgreSQL 6). Both gateways, workers, driver and PostgreSQL run beneath a systemd-run --user --scope -p MemorySwapMax=0 scope. Scope swap max/current is checked at start, every second and end; current remains zero.

Steady metric Dev median Stack median Median paired delta
Unary RPC p95, ms 80.27 4.86 −75.41
Combined gateway CPU, % of one core 54.12 40.48 −13.87 pp
Home peak RSS, MiB 239.11 249.62 +11.14
Viewer peak RSS, MiB 1,102.46 275.64 −824.31

Load1 ≤12; final observed maximum 2.20. Swap-in rejects at 1,024 KiB/s once or 128 KiB/s for three consecutive samples; observed peak 64 KiB/s and no sustained-threshold run. Host swap-out rejects at 4,096 KiB/s; all four final pairs had zero host swap-out bytes. Each delta is the median matched B−A difference, so it need not equal the difference of the independent A/B medians. P95 measures unary GetThread latency under stream load, not token latency. An initial separate four-pair sanity omitted the old GC warm-up (p95 80.22→4.93 ms, CPU 56.14→40.48%, home RSS paired +28.26 MiB); it is retained separately and not pooled into the aligned comparison.

The earlier accepted four-pair full-stack comparisons remain the source for other phases: first-ever browser rows 1,340.30→1,318.25 ms (paired −23.30 ms), ~100 MB lazy catch-up 1,938→1,121 ms (paired −817 ms), viewer heap with eight active watchers 248.62→98.87 MiB (paired −149.73 MiB), batch maximum 63,963 encoded bytes / 64 records and ~148.51 KiB allocation including external bytes. Those measurements precede the final caps and are not presented as new per-layer results. Browser layout and mobile fingerprints are unchanged by the final gateway/test-only edits.

Validation before the migration-number correction: install, generation check, full workspace typecheck, lint, format check and production web build pass. Focused schema (23), mirror range (9), sequence-watch (10), history-window (3), remote recovery (1), failure-class (5) and compatibility/backpressure (4) tests pass one file at a time. Full bun run check:tmp passes at that earlier head: 2,402 passed / 166 skipped / 0 failed, 31,618 assertions across 450 files in 1,367.79 seconds, with clean temp cleanup. The opt-in memory check is skipped in that default run and was separately executed twice as described above. SQL contents and measured runtime behavior are unchanged by the subsequent migration renumbering; post-correction migration/integration checks are recorded separately below.

All four stack layers have green CI at their corrected heads, including every test shard, static checks, builds and artifact uploads. No workflow change or check bypass was needed. Merge the complete stack together, not individual layers.

Post-correction verification at 3de5a12d99cd39e4aefa493b35a949e031e5cb0c: 75 tests passed / 0 failed, 3,367 assertions across 17 focused files, run one file at a time. This includes schema, all migration/upgrade/index files, the staged 0119 → 0121 → 0122 → 0123 upgrade, all range/sequence/failure/diagnostic/backpressure integrations, and the opt-in memory check (773 assertions, fixed tolerances unchanged, scope swap zero). The schema suite also passes all 23 tests at each actual intermediate branch head (mirror and clients), verifying their migration registries independently. Generation, full workspace typecheck, lint, format and production web build pass. The two renamed SQL files are byte-for-byte unchanged. No performance benchmarks were repeated for this numbering correction.

Related: #537

@nixuuu
nixuuu added this pull request to stack #540 November 11, 2026 16:48
@nixuuu
nixuuu force-pushed the feat/thread-range-progress branch 2 times, most recently from 80bb910 to 1b40696 Compare November 11, 2026 17:13
@nixuuu
nixuuu force-pushed the feat/thread-range-progress branch 7 times, most recently from a78c560 to a47fd0b Compare November 11, 2026 23:52
@nixuuu
nixuuu marked this pull request as ready for review November 12, 2026 00:24
@nixuuu
nixuuu force-pushed the feat/thread-range-progress branch from a47fd0b to 948381a Compare November 12, 2026 00:31
@nixuuu
nixuuu force-pushed the feat/thread-range-progress branch from 948381a to 3de5a12 Compare November 12, 2026 00:34
@nixuuu
nixuuu merged commit 3d44197 into dev Nov 12, 2026
11 checks passed
@nixuuu
nixuuu deleted the feat/thread-range-progress branch November 12, 2026 01:03
nixuuu added a commit that referenced this pull request Nov 12, 2026
Defines the incremental thread-sync contract in the Polish
linked-computer and UI API documentation. This is the bottom layer of
the approved stack, based on dev after #537.

The protocol uses a durable, commit-ordered per-thread sequence separate
from transcript seq, epochs, bounded range repair, 64-record / 64 KiB
batches and durable apply before ACK. Client watches use bounded recent
windows, older-history paging and lazy large content. Legacy peers
retain their protocol; peers negotiating ranges never fall back to
whole-thread snapshots.

Stack: docs → mirror/storage (#539) → client watches (#541) →
progress/diagnostics (#543). Final caps and cleanup pass the retention
check twice at fixed tolerances. The accepted performance comparisons
and complete validation status are in #543; those measurements compare
the whole stack, not isolated layers.

Validation: documentation review, clean diff, generation, workspace
typecheck, lint, formatting and production web build pass at stack head.
This layer changes documentation only; its copy audit has no UI text
changes.

Related: #537
nixuuu added a commit that referenced this pull request Nov 12, 2026
…#539)

Linked thread mirrors resume from their durable epoch/sequence after
interruption instead of restarting a whole-thread transfer. Each batch
contains at most 64 records / 64 KiB, carries the home head and exact
remaining count, and receives an ACK only after entities and cursor
commit. Missing ranges are repaired incrementally; the same stream
handles live tail.

Large items carry compact previews and owner-scoped lazy references.
Peers negotiate `thread_ranges_v1`; old peers retain their existing
protocol. New peers never fall back to snapshot replication.
Deterministic source failures pause only the affected thread,
independently of link presence. Failure metadata contains sanitized
reason/code/frame size, without content or exception text.

Migrations 0120 and 0121 add journal/cursors and durable failure
suppression. This layer follows dev's 0119; the client and progress
layers add 0122 and 0123 in order. Source changes and journal
invalidations commit together; bootstrap inserts historical IDs set-wise
and seals bounded public projections. Retry suppression survives
reconnect in PostgreSQL rather than an unbounded heap map; its row holds
at most 512 encoded bytes and a 128-character signature. The publisher
holds one unacknowledged batch per subscription and drops it after ACK
or termination; its waiting map contains scalar cursors/callbacks and
has a 15-second ACK timeout. Active mirror head/cursor metadata is
scalar per mirrored thread and is released with the subscription.

Focused real gRPC checks cover roughly 100 MB of history, interrupted
catch-up after commit/before ACK, durable resume, gap repair, live tail,
exact remaining count, epoch rebuild, owner isolation, unknown fields,
deterministic failure isolation and old/new compatibility. The retention
check additionally verifies suppression across 20 failure/reconnect
cycles at each of 1/10/50 threads. No workflow or artifact requirement
is bypassed.

The earlier accepted full-stack comparison found roughly 100 MB catch-up
at 1,938 → 1,121 ms (paired median −817 ms), at most 63,963 encoded
bytes / 64 records per batch, and about 148.51 KiB batch allocation
including external bytes. Large outputs remain lazy; this is not an
eager 100 MB download. These are full-stack results, not isolated
mirror-layer deltas. Latest bounded-memory, steady sanity and
required-check results are in #543.

Copy audit: no user-facing copy changes in this layer. No maintainer
logs, private hosts, IDs, tokens or content are included.

Related: #537
nixuuu added a commit that referenced this pull request Nov 12, 2026
Web, desktop and mobile open a bounded recent thread window and resume
by durable sequence. Cached messages remain visible through a thread
failure or unreachable home. Thread-scoped Retry / Load from scratch
actions replace global connection errors, and presence changes trigger
automatic recovery.

- Recent windows use one initial request and a 512 KiB public-record
budget, normally 24 turns and at most 128 items. Independent turn/item
paging also bounds a huge single turn. Older pages and full item content
load after initial rows.
- Live batches retain 64-record / 64 KiB limits. Active readers share
pending I/O and scalar heads, with at most eight distinct in-flight
range reads per active thread. Completed batches are not cached.
- Reusable recent windows share a process-wide eight-entry LRU (at most
4 MiB encoded record payload plus object overhead), one pending read per
active thread and normalized page sizes. Invalidation, eviction and
final reader close release references; closed pending reads cannot
repopulate the cache. Metadata queues cap both count (128) and encoded
bytes (64 KiB), with weak size memoization across fan-out.
- Large items expose owner-scoped previews; “Load full item” fetches at
most 48 KiB/request. Deterministic failures get one fresh-window repair,
one smaller-window repair, then a thread error. Healthy link presence
survives watch failures.

Additive protobuf fields and migration 0122. Mobile stays JS/TS only,
with unchanged production fingerprints: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`.

Focused real gRPC/Connect checks pass for sequence watches (10 tests /
1,955 assertions), independent history windows (3), remote
resume/offline recovery (1) and failure classes (5). They cover huge
history/single turns, binary mobile Connect, stale cursors, lazy
content, independent paging, eight simultaneous resumes with
cancellation, direct database edits and bounded repair while unary
works. Final whole-stack validation is in #543.

The first-open bottleneck was historical journal seeding: the SQL trace
drops bootstrap 3,901 → 62 ms and bounded-window reading 3,956 → 118 ms
using set-based historical IDs. A browser trace shows one watch request
and no history/lazy request before rows. Four accepted browser matched
pairs (two ABBA blocks, production builds, fresh contexts) measured
first-ever rows at 1,340.30 → 1,318.25 ms (paired median −23.30 ms).
Eight-viewer heap after GC fell 248.62 → 98.87 MiB (paired −149.73 MiB).
These earlier full-stack comparisons precede the final cache caps; their
focused retention and steady recheck are in #543.

Copy audit (`docs/copy.md` §8): scoped errors name this thread or
computer; actions use Retry / Load from scratch. Unknown items explain
version availability; previews offer “Load full item”. English sentence
case, punctuation and accessible labels checked. Browser review covers
light/dark, desktop/phone widths, short/long labels and reserved
progress space. No raw exceptions, private hosts, tokens or thread
content in diagnostic copy.

Related: #537
nixuuu added a commit that referenced this pull request Nov 12, 2026
The thread header showed a check mark with "0" whenever a thread was
fully synced, which read as an unexplained counter. The indicator now
stays empty when the thread is caught up and only appears while records
are still arriving (with the remaining count) or when sync is paused
(with the reason in the tooltip and accessibility label). Its slot keeps
its reserved width, so nothing moves when it appears.

Fixes: #543
nixuuu added a commit that referenced this pull request Nov 12, 2026
Proxy safe thread panel metadata and worker grants to the home gateway. Persist verified panels for stale reads and include committed mirrors in the paged archive.

Related: #543
nixuuu added a commit that referenced this pull request Nov 12, 2026
nixuuu added a commit that referenced this pull request Nov 12, 2026
Proxy safe thread panel metadata and worker grants to the home gateway. Persist verified panels for stale reads and include committed mirrors in the paged archive.

Related: #543
nixuuu added a commit that referenced this pull request Nov 12, 2026
When a linked computer watches a home gateway, its project ID
translation can change the same live thread row that the home's web and
mobile clients receive. A working worktree thread can then show “Unknown
project” even though its stored placement is correct. Clone each
outbound stream message before translating IDs so local clients keep the
home project ID and the peer receives its global ID.

The source of the problem is `remoteServe`: `create(descriptor,
message)` returns an already typed protobuf message unchanged. Hub
subscriptions share those instances, and `ConfigIds.map` mutates project
references in place. Project alias mapping was introduced in #168; #526
and #539/#541/#543 did not introduce this boundary. Both clients resolve
projects by exact `projectId`, so both are affected. The database
placement and `threadSelect` retain the parent project and joined
worktree; this is an ID rewrite, rather than evidence of a partial
status row. No client merge fallback or cwd-based guess is needed.

The gateway integration regression uses two linked databases with merged
project aliases and a side thread inheriting its parent's worktree. A
real worker holds a turn open while overview updates and a resumed
thread delta arrive. It checks the local/global project IDs and branch
before, during and after work, including an unread update while working.
The branch-over-directory presentation change remains in #545, which
uses the same domain helper on mobile and web.

Validation: scoped `nice -n 19` oxlint and oxfmt checks passed; `git
diff --check` passed. Local installation, typecheck, tests, builds,
fingerprints, browser and render measurements remain deferred at the
maintainer's request while host diagnostics run. GitHub CI will run the
required suite. The local commit hook was skipped using its supported
`SKIP_SIMPLE_GIT_HOOKS` switch because commitlint is not installed in
this worktree and local install is deferred; CI validates the Angular
title.

Copy audit (`docs/copy.md` §8): no UI strings, labels, errors, empty
states or actions changed. The existing “Unknown project” fallback
remains; this fix supplies its correct project reference. Documentation
change is in Polish. No mobile/native dependencies, client subscriptions
or timers changed.

Related: #168
Related: #545
nixuuu added a commit that referenced this pull request Nov 12, 2026
The thread header showed a check mark with "0" whenever a thread was
fully synced. Users read it as an unexplained counter.

- The indicator now stays empty when the thread is caught up.
- It appears only while records are still arriving (arrow icon with the
remaining count) or when sync is paused (warning icon, with the failure
reason in the tooltip and accessibility label, via `threadSyncFailure`).
- The slot keeps its reserved width (`w-16` on web, 64 px on mobile), so
nothing moves when the indicator appears.
- Web and mobile share the new `threadSyncVisible` / `threadSyncLabel`
helpers in `@canopy/domain/thread-sync-display`.

Copy audit (docs/copy.md §8): the only new text is the label "Sync
paused: <reason>", which reuses the existing reason strings. It is
short, specific and in sentence case. No other UI text changes.

Fixes: #543
nixuuu added a commit that referenced this pull request Nov 12, 2026
nixuuu added a commit that referenced this pull request Nov 12, 2026
nixuuu added a commit that referenced this pull request Nov 12, 2026
nixuuu added a commit that referenced this pull request Nov 12, 2026
nixuuu added a commit that referenced this pull request Nov 12, 2026
Proxy safe thread panel metadata and worker grants to the home gateway. Persist verified panels for stale reads and include committed mirrors in the paged archive.

Related: #543
nixuuu added a commit that referenced this pull request Nov 12, 2026
Proxy safe thread panel metadata and worker grants to the home gateway. Persist verified panels for stale reads and include committed mirrors in the paged archive.

Related: #543
nixuuu added a commit that referenced this pull request Nov 12, 2026
Settings → Diagnostics repeated the computer hostname once per mirrored
thread, making dozens of rows indistinguishable. Thread sync now shows
one row per linked computer, using its display name and complete thread
totals. Expanding a row loads only threads that need attention, with
titles, remaining records, pause reasons and links. When reachable
computers are caught up, one calm status replaces the list and zero
counters.

Fixes: #543

The additive RPC returns local computer summaries separately from
bounded attention pages. Every join is owner scoped; message bodies are
never read. A migration records the last committed range time without
inventing historical timestamps. Web and mobile share grouping/status
copy, poll summaries every 5 seconds while visible/foreground, and fetch
detail pages only for expanded computers. Mobile changes are JS-only;
native configuration and dependencies are unchanged. The Diagnostics
page only loses its obsolete subtitle; its layout and other sections are
unchanged.

Validation:
- Generated contracts with `bun run gen`.
- Changed-file oxfmt and oxlint passed at `nice -n 19`.
- Added gateway gRPC integration coverage for aggregation, attention
pagination, failure-only threads, identical computer/thread IDs across
owners, title isolation, message-body exclusion, committed timestamps
and duplicate ranges.
- Rebased on `dev` through #554, including #546 and #547. Resolved the
generated-contract conflict by regenerating the merged proto; `bun run
gen:check` passed again. Migration registry and schema expectations
contain 0124, 0125 and 0126 in order. `bun install` passed locally.
- Latest focused migration run passed: 25 tests / 105 assertions across
`packages/db/test/inherited-access-upgrade.test.ts`,
`packages/db/test/thread-sync-upgrade.test.ts` and
`packages/db/test/schema.test.ts`. The #547 test now checks the
contiguous 0124 → 0125 upgrade before applying later migrations,
preserving every explicit owner choice. Earlier gateway/schema run
passed 26 tests / 157 assertions. The full `check:tmp` was deliberately
left to GitHub CI during the host measurement window.
- Manual Chromium review of the real Settings → Diagnostics route
against an isolated gateway/database with synthetic presence: caught up,
catching up, paused with reason, unreachable; 126 threads across three
computers; long names/titles; light/dark; desktop 1280×800 and phone
390×844. Verified 25+5 attention pagination, qualified thread link
targets, automatic transition to the calm caught-up state, icon
refresh/tooltip and absence of zero counters. Fixed a phone overflow
found during this review. No web UI tests added.
- EAS CLI 27.4.1, production profile: fingerprints match `origin/dev`
exactly on both platforms (iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`). Compared against a clean
archive with its own matching dependency install.

Copy audit (§8):
- Repeated hostname + “Up to date” → display name + “2 of 42 catching up
· 1 paused · 15 records to go”: identifies the computer and actionable
work.
- “Remaining / 0 to go” and “Threads / 0 / 0” → “All threads are up to
date” with last sync time: removes empty metrics.
- Two explanatory descriptions → “Sync with linked computers.”; removed
“Check sync progress without opening thread content.”
- “Refresh” → icon button labelled/tooltipped “Refresh sync status”.
Pause reasons use the existing shared vocabulary; recovery says
“Retrying automatically.” or “Check the linked computer.”
- Reviewed sentence case, length, plurals, glossary, actions, error
recovery and textual status cues. No humour or new glossary terms.
Short, typical and long-name/title layouts checked in Chromium at
desktop and phone widths in light and dark modes.
nixuuu added a commit that referenced this pull request Nov 12, 2026
Proxy safe thread panel metadata and worker grants to the home gateway. Persist verified panels for stale reads and include committed mirrors in the paged archive.

Related: #543
nixuuu added a commit that referenced this pull request Nov 12, 2026
Proxy safe thread panel metadata and worker grants to the home gateway. Persist verified panels for stale reads and include committed mirrors in the paged archive.

Related: #543
nixuuu added a commit that referenced this pull request Nov 12, 2026
Proxy safe thread panel metadata and worker grants to the home gateway. Persist verified panels for stale reads and include committed mirrors in the paged archive.

Related: #543
nixuuu added a commit that referenced this pull request Nov 12, 2026
The same thread now exposes its home connector access and scheduled
tasks from either linked computer. A dedicated display DTO omits
credentials, headers, endpoints and account errors. Connector grants,
schedule creation, edits and cancellation run at home with owner and
revision checks. Worker grants affect every thread on that worker;
inherited All workers and account administration show a compact
home-management hint.

Verified panel responses survive a restart and remain visible as stale
when the home or panel read is unavailable. The archived sidebar now
pages local rows together with committed linked metadata: the previous 7
vs 31 counts came from intentionally local-only archive reads.

The three-gateway move regression now reconnects with a saved thread
cursor and requires a removal from the old home. The runtime exemption
for mirror subscriptions and range acknowledgments is already present in
the rebased dev branch; individual thread operations still follow their
redirects, and ACKs retain peer/subscription/cursor validation.

Gateway-to-gateway regression coverage exercises safe metadata, schedule
create/list/edit/cancel, home enforcement after grant changes, owner
isolation, cached stale reads, restart/unlink and archive
totals/pagination. Mobile changes are JavaScript/TypeScript only; native
configuration and dependencies are unchanged.

Validation:
- `bun install`, `bun run gen:check`, package-db typecheck and
changed-file oxfmt/oxlint passed. No full local `check:tmp` was run, as
requested; CI runs the full checks and test shards.
- Focused gateway-to-gateway panel tests, schema and upgrade tests
passed. The three-gateway move regression passed 20 consecutive runs.
After rebasing onto migration 0126, the panel/schema/inherited-access
tests passed; the staged sync upgrade exposed an ordering assumption,
was repaired and passed its focused rerun (17 assertions).
- Real-browser review used two linked gateways in light/dark at desktop
and phone widths. Both views show Connectors and Scheduled tasks. Remote
grant revoke/restore was reflected at home; remote schedule
create/edit/cancel worked. Disconnecting home retained connectors and
schedules with explicit stale/unreachable text and disabled actions.
Both archive counts were 38 (7 + 31), including offline. Short, typical
and long labels remained readable without horizontal overflow; removed a
duplicate offline hint that compressed schedule rows on phones.
- Native fingerprints match the tested dev base (`a79d316c`) for both
platforms: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Mobile changes remain JS/TS
only. Subsequent rebases include JS/TS-only mobile changes from dev;
fresh CI runs on the final head.

Copy audit (§8): hidden sections → visible Connectors and Scheduled
tasks; Manage → scoped connector-access dialog with “Changes apply to
every thread on this worker.” This states the grant's actual scope.
Stale metadata → explicit last-known-details status; account-wide
changes → “Manage accounts on <computer>”. New actions use verbs,
sentence case and text status cues; no humorous copy. Existing controls
provide keyboard/focus behavior and name truncation. Browser review
covered short, typical and long names in light/dark at desktop and phone
widths, including offline states and dialog scrolling.

Related: #543, #539

Migration coordination: rebased onto `580a4815`, including #562 = 0124,
#547 = 0125, #560 = 0126 and #557 = 0127. This PR registers
`0128_thread_panel_cache`; the loader and schema expectations list 0124
through 0128 in order. The staged thread-sync upgrade test reads the
migration tail dynamically after the explicit 0126 stage, including 0127
and 0128, checks that durable sync state survives, and verifies that
repeating the full migration is a no-op. It does not assume 0128 is the
latest migration. Focused schema and staged/inherited-access upgrade
tests passed again after this rebase (25 tests, 107 assertions); all 6
remote-panel integration tests also passed (63 assertions). `bun
install` and `gen:check` passed. An initial panel test launch resolved a
workspace package to another checkout; refreshing installation corrected
the local alias before the successful rerun.
nixuuu added a commit that referenced this pull request Nov 13, 2026
…#505)

**Draft — Stage 1 gate accepted by the maintainer; the six-stage stack
remains draft.** The accepted decision uses CPU median deltas ≤0.33 pp,
RPC p95 within ±0.5 ms and startup readiness +0.39 MiB. Remaining
approximately +12 MiB RSS medians in pool-contention/post-restore were
accepted within measured RSS noise (pair range −240…+18 MiB). Stage 2
must not increase those budgets. Historical runs/exclusions below remain
evidence, not a newly repeated Stage 1 gate.

## Stage 1

Current stack base: dev `968757a4c`. Migrations 0124–0128 are already
merged, so Stage 1 is **0129_diagnostics** (registry, schema and
sync-upgrade references updated). Stages 2–3 add no migration; Stage 4
follows with 0130 and Stage 5 with 0131. Contracts stay additive and
`update/v1` remains untouched. The stack reuses #574's shared
`additional_capabilities` field and handshake implementation, replacing
its independently implemented extension field; production legacy-peer
integration passes. Stages 2–3 overhead gates are also accepted; their
focused governor/series GC test is recorded in #535. All six stages are
implemented; the entire stack stays draft while final current-head CI
runs, then will be marked ready together as requested by the maintainer.

Settings → General → Diagnostics shows this computer and every linked
computer on web/desktop and mobile: freshness, offline saved data,
unsupported/denied states, link and RPC findings, sortable/paged RPC
rows and drill-down, and 1 min / 15 min / 1 h / 24 h windows.

- Descriptor-allowlisted RPC lifecycle metrics use 128 fixed duration
buckets, counts/rates, final codes, current/peak in-flight, stream
lifetime/first-message/message classes, and existing encoded payload
sizes where available. Public RPC payload sizes remain **Not measured**:
no existing-byte hook exists, and messages are never re-encoded to count
bytes.
- Worker/computer heartbeat echoes measure monotonic RTT/jitter
separately from heartbeat age/interval. Older versions remain usable and
visibly unsupported.
- Reads are owner-scoped. Direct and one-relay reads use
capability/onward grants, revoke/cache invalidation, shared background
gathering and bounded traffic/memory. Metrics never contain prompts,
paths, payloads, free-form errors or request-derived method labels.
- Lightweight aggregates, findings, session checkpoints and last-known
peer overviews persist off the request path, with atomic retry/dedupe,
restart gaps and existing retention leases.

Stack: [#495](#495) →
[#505](#505), [stack
#506](Stack #506). No merge is
performed by this handoff.

## Rebase and migration

The full diagnostics stack was rebased onto `origin/dev`
**`3d44197868b9c42eec317dcc3bf5903841e6e582`**, including incremental
sync #538/#539/#541/#543. Documentation head:
`7ef043e411b13d310111a90362b63de55175d2b7`; Stage 1 head:
**`ed0dc6509914499ec3812df7a1f1341266809fcb`**. Branches were
force-pushed with leases through `gh stack`. Bases remain #495 → `dev`,
#505 → `docs/diagnostics`; #535 and #542 continue above this PR.
Current-head full CI is green. Historical Stage 1 measurements below
retain their original revisions.

Dev includes migrations 0120–0124; concurrent PRs reserve 0125–0128.
Diagnostics uses **`0129_diagnostics.sql`**, with index/schema
expectations and the sync→diagnostics upgrade test updated. Stages 2–3
add no migration; Stage 4 follows with 0130. Draft numbers may still
need renumbering if dev advances. Additive GitHub/sync/diagnostics
contracts were regenerated; frozen `update/v1` is unchanged. The
allowlist/page-offset ceiling remains **512** and fixed collector
budgets remain unchanged.

## Memory and restore redesign

The original dense design had a real regression: approximately +140–160
MiB startup VmHWM, 1.3–6 s wall restoration, and +50–100 MiB
reconnect/write-failure RSS. Earlier CPU/p95 deltas changed sign under
heavy host swapping and cannot establish acceptance. The previous
resource-only run also had idle RSS +17.50 MiB and one post-restore peak
+13.83 MiB; those findings motivated the current controlled rerun and
are not erased.

- Histograms contain sorted nonzero bucket indices/counts in memory and
packed-varint protobuf fields on disk. Aggregate merges reuse buffers
without protobuf copies per merge.
- Keep the short live ring, current minute plus the last 60 minutes, and
incremental 15 m / 1 h closed-minute aggregates. Restored/live rings
remain separate for session dedupe. Cache admission failure uses direct
merging.
- The listener becomes ready before background restore; RPCs never await
it. Only the last hour of minute rows is restored in eight-row pages.
Incoming reports queue within a bound until persisted dedupe watermarks
load.
- The owner-scoped 24 h query uses hourly rows, a shared 5 s cache, and
the current hour from memory. At most one completed hour falls back to
at most 60 minute rows after a crash. View allocation is capped at 1
MiB.
- Hourly downsampling/replacement shares the atomic minute/state batch,
including retries and late minutes. Minute retention is **2 h** (quota
180 including maintenance grace); hourly retention **30 days** (quota
720). Collection has a 6 MiB method budget and 2 MiB link budget, 16
measured partners and 32 cached peer overviews. Dropped/limited coverage
is explicit.

`docs/diagnostics.md` and `docs/database-retention.md` document the
final retention, limits and size estimates, replacing 72 h of dense
in-memory minute history. No UI copy changed in this follow-up.

## Verification after rebase

Passed: `bun install`, `bun run gen`, `bun run gen:check`, full `bun run
typecheck`, root lint, format check and the web build. Ignored stale
Expo route types were regenerated with an isolated local Metro process,
then that process was stopped; no mobile source workaround was added.

Focused files ran serially:

| File | Tests | Assertions |
| --- | ---: | ---: |
| `packages/db/test/schema.test.ts` | 23 | 85 |
| `tests/integration/diagnostics-hourly.test.ts` | 4 | 23 |
| `tests/integration/diagnostics.test.ts` | 6 | 45 |
| `tests/integration/diagnostics-history.test.ts` | 11 | 76 |

Coverage includes bounded last-hour restore, owner-scoped hourly reads,
atomic replacement/dedupe, rolling expiry, responsive RPCs during locked
historical storage and reports arriving during restore. The integration
suite also covers three real gateways/workers with a relay, owner
denial/revoke, offline/older versions, no recursive gather, stream
cleanup, histogram/count dedupe, RTT versus heartbeat, limits, restart
continuity/gaps, failed-write retry, retention/downsampling and
concurrent pruning.

The requested **one fresh full `check:tmp` after all measurement/profile
processes stopped passed on this exact head**: **2383 pass, 165 skip, 0
fail**, **29,261 assertions**, **2548 tests across 443 files**,
**1372.23 s**. Command:
`TMPDIR=/var/tmp/canopy-diagnostics-1/sparse/checktmp-4b86ae4d bun run
check:tmp --max-concurrency 1`. Exit 0; `check:tmp: nothing left in the
temp dir`. The runner noted tool-owned caches excluded by its policy,
then removed its private tree; the parent scratch directory is empty.
The checkout remains clean at the measured SHA. Log:
`/var/tmp/canopy-diagnostics-1/sparse/checktmp-4b86ae4d.log`. No
production/test source was changed during this run, and the full suite
was not repeated.

Historical GitHub snapshot (2026-11-11): **CI green on both layers**,
including static checks/commitlint and the aggregate
typecheck/tests/builds job. #505 passed all four test shards and
web/Linux builds; docs-only #495 correctly skipped those matrix jobs. No
submitted reviews or review decision. Both PRs remain draft until the
complete stack is verified. Runs: [#495
CI](https://github.com/itsoltech/canopy/actions/runs/42943020455), [#505
CI](https://github.com/itsoltech/canopy/actions/runs/42943019335).

## Controlled overhead measurement

**Historical recording: 3 of the requested 5 pairs completed. Stage 1's
gate was subsequently accepted by the maintainer as stated at the top.**
The unchanged runner stopped with exit 1 after all three attempts at
pair 4 crossed the requested swap-out gates. Pair 5 never started.
Results below preserve medians/ranges of only those three eligible whole
pairs, rather than implying a five-pair run. Both PRs remain draft as
part of the unfinished stack.

Memory also remains open: steady RSS reached **+13.05 MiB** in accepted
pair 2, despite a three-pair median of +7.08 MiB; post-restore restart
VmHWM uplift reached **+14.26 MiB**. Pool-contention RSS median was
+12.48 MiB. These observations are retained; favorable CPU/p95
observations do not override memory or the missing pairs.

Protocol: five alternating off/on, on/off, off/on, on/off, off/on pairs
(ABBA blocks), each process warmed with 300 reads plus 5 s. Every member
has 10 min idle and 140 s each steady, reconnect, slow reader, write
failure and pool contention. Four lanes offer 20 GetThread/s; the
slow-reader fixture adds four update lanes and eight paused watches.
Overview reads use 15 min; detail reads use 24 h every 10 s, exceeding
the 5 s cache TTL. Each member starts with equivalent fresh private
databases: 120 minute + 720 hourly sparse rows, 24 methods, four nonzero
duration buckets and actual coverage timestamps; seeded payload
**1,115,520 bytes**.

Gateway, worker, PostgreSQL and driver are pinned to separate physical
cores (2/3/4/1). `nice -n -5` is denied, so affinity-only fallback is
used. Own ports 18191/18192; no existing stack or global caches were
changed. No builds/tests or forced GC ran alongside accepted
measurements. New processes reset their own runtime caches and warm
their own data.

Before every attempt: loadavg and 30 s preflight. Continuous `vmstat -w
-S K 1` ignores the first since-boot row; `/proc/vmstat` and actual
4096-byte pages enforce cumulative output. Reject swap-out ≥128 KiB/s in
any sample or ≥1 MiB cumulative; swap-in ≥1024 KiB/s or ≥128 KiB/s for
three consecutive seconds; load above 12 logical CPUs. Small old-page
reads are allowed and logged. Rejected whole attempts are excluded, with
at most three attempts per pair; no thresholds were relaxed.

Acceptance: paired CPU median delta <1 percentage point of one core; RPC
p95 median delta <max(1 ms, 10% baseline); startup/steady RSS uplift ≤10
MiB. Also report synchronous startup diagnostics CPU (<100 ms),
background restore separately, and full-history p95 (<50 ms).

### Host eligibility and exclusions

| Pair / attempt | Accepted | Max load | Swap-in peak KiB/s | Swap-in
bytes | Swap-out peak KiB/s / bytes | Reason |
| --- | --- | ---: | ---: | ---: | ---: | --- |
| 1 / 1 | No | 1.45 | 2476 | 3,760,128 | 0 / 0 | Input rate |
| 1 / 2 | No | 0.20 | 4544 | 4,784,128 | 0 / 0 | Input rate |
| 1 / 3 | **Yes** | 1.23 | 792 | 1,863,680 | 0 / 0 | Allowed old-page
reads; longest ≥128 KiB/s streak 1 s |
| 2 / 1 | No | 0.92 | 5668 | 6,828,032 | 0 / 0 | Input rate |
| 2 / 2 | **Yes** | 0.80 | 160 | 655,360 | 0 / 0 | Allowed reads; streak
1 s |
| 3 / 1 | **Yes** | 0.79 | 48 | 663,552 | 0 / 0 | Allowed reads; streak
0 s |
| 4 / 1 | No | 0.68 | 244 | 385,024 | 792 / 811,008 | Output rate |
| 4 / 2 | No | 0.66 | 60 | 262,144 | 2200 / 2,580,480 | Output rate and
total |
| 4 / 3 | No | 0.87 | 676 | 937,984 | 2172 / 2,682,880 | Output rate and
total; retry limit reached |

Each accepted pair contains both members and all six phases (18 verified
complete phase/pair groups). Each has 2672 one-second host samples.
Accepted keys are **1/3, 2/2, 3/1**; all rows from other attempts are
excluded, including their completed on phases. No pair 4 data are
spliced into pair 5 or the medians.

Pair 4's output bursts occurred around the transition into the disabled
member. The host counters do not identify which process owned those
pages; this report does **not** attribute them to other agents or prove
an external cause.

### Preliminary paired deltas, median [min, max], n=3

CPU is percentage points of one core; all differences are on minus off.
RPC baselines were below 10 ms, so the requested p95 threshold is 1 ms
in every measured phase. Idle issues no application reads. History p95
is the enabled 24 h view including database/transport, with 14 reads per
loaded phase/member.

| Phase | Gateway CPU pp | RPC p95 ms | RSS MiB | Enabled 24 h p95 ms |
| --- | ---: | ---: | ---: | ---: |
| Idle | +0.0127 [0.0077, 0.0170] | — | +5.74 [3.07, 8.78] | — |
| Steady | +0.2676 [0.1319, 0.3261] | −0.030 [−0.467, 0.435] | +7.08
[−2.13, **13.05**] | 25.334 [22.614, 27.338] |
| Reconnect | +0.2345 [0.2009, 0.3327] | +0.208 [−0.175, 0.301] | +6.35
[2.68, **11.68**] | 12.550 [11.853, 14.823] |
| Slow reader | +0.1275 [0.1225, 0.1868] | +0.120 [−0.736, 0.184] |
+3.82 [−25.05, 7.33] | 19.789 [12.405, 22.396] |
| Write failure | +0.0471 [−0.1152, 0.0951] | +0.135 [−0.030, 0.331] |
+9.21 [−240.37, **12.96**] | 11.319 [9.789, 12.455] |
| Pool contention | +0.0545 [−0.1950, 0.0695] | +0.263 [−0.034, 0.287] |
**+12.48** [4.25, **17.86**] | 18.999 [18.103, 23.030] |

Large negative RSS deltas are preserved: in pair 1 the disabled process
still held 422.67 MiB after the slow-reader phase at the write-failure
sample, versus 182.30 MiB enabled. These are raw RSS endpoints with
normal GC, not retained heap or proof of memory savings. No forced GC,
trimming, outlier removal or favorable-pair selection enters this table.
Offered GetThread traffic completed 2804 calls/member/loaded phase,
except 2805 disabled slow-reader calls in pair 1; reconnect completed 27
reconnects/member/phase. Eight paused watches and about 2800 updates ran
in each slow-reader phase.

| Pair | Phase | Δ CPU pp | Δ RPC p95 ms | Δ RSS MiB |
| --- | --- | ---: | ---: | ---: |
| 1 | Idle | +0.0127 | — | +5.74 |
| 2 | Idle | +0.0170 | — | +8.78 |
| 3 | Idle | +0.0077 | — | +3.07 |
| 1 | Steady | +0.2676 | −0.030 | +7.08 |
| 2 | Steady | +0.1319 | +0.435 | **+13.05** |
| 3 | Steady | +0.3261 | −0.467 | −2.13 |
| 1 | Reconnect | +0.3327 | +0.208 | +2.68 |
| 2 | Reconnect | +0.2009 | −0.175 | **+11.68** |
| 3 | Reconnect | +0.2345 | +0.301 | +6.35 |
| 1 | Slow reader | +0.1868 | +0.120 | −25.05 |
| 2 | Slow reader | +0.1275 | +0.184 | +7.33 |
| 3 | Slow reader | +0.1225 | −0.736 | +3.82 |
| 1 | Write failure | +0.0471 | −0.030 | −240.37 |
| 2 | Write failure | −0.1152 | +0.331 | **+12.96** |
| 3 | Write failure | +0.0951 | +0.135 | +9.21 |
| 1 | Pool contention | −0.1950 | +0.287 | +4.25 |
| 2 | Pool contention | +0.0545 | −0.034 | **+12.48** |
| 3 | Pool contention | +0.0695 | +0.263 | **+17.86** |

Steady raw baselines (CPU %, RPC p95 ms, RSS MiB), off → on: pair 1
**2.4037 → 2.6713; 2.939 → 2.909; 163.68 → 170.77**; pair 2 **2.4275 →
2.5594; 2.973 → 3.407; 161.37 → 174.42**; pair 3 **2.2916 → 2.6177;
3.481 → 3.015; 164.35 → 162.23**.

### Startup and restart continuity

VmHWM is the Linux process-image high-water mark. Startup is sampled at
readiness; background restore is reported separately. Restart peaks
compare to that pair's disabled startup baseline, not to an unrelated
process. Each enabled member has three fresh-process restarts.

| Pair | Startup VmHWM off / on MiB | Δ startup MiB | Initial
post-restore Δ MiB | Max restart ready Δ MiB | Max restart post-restore
Δ MiB | Sync startup CPU on ms | Restart background CPU ms (three) |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | --- |
| 1 | 143.41 / 143.80 | +0.39 | +6.58 | +3.80 | **+14.26** | 0.929 |
86.451, 75.190, 76.820 |
| 2 | 143.42 / 141.99 | −1.43 | +5.48 | +3.04 | **+11.73** | 1.547 |
50.276, 51.827, 72.785 |
| 3 | 142.74 / 144.63 | +1.89 | +7.75 | +1.50 | **+12.75** | 0.938 |
58.646, 71.747, 82.577 |

Initial readiness VmHWM paired delta median **+0.39 MiB [−1.43,
+1.89]**; initial post-restore delta median **+6.58 MiB [+5.48,
+7.75]**. Max restart post-restore paired uplift median **+12.75 MiB
[+11.73, +14.26]**. Initial synchronous CPU median **0.938 ms [0.929,
1.547]**; maximum across initial starts and all nine restarts **2.439
ms**. Initial background inclusive CPU is **44.902 / 58.202 / 45.679
ms**; restart intervals are **50.276–86.451 ms**. These include
concurrent work in the process and are not isolated restore-function
CPU. Initial background wall intervals are **46.641 / 59.691 / 47.304
ms**; no 72 h startup scan occurs.

Raw startup heap off/on MiB: **22.24/23.30**, **56.79/16.26**,
**16.33/23.35**. Different GC phases make these unsuitable as
retained-memory deltas. Ring/link accounting immediately after restore
is **2,578,368 bytes** in each enabled member and **0** disabled; after
steady it is **2,280,512–2,322,048 bytes**. This counter excludes
rolling-window budgets, hourly-view/snapshot caches and runtime
overhead; it is not total retained memory or RSS.

### Worker, PostgreSQL and event loop

| Phase | Worker Δ CPU pp median [min,max] | PostgreSQL Δ CPU pp median
[min,max] | Gateway Δ loop p99 ms median [min,max] |
| --- | ---: | ---: | ---: |
| Idle | +0.0091 [0.0038,0.0107] | +0.0073 [−0.0020,0.0118] | +0.0013
[−0.0018,0.0090] |
| Steady | +0.0034 [0.0002,0.0101] | +0.0311 [−0.0446,0.0351] | +0.0041
[−0.0031,0.4337] |
| Reconnect | +0.0038 [−0.0030,0.0118] | +0.0412 [0.0017,0.0663] |
+0.0379 [−0.1326,0.4869] |
| Slow reader | +0.0031 [−0.0000,0.0093] | +0.0012 [−0.1739,0.1358] |
+0.1085 [0.0655,0.1884] |
| Write failure | +0.0024 [0.0017,0.0141] | +0.0380 [0.0047,0.1191] |
−0.0701 [−0.2673,0.1623] |
| Pool contention | +0.0054 [0.0038,0.0083] | +0.0276 [−0.1164,0.0292] |
−0.2550 [−0.2785,−0.0896] |

Enabled gateway event-loop p99 ranges from 0.460 to 1.816 ms across
measured phases. Worker RSS samples are 73.80–77.13 MiB. Write-failure
fixtures held the diagnostics table for 70 s: enabled persistence
changed `unavailable` → `saved` with zero pending minutes afterward in
every accepted pair. Pool contention showed nine blocked gateway
connections; recovered persistence remained `saved`, with zero pending
minutes.

### Persisted writes and bytes/hour

One mutation batch/minute means **60 scheduled batches/hour per
process**, with more tuple changes inside the batch. Counts below are
diagnostics table inserts/updates, **not batches**. Hour
replacement/compacted flags, seeded compaction and retry recovery create
bursts, so extrapolating a 140 s phase is not a normal long-run write
count. Disabled timed tuple-change rates were zero. Bytes are paired
deltas of **whole private PostgreSQL WAL/NVMe cgroup I/O**, including
maintenance/checkpoints and application interactions; they are not
isolated payload bytes. Negative deltas are preserved. Device 259:0 is
NVMe; zram device 253:0 is excluded from disk-write columns.

| Phase | On tuple changes/h median [min,max] | Δ WAL KiB/h median
[min,max] | Δ NVMe KiB/h median [min,max] |
| --- | ---: | ---: | ---: |
| Idle | 120.0 [120.0,485.9] | +573.8 [314.3,895.1] | +5062.6
[4823.2,5087.1] |
| Steady | 154.1 [102.7,385.1] | +896.1 [160.7,4472.4] | +5853.0
[5440.6,11500.4] |
| Reconnect | 102.7 [102.7,462.1] | +883.4 [874.5,1250.8] | +6336.3
[5454.6,7889.4] |
| Slow reader | 102.7 [102.7,153.9] | +1268.5 [−178.2,2817.8] |
+379849.8 [177096.6,439206.6] |
| Write failure | 77.0 [76.9,1665.4] | +1214.0 [−1048.8,2399.2] |
−4087.3 [−5537.0,11009.2] |
| Pool contention | 102.6 [102.5,153.8] | +1502.8 [−459.6,3442.3] |
+13391.0 [10689.2,13893.7] |

| Pair | Phase | On tuple changes/h | Δ WAL KiB/h | Δ NVMe KiB/h |
| --- | --- | ---: | ---: | ---: |
| 1 | Idle | 120.0 | +314.3 | +5062.6 |
| 2 | Idle | 485.9 | +895.1 | +4823.2 |
| 3 | Idle | 120.0 | +573.8 | +5087.1 |
| 1 | Steady | 102.7 | +160.7 | +5440.6 |
| 2 | Steady | 154.1 | +896.1 | +5853.0 |
| 3 | Steady | 385.1 | +4472.4 | +11500.4 |
| 1 | Reconnect | 462.1 | +1250.8 | +7889.4 |
| 2 | Reconnect | 102.7 | +874.5 | +5454.6 |
| 3 | Reconnect | 102.7 | +883.4 | +6336.3 |
| 1 | Slow reader | 153.9 | +2817.8 | +379849.8 |
| 2 | Slow reader | 102.7 | −178.2 | +177096.6 |
| 3 | Slow reader | 102.7 | +1268.5 | +439206.6 |
| 1 | Write failure | 77.0 | +2399.2 | −5537.0 |
| 2 | Write failure | 1665.4 | +1214.0 | −4087.3 |
| 3 | Write failure | 76.9 | −1048.8 | +11009.2 |
| 1 | Pool contention | 102.5 | −459.6 | +10689.2 |
| 2 | Pool contention | 102.6 | +3442.3 | +13391.0 |
| 3 | Pool contention | 153.8 | +1502.8 | +13893.7 |

`persistedBytesPerHour` in raw data is **net retained rollup payload
growth**, sometimes negative under retention. It is not bytes written
and is not substituted for WAL/I/O above. Seeded diagnostics table bytes
at startup are 1,490,944–1,499,136 plus 139,264 index bytes; measured
enabled phases reach 1,581,056 table bytes and 147,456 index bytes.
Logical payload after loaded phases is about 1.10 MB (1.05 MiB; see raw
counters), despite restoring only the last hour.

### Profile-backed remaining memory cost

A separate **nonacceptance** off/on control used the same production
revision with CPU/heap profiling enabled, 120 s idle +140 s steady,
realistic history and uncached 24 h reads. Only the benchmark
launcher/entry received temporary profiling hooks. They were restored
exactly to HEAD before the fresh full test. Profiles add their own
substantial memory overhead; their RSS/timing is not substituted into
the accepted-pair table. GC was forced only at shutdown in this control,
outside all accepted measurements.

The complete enabled heap profile has **1509 `Aggregate` objects, 6039
`Histogram` objects, 3018 `BigUint64Array` counter arrays**, and
**32,071 ordinary arrays versus 19,658 disabled**. `Aggregate` allocates
two fixed counter arrays and four histogram objects; each histogram owns
two sparse arrays. The 12,413 additional ordinary arrays and object
fan-out remain a concrete retained cost of the last-hour ring and its
views, even though dense histogram bins and 72 h restore are gone.
Enabled `FunctionCodeBlock` count is **1931 versus 1707** disabled;
their displayed self sizes are about 5.3 versus 4.7 MiB. These type
retained sizes overlap, so they are not summed.

| Qualitative profile control | Off | On | Difference |
| --- | ---: | ---: | ---: |
| Heap used after explicit full GC before shutdown, MiB | 79.21 | 84.61
| +5.40 |
| RSS after that GC, MiB | 193.25 | 199.58 | +6.33 |
| JSC reserved heap capacity after GC, MiB | 101.91 | 104.30 | +2.39 |
| Complete heap at exit after cleanup, bytes | 53,031,380 | 55,844,643 |
+2,813,263 |
| Ring/link budget accounting, bytes | 0 | 2,584,816 | +2,584,816 |
| Additional rolling-window accounting, bytes | 0 | 165,024 | +165,024 |
| Historical view series / pending payload bytes | 0 / 0 | 24 / 0 |
Bounded; no pending-write accumulation in this control |

The CPU profile identifies rolling-window refresh (`windows.ts`), sparse
count updates/aggregate merges and worker catalog work among added
diagnostics frames. Profile percentages/wall-weighted times are
qualitative; process CPU counters above determine the gate. The profiles
support focusing further memory work on the aggregate/histogram/counter
object layout and runtime/GC capacity. They **do not prove the cause of
the entire +13.05 MiB steady or +14.26 MiB restart RSS uplift**, nor
establish a leak or a memory pass. No further production change or
favorable remeasurement is hidden in this report.

Private profile evidence:
`/var/tmp/canopy-diagnostics-1/sparse/profile-4b86ae4d/`, including
`Heap.20261111.072510.2706275.0.003.md` (off),
`Heap.20261111.072944.2709361.0.003.md` (on), corresponding CPU
profiles, and `memory-2706275-7.json` / `memory-2709361-7.json`.
`instrumentation.patch` records the temporary hooks; no profile artifact
is committed.

### Row sizes and exact payload-write accounting

A separate resource-only exercise (`acceptance:false`, no timed
workload) records current-head row sizes and uses audit triggers only
after sampled processes stop. Fixture minute payload/tuple sizes are
**1184 /1253 bytes**; an uncompressed hourly fixture is **1352 /1421
bytes**. After compaction, hourly payloads range **1352–2100 bytes**
while physical tuple sizes range **368–1421 bytes** due to compression;
logical and physical sizes are separate measures. After the enabled
close, retained rows were 121 minute rows /141,496 payload bytes and 719
hour rows /972,836 bytes. Table/index sizes above come from actual timed
processes, not this audit.

Sixty synthetic minute calls through the real store issue **60 actual
mutation batches**. This deliberately exercises late minutes in one
already-completed hour, replacing that hourly row 60 times; it is **not
normal elapsed-hour timing or a 24-method production write-rate
estimate**.

| Mutation class | Tuple changes | Sum of NEW payload bytes written |
| --- | ---: | ---: |
| Minute rollups | 60 | 5700 |
| Hourly replacements | 60 | 6480 |
| State checkpoints | 60 | 2400 |
| **Total** | **180** | **14,580** |

This sum includes overwritten hourly payloads. The final retained
payload is only **5700 minute +108 hourly bytes**; it is explicitly not
reported as total bytes written. The byte sum excludes tuple/index/WAL
overhead; whole-database WAL/I/O measurements are reported separately
above. Evidence:
`/var/tmp/canopy-diagnostics-1/sparse/resources-4b86ae4d.{jsonl,log}`
and `profile-4b86ae4d/storage-instrumentation.patch`. The temporary
row/trigger instrumentation was restored before the full test; private
containers were removed.

Evidence:
`/var/tmp/canopy-diagnostics-1/sparse/measure-20261111T020059Z/`
(`results.jsonl`, `stderr.log`, recorded head/runtime/topology).
Repeatable wrapper:
`/var/tmp/canopy-diagnostics-1/sparse/run-five-pairs.sh`; instructions:
`/var/tmp/canopy-diagnostics-1/sparse/README.md`. Artifacts are not
committed.

## Browser, mobile and copy audit

Historical real-browser checks used three seeded computers (offline
saved metrics and older/unsupported included), long computer/method
names, many methods, sorting/pagination, unary/stream drill-down and
quiet/empty states. Light/dark, desktop/narrow/390 px phone were
inspected. No UI source changed in this follow-up; no new browser pass
is claimed after this rebase.

Screenshots remain uncommitted under `/var/tmp/canopy-diagnostics-1/`:
`desktop-{light,dark}.png`, `narrow-{light,dark}.png`,
`phone-{light,dark}.png`, `rpc-table-light.png`,
`rpc-details-{desktop,phone}.png`, `rpc-stream-details-phone.png`,
`quiet-desktop-light.png`, `quiet-phone-dark.png`,
`empty-desktop-light.png`, `empty-phone-dark.png`,
`rebased-desktop-{light,dark}.png`, `rebased-phone-{light,dark}.png`,
**`final-desktop-{light,dark}.png` and `final-phone-{light,dark}.png`**.
The last overview checks were 1440×1000 and 390×844 with no horizontal
overflow; full drill-down was not repeated after those rebases.

Copy audit (`docs/copy.md` §8): General → Diagnostics matches settings;
actions View calls / Show details / Retry / Allow. Short text
distinguishes loading, offline saved data, unsupported, denied,
insufficient coverage and no calls. **Not permitted** and **Not
measured** describe limits honestly; mobile gap text uses
singular/plural forms. Details disclose histogram quantization, exact
max and small p99 samples. Long names wrap/truncate without moving
controls; statuses use text and color. No UI tests/copy artifacts added.
The redesign leaves this copy unchanged.

Original EAS CLI 27.4.1 production fingerprints were unchanged: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Stage mobile changes are JS
only; this follow-up adds no native source changes. Native visuals
remain unverified because device support failed twice, including the
advised refresh. No native diagnostics screenshot/parity pass is
claimed.

Earlier mobile verification: Expo Doctor 20/20, diagnostics modules'
scoped ESLint, and Android/iOS JS/Hermes exports passed. App-wide Expo
ESLint had 42 errors/5 warnings outside diagnostics. Disposable CNG
prebuild failed during Android image generation (`Could not find MIME
for Buffer <null>`); no native config/assets changed. No APK/IPA build
or publication attempted. Logs remain at
`/var/tmp/canopy-diagnostics-1/mobile-export-{android,ios-retry}.log`
and `mobile-export-{android,ios}/`.

## Remaining scope

**Keep #495 and #505 draft.** The maintainer accepted Stage 1's gate as
stated at the top. Historical run limitations and memory findings above
remain evidence; they are not pending gate failures. No `gh pr ready` or
merge was performed. The remaining stages must be completed and verified
before the stack can be made ready.

Later stages cover process resources/event loop/SQL/pool/governor,
broader worker/sync diagnostics, client aggregates/reports, log export
and tracing. Multi-instance live merging is future work; persisted
process/session identity is retained. Client FCP/TTI, independent
wire-byte accounting and operation-isolated maintenance cost remain
unmeasured. Public RPC payload sizes require an existing-byte hook.
Native visual parity still needs working device support.
nixuuu added a commit that referenced this pull request Nov 13, 2026
Stage 2 adds gateway health to Settings → Diagnostics: event-loop
p50/p99/max, CPU/RSS/heap, pool pressure, named slow SQL families,
ingest/outbox/watch queues and process-governor admissions/waits/drops.
Web/desktop and mobile expose the same details; RPC drill-down
correlates local SQL reserve, execute, release and transaction timings.

### Whole-stack manual QA — 2026-11-12

Reviewed on top of stage 6 at desktop, narrow and phone widths in
light/dark, with long computer/worker names and
online/offline/unsupported data. Fixed the DB-family disclosure border
to use the semantic `border-divider` token; RPC details now use the same
short histogram explanation as the main sections on web and mobile.
Phone tables fit without horizontal overflow; p99 stays bounded by max,
uptime has Last only, and the fixture had over 95% named-family
coverage. Existing performance acceptance is unchanged.

Copy audit (§8): removed the obsolete repeated quantization paragraph in
RPC details in favour of the existing shared explanation; no new term or
action. Numbers remain tabular, unavailable values explicit, and
light/dark contrast follows kit tokens. Install, generation check, full
typecheck, lint, format and web build passed after the fixes.
Screenshots/check evidence: `/var/tmp/canopy-diagnostics-6/qa/` (not
committed).

**Overhead gate accepted by the maintainer; the stack remains draft.**
CPU medians are at most approximately +0.35 pp; p95 is nonpositive or
within the A/A envelope in every phase. All-pairs memory medians are at
most +6.5 MiB RSS / +3.9 MiB heap across stages 2–3. The governor
sensitivity view is interpreted against the pre-existing A/A GC jumps in
#544, with the deterministic bounds test below completing the
maintainer's condition.

Stack #506: #495 → #505 → #535 → #542 → stage 4, rebased onto dev
`f7ad51cc`. Migrations 0124–0128 are reserved by concurrent work; Stage
1 now uses **0129_diagnostics**, including index/schema/upgrade tests.
Stages 2–3 add no migrations. Thread-sync diagnostics from #543 are
integrated, not duplicated. Contracts are additive, generated code is
committed and update/v1 remains untouched. Measurements below retain
their original measured heads; this rebase was not remeasured.

### Deterministic governor/series memory bound

`tests/integration/diagnostics-memory.test.ts` runs the real governor
and SQL-family collector in an isolated Bun child: 40 families × 4 SQL
phases × 8 RPC correlations, saturated queues,
admissions/cache/join/drop/cancel, five warmup cycles followed by twenty
cycles of 72 fake minutes. Each sample follows two full GCs. **175
assertions passed**: 6 MiB collector / 1 MiB internal measurements / 512
KiB SQL sub-limit, expired rolling slots, no queued/active work at
checkpoints, and increasing explicit drops under pressure.

Post-GC heap: **15,783,235 → 15,863,231 bytes (+0.0763 MiB)**. Retained
Measure objects: **2649 → 2625**; Histograms **1539 → 1545**; total
objects **22,392 → 22,374**. The test checks a plateau across all
samples, not just endpoints. No full bench was run for this condition.

### Bounds and privacy

- Gateway instrumentation stays inside Stage 1's **6 MiB collector**,
**512 KiB transient merge**, **1 MiB hourly cache** and bounded
persistence. Internal measurements share a **1 MiB sub-budget**, SQL
families/RPC correlations a **512 KiB sub-limit** within it; restored
measurements may consume at most half. No additional history ring or
timer.
- SQL completion writes primitive IDs, elapsed time and observation time
into a preallocated 1,024-sample buffer, charged **33,280 B**. The
existing 20 ms tick drains at most 256 samples. Overflow explicitly
increments drops and marks incomplete distributions. Hub publication
updates fixed scalars charged 256 B, sampled on the existing 5 s tick.
Histograms are sparse, budgeted and expired; live percentiles avoid
intermediate histogram/protobuf copies. Critical safe-integer counters
avoid routine BigInt allocation. Focused hot-path and overview builds
previously improved by approximately **93% / 91%**, respectively; the
full gate below remains the acceptance evidence.
- Family labels are a closed allowlist at shared stores: threads,
events/ingest, outbox, bots, computers/mirrors, settings, GitHub,
diagnostics, retention and other stores. Steady fixture: **940/960
executions labelled (97.92%)**, with a ≥95% test assertion. No SQL,
parameters, rows, argv, error objects/messages/stacks or causes enter
metrics, correlations or persistence.
- Failure audit removed a retained `Exit.Failure` and
statement/acquisition captures from cleanup callbacks. Classification
stores numeric reason/defect counts and a failure bit, preserving
work/release error semantics. Pool sampling is single-flight; governor
callbacks retain only the collector. Pending encoded writes are
single-flight and capped at **60 minutes / 4 MiB**, with explicit
drops/gaps. No collector budget increased.

### Retention evidence after the sync rebase

`bash scripts/bench/diagnostics-retention.sh 2 write_failure` completed
with seeded history, slow receivers, periodic views, the real 70 s lock
and a failing INSERT carrying an **8 MiB synthetic parameter**. Each
checkpoint used a fresh A/B fixture, two forced GC calls and a native
JSC snapshot; snapshots themselves collect garbage, so earlier
checkpoints do not collect in later-checkpoint fixtures.

| Checkpoint | A heap after GC MiB | B heap after GC MiB | B−A MiB |
| --- | ---: | ---: | ---: |
| Before lock | 76.502 | 78.318 | +1.816 |
| Lock end | 89.168 | 91.068 | +1.900 |
| 20 s after release | 88.446 | 91.167 | +2.720 |

The after-release probe residual **exceeds approximately 2 MiB**; it is
not silently rounded into a pass. A control without the synthetic
parameter, retaining the original lock/watches, gave pre-GC **A 248.853
/ B 248.706 MiB** and post-GC **A 73.618 / B 75.160 MiB**, delta
**+1.542 MiB**. Thus a roughly 170 MiB collectible heap also occurs with
Stage 2 disabled.

Largest string self-size was **85,386 bytes in both sides**, with no
retained 8 MiB parameter string. Positive differences were primarily
ArrayBuffer backing stores (~0.94/0.95/1.88 MiB across the checkpoints)
and JIT code (~0.30/0.47/0.45 MiB). Example path: `ObservedConnection →
DatabaseConnection → PgConnectionImpl → parser closure → store →
ArrayBuffer`; large writer/module buffers also existed on both sides.
The original control had ~0.95 MiB extra ArrayBuffer and ~0.17 MiB JIT
self bytes. Pending diagnostic data during the lock was only **A 5,201 B
/ B 22,937 B**, and after release **A 5,146 B / B 12,700 B**; no growing
failed-write queue or parameter-bearing diagnostic record appeared.

**Pre-existing watch finding:** the large collectible allocations were
associated with full watch snapshots. The incremental-sync stack removed
them for the modern sequence protocol; this benchmark deliberately
preserves the older watch flags without `sequence`, so the compatibility
snapshot path remains exercised. This diagnostics stack does not change
watch protocol/workload to hide those allocations and does not claim the
original spike was conclusively caused by the removed Exit reference.

Analyzer: `bun scripts/bench/diagnostics-heap-report.ts off.json
on.json`, run automatically by the retention launcher. It reports
constructor counts, root-reachable self bytes and bounded shortest root
paths, not dominator-retained sizes. Native JSC snapshots lack weak-edge
classification; a root path alone does not establish strong retention.
Unknown names are redacted/hashed and string contents are never printed.
Bun 1.4.4's V8 export crashed in the discarded initial run, so completed
evidence uses native JSC. Raw snapshots/type counts remain private
(0700/0600); do not upload them.

Private evidence: `retention-sync-jsc-20261112/`,
`retention-control-20261112/` under `/var/tmp/canopy-diagnostics-2/`.

### Fresh-state method and controls — 2026-11-12

This measurement supersedes the earlier shared-driver/cluster
recordings. Each A or B member now has a fresh Bun driver VM, PostgreSQL
cluster/WAL/database, gateway state directory and worker state
directory. The old member exits and its cluster/state is removed before
the next starts. Initial fixture counts are logged and match: 500
threads, 1,000 turns, 7,099 items and 840 seeded rollups. The measured
checkout remains committed and unchanged throughout recording.

Two A/A controls precede each stage's four acceptance pairs.
Current-stage diagnostics are off in every control member; lower stages
remain on. Slot order is strictly AB / BA for controls and AB / BA / AB
/ BA for measured pairs. The p95 noise floor is the maximum absolute
paired A/A delta for that phase, a descriptive n=2 envelope, not a
confidence interval. We compare B−A with max(0.25 ms, that envelope),
report percentages separately, and do not subtract noise from overhead.

Every measured process runs in a user scope with `MemorySwapMax=0`;
PostgreSQL has its own bound scope. Limits and current swap are checked
at boundaries and every second. Nonzero/unreadable scope counters, load
above 12 CPUs, or host swap-in >=4 MiB/s for three consecutive seconds
reject the pair. Host swap-out is log-only and recorded per pair. Kernel
affinity was denied (`Operation not permitted`), so kswapd ticks/last
CPU and zram I/O remain logged. No host settings or foreign processes
changed.

Sensitivity flags a whole pair only when any process/phase delta differs
by more than 2× MAD and host peak swap-out exceeds 4 MiB/s. Primary
medians include every accepted pair; sensitivity medians exclude whole
flagged pairs and state their n. This is not a reason to discard
accepted data. Physical PostgreSQL I/O remains unavailable (`null`)
because the I/O controller is not delegated.

### RPC path profile

`diagnostics-rpc-path.ts` holds the Stage 1 interceptor constant and
adds Stage 2 RPC correlation plus three SQL phase records per call. Four
alternating pairs, 25,600 measured calls per member, show median
per-call increments **+0.001701 / +0.001914 / +0.001749 / +0.001528 ms**
(median **+0.001725 ms**). The paired p95 of batch-average call costs is
**−0.015590 / +0.002867 / +0.002300 / −0.002806 ms**; this is explicitly
a batch statistic, not network RPC p95. Fixed-buffer bounds held, with
no drops. Native JSC sampling is dominated by transport
abort/listener/generator/header operations, rather than a diagnostic
allocation loop.

A separate fresh-state 30 s real steady profile gave **A 4.037163 / B
4.128845 ms RPC p95**, delta **+0.091683 ms**, and CPU **+0.020855 pp**.
This focused result meets 0.25 ms, but does not replace full-sequence
controls or acceptance results. Private profiles:
`/var/tmp/canopy-diagnostics-2/isolation-20261112/` and
`isolation-profile-fixed-20261112/`. No profiling or explicit GC runs
inside acceptance recordings.

### Independent pre-existing findings

- **[#544](#544): legacy
thread-watch allocations awaiting GC.** On pure dev, the second
gateway's pre-GC heap is 166.82 MiB larger, but the after-GC difference
is only 0.99 MiB. Fresh-state A/A controls also produce +172.15 MiB heap
in one pair, this time on its first member, despite no current-stage
diagnostic difference. Therefore shared PostgreSQL/driver state and
running second are not necessary causes. Fresh isolation is implemented,
but cannot honestly be claimed to eliminate all spikes. This stack does
not fix legacy watches or force production GC.
- **[#563](#563): blocked
writes can starve SQL reads.** With nine blocked updates plus ingest,
all ten gateway connections wait on row/transaction locks. Pure dev's
SQL-backed view probe completes after 64,824.9 ms; both Stage 3 sides
show ~59,820 ms history reads in the original fixture. These are
successful delayed requests, not RPC timeouts. The acceptance fixture
now blocks eight updates, leaving one read slot after ingest, and logs
overview/history waits individually. The product scheduling issue is
separate.

Stage 2 control evidence:
`/var/tmp/canopy-diagnostics-2/fresh-aa-20261112/`. All raw snapshots
remain private; no SQL text, parameters, credentials or string contents
are attached.
### Fresh-state results: Stage 2

Measured head: `07b25362c33346f5537cdbc324ba3561e33340e9`. **4 accepted
/ 0 rejected**, strict AB / BA / AB / BA. All scope swap checks passed.
Pairs 2 and 3 meet the agreed joint MAD/swap-out sensitivity rule; they
remain in primary results.

| Phase | CPU pp | p95 ms | p95 % | RSS MiB | Heap MiB |
| --- | ---: | ---: | ---: | ---: | ---: |
| governor | 0.108 | -0.252 | -5.557 | 1.336 | -1.508 |
| idle | 0.126 | — | — | 3.488 | 0.877 |
| pool_contention | 0.266 | -0.328 | -9.129 | 4.211 | 3.516 |
| reconnect | 0.164 | -0.417 | -12.196 | 6.49 | 2.907 |
| slow_reader | 0.351 | -0.821 | -18.353 | 1.584 | 3.863 |
| steady | 0.213 | -0.452 | -10.457 | 2.531 | 2.539 |
| write_failure | 0.19 | -0.539 | -14.702 | 5.998 | 2.497 |

Gateway medians above include all four accepted pairs. CPU is percentage
points of one core; p95 is the median of paired deltas (and separately
the median paired percent change). Endpoint RSS/heap are sampled without
forced GC.

| Phase — sensitivity, n=2 | CPU pp | p95 ms | RSS MiB | Heap MiB |
| --- | ---: | ---: | ---: | ---: |
| governor | -0.137 | -0.915 | 32.348 | 33.649 |
| idle | 0.113 | — | 1.107 | 0.778 |
| pool_contention | -0.002 | -0.447 | 4.328 | 3.068 |
| reconnect | 0.164 | -0.176 | 5.504 | 3.202 |
| slow_reader | 0.351 | -0.821 | 10.25 | 4.83 |
| steady | 0.282 | -0.488 | -3.084 | -1.659 |
| write_failure | -0.093 | -0.111 | 5.559 | 4.981 |

| Pair | Host swap-out MiB | Peak MiB/s | Result |
| --- | ---: | ---: | --- |
| 1 | 0 | 0 | Accepted |
| 2 | 47.969 | 15.633 | Accepted |
| 3 | 17.973 | 4.969 | Accepted |
| 4 | 0 | 0 | Accepted |

| Phase | A/A pair 1 ms | A/A pair 2 ms | Noise envelope ms | B−A ms |
Within target/envelope |
| --- | ---: | ---: | ---: | ---: | --- |
| steady | 0.117 | 0.579 | 0.579 | -0.452 | true |
| reconnect | -0.073 | 0.097 | 0.097 | -0.417 | true |
| slow_reader | -0.053 | -0.72 | 0.72 | -0.821 | true |
| write_failure | 0.193 | -0.859 | 0.859 | -0.539 | true |
| pool_contention | 0.163 | -1.171 | 1.171 | -0.328 | true |
| governor | -0.501 | -1.029 | 1.029 | -0.252 | true |

| Phase | Pair | CPU pp | p95 ms | p95 % | RSS MiB | Heap MiB |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| governor | 1 | -0.084 | -2.168 | -40.712 | 15.176 | 17.379 |
| governor | 2 | 0.385 | 1.37 | 45.979 | -22.922 | -22.102 |
| governor | 3 | 0.3 | -0.842 | -21.561 | -12.504 | -20.396 |
| governor | 4 | -0.19 | 0.338 | 10.448 | 49.52 | 49.919 |
| idle | 1 | 0.079 | — | — | -0.492 | 0.793 |
| idle | 2 | 0.134 | — | — | 5.031 | 1.386 |
| idle | 3 | 0.119 | — | — | 4.27 | 0.962 |
| idle | 4 | 0.148 | — | — | 2.707 | 0.763 |
| pool_contention | 1 | 0.072 | -1.16 | -26.671 | -0.547 | 2.134 |
| pool_contention | 2 | 0.468 | -0.279 | -7.472 | 3.348 | 3.354 |
| pool_contention | 3 | 0.461 | -0.376 | -10.786 | 5.074 | 3.678 |
| pool_contention | 4 | -0.075 | 0.265 | 7.331 | 9.203 | 4.003 |
| reconnect | 1 | 0.191 | 0.195 | 5.208 | 6.508 | 5.883 |
| reconnect | 2 | 0.218 | -0.287 | -9.375 | 6.473 | -0.391 |
| reconnect | 3 | -0.086 | -1.395 | -29.97 | 8.469 | 5.292 |
| reconnect | 4 | 0.137 | -0.547 | -15.017 | 4.5 | 0.522 |
| slow_reader | 1 | 0.226 | -0.853 | -18.173 | 28.934 | 7.722 |
| slow_reader | 2 | 0.976 | -1.393 | -26.019 | 0.813 | 5.233 |
| slow_reader | 3 | 0.192 | -0.288 | -7.161 | 2.355 | 2.493 |
| slow_reader | 4 | 0.476 | -0.79 | -18.532 | -8.434 | 1.939 |
| steady | 1 | 0.235 | -0.329 | -8.065 | -5.078 | -5.36 |
| steady | 2 | 0.191 | 0.616 | 18.183 | 10.082 | 3.035 |
| steady | 3 | -0.177 | -0.576 | -12.848 | 6.152 | 4.596 |
| steady | 4 | 0.329 | -0.647 | -16.198 | -1.09 | 2.043 |
| write_failure | 1 | -0.339 | 0.144 | 5.018 | 21.766 | 7.231 |
| write_failure | 2 | 0.226 | -0.856 | -23.17 | 5.281 | 0.921 |
| write_failure | 3 | 0.339 | -0.713 | -19.488 | 6.715 | 2.263 |
| write_failure | 4 | 0.153 | -0.366 | -9.916 | -10.648 | 2.732 |

Worker/PostgreSQL CPU, total CPU and worker memory are retained for
every phase/pair in `paired-report.json`; no process cost is omitted
from that report.

**Interpretation:** RPC p95 meets the 0.25 ms / phase-specific A/A
criterion in every phase; gateway median CPU stays below 0.5 pp. This is
not a no-memory-growth claim: primary write-failure memory is +5.998 MiB
RSS / +2.497 MiB heap, and sensitivity governor heap is +33.649 MiB with
only n=2. Those endpoint effects and the independent A/A collectible
watch spike remain visible. The maintainer decides the gate.

Evidence: `/var/tmp/canopy-diagnostics-2/fresh-gate-20261112/` and
`/var/tmp/canopy-diagnostics-2/fresh-aa-20261112/`, including immutable
heads, JSONL, profiles references, paired deltas, rejected records
(none), host swap counters and all MAD flags.

### Verification and UI

After the sync rebase: install, generated-code check, full typecheck,
lint, format check, diff/shard-manifest checks and web builds passed.
Stage 2 focused verification: **72 tests in 12 files**, one file at a
time via `check:tmp`, clean controlled temp directories. Includes
ACK/durability under ingest/slow receiver, owner SQL,
reserve/execute/release errors, throwing error getters and
large-parameter privacy, governor and restart continuity. Stage 3
repeats/extends coverage to **109 tests in 19 files**. Protocol logic:
paired/MAD 2, swap 4, scope 1 passing tests; heap analyzer security 2
passing tests. Shell postlude syntax/diff checks pass. Current-head full
CI is green, including all four shards and builds; the full local suite
was not redundantly repeated during recording.

Shared web/mobile percentiles clamp to observed min/max. Disclosures use
kit chevrons/motion; observation duration appears once per section,
uptime has only its latest value and percentile explanation is one
sentence. Prior seeded browser QA covered light/dark,
desktop/narrow/390/320 px and long labels; no UI changed in this
measurement update. Evidence under `/var/tmp/canopy-diagnostics-2/`:
`desktop-{light,dark}-process.png`, `desktop-dark-database.png`,
`desktop-light-query-family.png`, `narrow-dark-governor.png`,
`phone-{light,dark}-process.png`, `phone-320-light-queues.png`.

Mobile JS only; pinned EAS 27.4.1 production fingerprints unchanged: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Native device UI was not
exercised.

Copy audit (`docs/copy.md` §8): English/sentence case, explicit units,
evidence-led findings and next actions; observation once per group,
latest-only uptime, one-sentence percentile explanation, coverage
denominator, incomplete/historical states, and long-label wrapping
verified. No new UI copy in the latest corrections.


### Other measured processes

| Phase | Worker CPU pp | Worker RSS MiB | Worker heap MiB | PG CPU pp |
Total CPU pp |
| --- | ---: | ---: | ---: | ---: | ---: |
| governor | 0.007 | -0.047 | 0.003 | 0.025 | 0.14 |
| idle | -0.01 | -0.086 | 0 | 0.003 | 0.124 |
| pool_contention | 0.004 | -0.105 | 0.002 | 0.052 | 0.322 |
| reconnect | 0.011 | 0.357 | -0.001 | 0.01 | 0.151 |
| slow_reader | 0.01 | -0.125 | -0.002 | 0.014 | 0.353 |
| steady | -0.003 | -0.086 | 0 | -0.039 | 0.16 |
| write_failure | 0.011 | -0.182 | -0.003 | 0.032 | 0.237 |
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