Skip to content

fix(ui): correct a stale boot-order comment in the analytics test (RIG-2874) - #1081

Merged
trunk-io[bot] merged 2 commits into
mainfrom
compass-ui/rig-2874-t5-record-hygiene
Sep 11, 2026
Merged

trunk-io[bot] merged 2 commits into
mainfrom
compass-ui/rig-2874-t5-record-hygiene

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Closes the last task of RIG-2874's UI lane: T5 — record hygiene (design record compass/docs/designs/ui/compass-outbound-session-header/design.md:746).

The record's T5 was conditional — update the module-header prose if the T4 boot reorder changed what it asserts, and verify no other comment states the old order as a constraint. Both clauses resolved:

T5 clause Outcome
Module header analytics.ts:1-16 No change needed — "built once at boot from the resolved AnalyticsConfig" survives the reorder intact
Sweep for other stale order claims One real defect found and fixed

The defect

analytics.test.ts:266-267 asserted that boot builds the transport before analytics — precisely the order T4 inverted. It also contradicted the matching comment on the traceId getter at analytics.ts:53, so the file and its test disagreed in prose about the same invariant.

Corrected to state the real order: analytics is built before the transport (index.tsx:121 createAnalytics:125 createLiveClients), so the trace-id slot is still empty at that point and the first id lands later.

Why this was invisible to every gate

The test's behaviour was correct and green — a trace id arriving after createAnalytics is picked up, which is the regression this test exists to catch. Only its stated reason was stale. No typecheck, lint, or test run can fail on a wrong comment above a passing assertion, and review naturally skims the prose of a green test. That is the shape worth noting: the assertion never lied, the explanation did, and the explanation is what the next reader trusts when deciding whether a failure here is real.

Change

Comment-only. One file, 3 insertions / 2 deletions. No behaviour change, no assertion changed, no production code touched.

Gates

  • bun test apps/ui/src/analytics/analytics.test.ts16 pass / 0 fail
  • bunx tsc --noEmit (apps/ui) — rc=0 (bun test does not typecheck, so this ran separately)
  • bunx biome check on the changed file — rc=0

All three re-run after rebasing onto merged main (8d26d723), since #1055 landing put the T1–T4 code underneath this commit.

Sweep evidence

Confirming the fix is complete rather than pattern-local, with a live positive control so the zero is not a dead query:

  • analytics BEFORE the transport2 sites (the corrected test comment + the getter doc at analytics.ts:53) — the control fires
  • old-order phrasing (transport … before … analytic) → 0 sites

Provenance

Authored on top of #1055 (RIG-2874 outbound session header, merged 76c85dae) rather than amended into it. #1055 was already approved, and on this repo an approval is not re-checked on a later push, so amending would have put an unreviewed head in front of the merge queue.

Co-authored-by: Matt Wilkinson matt@rigel.build

…G-2874)

T5 record hygiene. The test comment asserted that boot builds the transport
before analytics, which the T4 reorder inverted, and it contradicted the
matching comment on the traceId getter (analytics.ts:53). The test behaviour
is unchanged and still correct: the getter picks up a trace id that arrives
after createAnalytics.

The module header (analytics.ts:1-16) needed no change — "built once at boot
from the resolved AnalyticsConfig" is still accurate after the reorder.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@linear-code

linear-code Bot commented Sep 11, 2026

Copy link
Copy Markdown

RIG-2874

@trunk-io

trunk-io Bot commented Sep 11, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-ui-rig-2874-t5-recor.compass-eng-docs.pages.dev

Deployed from compass-ui/rig-2874-t5-record-hygiene at 6939ed5.

Review nit on #1081: the comment sat exactly on the four-line ceiling, and
"the slot is still empty here" described the test local rather than the
production sink it stands in for. Same fact, two lines, no conflation.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@trunk-io
trunk-io Bot merged commit 46a1208 into main Sep 11, 2026
16 checks passed
@trunk-io
trunk-io Bot deleted the compass-ui/rig-2874-t5-record-hygiene branch September 11, 2026 18:35
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.

2 participants