Repository navigation
Commit 67a7729
fix(review): scope the post-outcome invariant to the CLI, de-order the attribution test
Bot review on #1064. Four findings, all valid; two are the same class already
fixed on the sibling onboarding PR.
- `telemetry.md`: the `review_post_outcome` row claimed "exactly one per
**completed** review, so absence means the review failed". That invariant holds
only on the CLI path — the `dbt_pr_review` tool completes reviews and never
publishes by design, so an analyst correlating events would have read every
tool-invoked review as a failure. Scoped to the CLI and the tool path called out
explicitly. This was a real error in the wording I added in `4ba07a7`.
- `telemetry.md`: the general "each event includes a timestamp, session ID, CLI
version, machine ID" sentence had ended up *inside* the review-specific
subsection, reading as review-only. Hoisted above it.
- `telemetry.test.ts`: the caller-attribution test called the real
`Telemetry.init()` without clearing the memoized `initPromise` first, so any
earlier init in the same process — including one under
`ALTIMATE_TELEMETRY_DISABLED` — silently won and the connection string set by
the test was ignored. It also relied on a sibling describe's `afterEach` having
undone the `Telemetry.track` spy. Now restores mocks (before installing its own
fetch spy, not after), shuts down to clear `initPromise`, asserts
`isEnabled()` so a future regression fails with a cause, and reads across all
request bodies rather than `bodies[0]`.
- Same test: real `init()` writes `~/.altimate/machine-id`, so running the unit
suite minted an identity the developer's own CLI would then reuse. `HOME` now
points at a temp dir, restored and removed in `finally` — the pattern the e2e in
this PR already used.
Proven rather than assumed: adding a prior `init()` to this same file makes the
attribution test fail without the `shutdown()` and pass with it.
Verified: turbo typecheck clean; 921 tests across review/telemetry/upstream/
branding pass; all three `analyze.ts` gates (`--markers --strict`, `--branding`,
`--require-markers --strict`) exit 0.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018SLUQF3xgZHsGZHSjxe7vb1 parent 4ba07a7 commit 67a7729
2 files changed
Lines changed: 34 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | | - | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
257 | 260 | | |
258 | 261 | | |
259 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
260 | 275 | | |
261 | 276 | | |
262 | 277 | | |
| |||
268 | 283 | | |
269 | 284 | | |
270 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
271 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
272 | 295 | | |
273 | 296 | | |
274 | 297 | | |
275 | 298 | | |
276 | 299 | | |
277 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
278 | 303 | | |
279 | 304 | | |
280 | 305 | | |
| |||
289 | 314 | | |
290 | 315 | | |
291 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
292 | 322 | | |
293 | 323 | | |
294 | 324 | | |
| |||
0 commit comments