Three review findings against the tracer's honesty contract:
- The readiness -> paint frame was unguarded. `awaitDeferredCommit` checks
age, frame gap, and visibility on every frame it drives, but the one rAF
it queues before `record()` checked neither age nor gap, so a suspension
in that seam (App Nap fires no visibilitychange) recorded the whole
absence as a clean switch.
- DM actions await `open_dm` before `goChannel`, so that relay round-trip
sat outside the measurement; Pulse's note actions used raw `navigate` and
produced no measurement at all. Callers now capture the click anchor and
hand it to `goChannel`, and Pulse routes through `goChannel`.
- A `navigate()` rejection left the trace it opened active, so an untraced
re-entry could settle the failed attempt. Cancellation is by trace
identity, so a newer same-channel attempt is never erased.
Signed-off-by: Max Lampert <maxwell@squareup.com>
Blind-review round 18 (Opus xhigh) finding: 26ee8982b moved the
measure's origin to the input event's timeStamp but left the start mark
at handler-dispatch time, so the Performance panel showed the measure
beginning before its own start mark by the input delay — two different
switch durations from one instrument. The mark now carries
startTime: startedAt, pinned by asserting mark and measure share the
anchor.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Max Lampert <maxwell@squareup.com>
Blind-review round 17 (Fable high) finding: startedAt sampled
performance.now() at click-handler dispatch, silently excluding input
delay — a click queued behind a long task under-reported by the whole
queueing time, unbounded, in exactly the contention regime the tracer
exists to expose. begin() now anchors at the dispatching event's
timeStamp when one is present (window.event is set only during
synchronous dispatch, so stale timestamps cannot leak in from async
continuations; min() guards skewed clocks).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Max Lampert <maxwell@squareup.com>
Blind-review round 16 (Opus high) P3s:
- A same-task unmount-then-renavigate to the same channel left the exit
cleanup's scheduled abandon pending, and its microtask killed the
freshly opened trace (silent lost sample). beginChannelSwitchTrace
now revokes any pending abandon for its channel.
- The delayed-chunk spec's timing-budget guard hit expect(null) with a
raw matcher error when a truncated record had already cleared the
start mark — the one case its message exists for. Boolean form now
covers the null.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Max Lampert <maxwell@squareup.com>
Blind-review round 12 (Opus xhigh) findings, both reproduced:
- P1: the round-9 abort gate destructured { signal } in the members
queryFn — merely reading that getter sets React Query's
abortSignalConsumed, switching the roster query to cancel-and-revert
when its last observer unsubscribes mid-fetch. Interrupted switches
discarded rosters that previously landed in cache (the Tauri call
cannot be cancelled, so the work was paid and thrown away), and
A->B->A warm switches repaid a full roster fetch. Replaced with a
per-channel supersession token (openChannelMembersFetch) checked by
traceChannelMembersFetch — stale fetches stay out of the one-shot
slot without touching the signal. Sequences reset with community
state.
- P2: lastFrameAt started null, so the settle-entry -> first-frame
window skipped the starvation guard: a no-visibilitychange suspension
there recorded a truncated measure inflated by the whole stall
(bounded only by the 35s age guard). The gap clock is now seeded at
settle entry.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Max Lampert <maxwell@squareup.com>
Blind-review round 9 (Opus high) findings:
- P2: the members queryFn attributed unconditionally, so a roster fetch
superseded by a live join/leave invalidation could claim the trace's
one-shot membersFetch slot with a stale count and duration. It now
checks signal.throwIfAborted() before attributing — same rule as the
window fetch's reconcile abort gate.
- P2: a permanently dead sink (unwritable log dir, stale directory at
the log path) was indistinguishable from no traced switches: console
lines kept flowing while every append failed into .catch(() => {}).
The first persistence failure now warns once.
- P3: during a suspension that fires no visibilitychange, the deferred
render-pending marker stays latched, so the settle wait recorded a
truncated measure inflated by the whole stall (bounded only by the
35s age guard). A single inter-frame gap beyond 3s — beyond any real
main-thread stall — now drops the sample.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Max Lampert <maxwell@squareup.com>
Blind-review round 4 (Opus xhigh) findings:
- A not-pending frame landing past the wait deadline is rAF starvation
(system suspend, App Nap — no visibilitychange), not render time: a
fast settle followed by a stall recorded up to 34s as a clean switch
under the click-anchored 35s age guard. Such frames now drop.
- Visibility accounting now spans the whole trace: one module-level
visibilitychange watcher timestamps transitions, and any transition
since the click (not just during the settle wait) drops the trace —
a window minimized while the fetch was in flight no longer records
its absence as switch time. Replaces the per-settle listener.
- begin() now clears the previous switch's settled mark and measure
too, so a consumer polling the User Timing buffer mid-switch can
never read the prior switch's entries as the current one's.
- The goChannel comment no longer claims every channel navigation
funnels through it: Pulse startDm navigates to the channel route
directly and is untraced.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Max Lampert <maxwell@squareup.com>
Blind-review round 3 (Sonnet) finding: beginChannelSwitchTrace marked
unconditionally but only record() cleared, so every abandoned/dropped
trace (forum visits, route exits, hidden-window and frame-starved
drops) leaked a permanent buzz:channel-switch:start entry. Clearing
the previous start mark at begin bounds the buffer to one entry no
matter how the prior trace ended.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Max Lampert <maxwell@squareup.com>
Blind-review round 2 (Opus) findings:
- P1: rAF suspends in hidden windows, so a queued settle fired only on
the user's return and charged the whole absence to the switch as a
clean record (reproduced at runtime). Settle now drops when the window
is already hidden, poisons the wait on visibilitychange, and drops any
trace older than the entry timeout plus the render wait — nothing
legitimate can reach that age.
- The JSONL append is a single write_all: writeln! issues two write
syscalls and the lock is process-local while the log path is not, so a
second process sharing the log dir could interleave mid-line.
- The User Timing buffer keeps only the latest switch's mark/measure —
desktop sessions run for weeks and the buffer is never GC'd.
- The route-commit mark moved to a layout effect so it stamps commit
time, not first-paint time.
- Comment honesty: the member-heavy harness now states that mock-mode
IPC hands live objects (parse cost not exercised) and that the
Projects hydration marker guards cold/invalidated samples only; the
goChannel trace-anchor comment describes what the same-channel guard
actually skips; the Rust concurrency test's byte arithmetic corrected.
- Longtask sampling drains PerformanceObserver.takeRecords() at sample
time so a longtask ending just before the resolve frame isn't lost.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Max Lampert <maxwell@squareup.com>
Address the three findings from the 2026-08-24 re-review of #6455, plus
one finding from a follow-up adversarial review:
- The switch trace now opens inside commitGuardedNavigation, only after
the navigation guard accepts — a refused click can no longer leave an
orphan trace that a later history navigation would settle with
inflated time. The commit flow is extracted and dependency-injected;
new unit tests pin guard ordering and the refusal→history-back case.
- The perf-log 4 KiB cap now bounds bytes on disk: one byte is reserved
for the newline writeln! appends. New boundary test measures the file.
- The channel↔Projects benchmark gates readiness on a new
data-projects-hydrating marker (driven by the surface's query fan via
isLoading, so disabled queries never wedge it) instead of the shell
header, verifies member inflation on both inflated channels, uses a
prefixed ready-selector for general, and reports each switch direction
as its own median so a one-leg regression cannot hide.
- A settle wait that hits its 5s deadline while the render is still
pending now records with settleWaitTruncated instead of posing as an
honest settled paint — the >deadline tail is what the tracer exists
to expose. Also removes the dead ChannelSwitchFetchTrace type.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Max Lampert <maxwell@squareup.com>
Address the three findings from the 2026-08-24 review of #6455:
- The lazy ChannelPane's Suspense fallback now carries the
data-render-pending marker, so a switch trace can no longer settle
while the pane chunk is suspended. New Playwright regression holds
the chunk and asserts no measure lands until rows paint.
- Route-exit trace abandonment is deferred one microtask and canceled
by the effect re-setup, so StrictMode's dev-only effect replay no
longer kills a just-opened trace. New jsdom regressions run the real
react-dom dev replay; the settle spec also passes against the Vite
dev runtime.
- The perf-log 4 KiB cap is enforced on the final serialized line, and
BUZZ_PERF_LOG_LABEL is truncated to 128 bytes at a char boundary, so
a runaway label can neither inflate the sink nor kill every record.
Also extracts the timeline-loading latch + trace marks from
ChannelScreen into useChannelTimelineLoading (file-size ratchet).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Max Lampert <maxwell@squareup.com>
Add a single-active-trace instrument for channel navigation: goChannel
opens the trace, ChannelScreen marks route commit and settles it after
the timeline loading latch clears (double rAF so the frame painted).
The two relay fetches that can sit on the switch path — the message
window and the member roster — are attributed to the trace when they
run during it; cache-served switches log "cache".
Each switch emits one [switch-perf] console line plus User Timing
marks/measures (buzz:channel-switch:*) so before/after comparisons work
identically in a dev build, the Performance panel, and Playwright perf
specs.
Signed-off-by: Max Lampert <maxwell@squareup.com>