Repository navigation
fix(diagnostics): attribute background replication queries - #679
Merged
Merged
Conversation
nixuuu
marked this pull request as ready for review
November 13, 2026 23:19
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
Repeated mirror commits published unchanged computer presence, invalidating `GetComputers` and `ListWorkerRecords` in both desktop/web and mobile shared caches. Compare computer content excluding `lastSeenMs`; meaningful presence, name and sharing changes still invalidate. Remove the configuration-notice timer and send invalidation through the existing owner feed when the configuration clock or open notices change (including dismissal and expiry). Paired measurement on dev 7137e9a vs this branch: two real linked desktop gateways, desktop SSE, mobile Connect client simulation, 12 idle threads per gateway, diagnostics enabled, 5 s warmup then 30 s. The opt-in `gateway-chatter.test.ts` emits the same RPC starts / database-query counters as Diagnostics. No rendering or device performance is inferred. | Counter, 30 s | Before | After | | --- | ---: | ---: | | GetComputers, gateway A | 12 | 0 | | Database queries, A | 2,910 | 2,748 | | Database queries, B | 2,623 | 2,641 | | WatchThread new openings during window | 0 | 0 | | AckThreadRange, each gateway | 6 | 6 | The after column was refreshed on the route-corrected head with the same harness. GetComputers remains at zero new idle calls; the scoped route lookup is included in the SQL totals. The earlier composed seven-PR workload recorded 826/765 SQL queries per 30 s versus 2910/2623 on the baseline. That result predates the independent review corrections and is historical, not a measurement of the final combined heads. Use the refreshed independent measurements in this PR and #678 for the corrected implementations. Collection-only control is recorded in #679. These are idle local multi-client measurements, not extrapolations of the production window. Update timeout investigation: `LocalAppControl.check()` coalesces checks and resolves normally after a 30 s soft wait if the desktop has not acknowledged a newer check timestamp; it does not wait for an installation. Linked requests use a separate 120 s check deadline and 15 min installation deadline. No confirmed hang was reproduced, so no speculative update patch is included. An actual deadline failure in the reported three requests cannot be distinguished from the soft wait using durations alone. #669 adds no GetComputers polling. Diagnostics itself remained enabled in both runs. Its dropped-detail counters are still nonzero and are a separate issue; query totals are exact in this workload. Setup/teardown is excluded. Reproduce with `CANOPY_CHATTER_BENCH=1 bun run check:tmp tests/integration/gateway-chatter.test.ts`. Validation: bun install; gen:check; full typecheck; lint; format:check; web build; shared-query-events tests; gateway overview-feed integration tests (configuration revisions, resolved notices, owner isolation and idle streams); paired workload through check:tmp with cleanup. All commands used nice. The full local check:tmp suite was not run because concurrent unrelated heavy suites already load the host; CI must cover the full suite. Native mobile checks remain blocked by the reported device-host error; no native/mobile source or fingerprint changes. WatchThread verification of Related: #673: extended the existing real-transport progress/drop regression to the mobile Connect client. Both transports retain 1/2/4 s backoff across partial progress and stop after resume/resume/stop. The focused thread-watch-failures suite passes 14 tests / 90 assertions, including premature clean EOF, oversized frames and cursor repair. Normal desktop SSE and mobile foreground streams stayed open through the 30 s idle workload (zero new openings). No additional gateway close/GOAWAY defect was reproduced. The benchmark now exposes collector allocation, all global SQL-family counters and optional trace counts (`CANOPY_CHATTER_TRACE=1`). Composed validation before review corrections: linked update integration passed 13 tests / 112 assertions with clean check:tmp; typecheck, lint, format:check, gen:check and web build passed with all seven fixes applied. iOS and Android exports passed and native fingerprints remained unchanged; device-host verification remains unavailable. Independent review correction: computer overview events now include the current owner-scoped route list, matching GetComputers snapshots. Manual add/remove, authenticated route announcements and LAN discovery therefore remain visible to the content comparison. A real linked-gateway regression verifies cached routes refresh through overview on manual add and remove without a name or presence change. It fails against the old empty-route serialization and passes after the correction (7 assertions, clean check:tmp). Shared-query events pass 8 tests / 25 assertions; gateway typecheck and focused lint/format pass. The optional resolved-notice double read is unchanged.
This was referenced Nov 16, 2026
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.
Background mirror reads and owner overview feeds were counted as
other, while configuration replication used the misleadingsettings.storefamily. Give these paths stable numeric families (mirrors.read,overview.feeds,config.sync) and preserve RPC context through their Effect boundaries. Label durable bot mirror replacements asmirrors.write.Paired opt-in local workload: two linked desktop gateways with 12 threads each, desktop SSE, mobile Connect simulation, diagnostics enabled, 5 s warmup then 30 s idle. This changes attribution, not query frequency.
Additional composed control, same clients/threads: leave the numeric collector/drain enabled but disable diagnostics persistence and peer collection. This records 821/761 queries per 30 s versus 826/765 with full collection, an observed difference of 5/4 (<1%). These short captures vary with minute boundaries; this separates SQL collection cost without claiming a CPU-overhead measurement. The remaining high-frequency work is background application reads.
After attribution:
bots.store1200/1200 executes,bots.queue360/360,config.sync360/288,mirrors.read310/274;settings.storehas zero new executes. Family counts are lower bounds because the existing collector SQL sub-budget saturates. The total query counter remains available. Diagnostics persistence itself accounts for 7/8 executes in this window; the background workload, rather than diagnostics history reads, dominates. Separate PRs address idle bot work and mirror/computer invalidations.Validation: diagnostics gateway integration tests 11 passed, 101 assertions, including real range reads, owner overview subscription and aliases; paired workload passed; full typecheck and focused lint/format passed. Test resets its collector after the attribution fixture so optional-correlation pressure cannot affect the next test. Install, gen:check and web build passed during this task. Full local check:tmp deferred to CI because the shared host is overloaded; focused files ran through check:tmp with clean temp directories. No mobile/native sources changed; device checks remain blocked by the device host.