Repository navigation
Commit b8feb55
test(client): the envelope caller census never enters
Fixes #22153
Clause-②: no
## What changed
One file, a test, which publishes nothing:
`packages/client/src/envelope-caller-census.test.ts`.
- `SKIP_DIRS` gains `.cache`. A docblock says why: when there is no
`../objectui` sibling, `pnpm objectui:build`
(`scripts/build-console.sh`) shallow-clones the objectui source tree
into `.cache/objectui-SHA/`. That tree contains objectui's own SDK call
site.
- Section 1 gains a pin, `[#22153] never enters .cache/`. It runs on a
throwaway root under the system temp directory:
`mkdtempSync(join(tmpdir(), 'os-census-cache-'))`, removed in `finally`.
- A planted `.cache/objectui-0123456789ab/` checkout leaves
`scanCallSites` deep-equal: the same sites, the same receiver split and
the same files-scanned count.
- A positive control shows that the same walk and matcher do count the
planted site when they are given it directly. So the equality comes from
the skip, not from a fixture the census could never read.
- The fixture text is built from parts. Section 6 gives the reason: this
file sits inside the tree the census walks, so a whole call shape in it
would itself be counted.
## Why `SKIP_DIRS` and not a tracked-files walk (PM reading H2)
Triage's direction allows either. Measured at `8f395597`:
- **It is the shape this repo already uses.** 34 of the 86 one-line
`node_modules` skip sets in the tree already list `.cache`. Examples:
every `packages/spec/src/**/*-retirement.test.ts` and
`scripts/check-agent-test-spelling.mjs`.
- **It drops nothing the census counts.** `.cache/` is gitignored
(`.gitignore:44`), and `git ls-files | grep -cE '(^|/)\.cache/'` returns
0. Control: the same pattern for `.github/` returns 45.
- **A `git ls-files` walk would add a git dependency this test does not
have today.** Of the 12 tests in the tree that spawn git, none is in
`packages/client`. It would also change whether an untracked file is
counted before it is staged. No measured case needs either change.
## Reproduction and proof (PM reading H1 confirmed)
I planted `.cache/objectui-test/packages/x/src/index.ts`, holding one
`this.client.analytics.query(q)` call, in the worktree. Then I ran `pnpm
--filter @objectstack/client exec vitest run --maxWorkers=2
src/envelope-caller-census.test.ts`:
| tree | result |
|---|---|
| base `6ed0c0f3`, planted file present | 3 failed, 17 passed (20).
`expected 29 to be 28`; the enumeration gains
`.cache/objectui-test/packages/x/src/index.ts` (analytics.query, sdk) |
| this branch `8f395597`, planted file present | 21 passed (21) |
The planted file was removed afterwards.
**Ablation.** Run from the committed state with `node
scripts/ablation-replace.mjs`. Anchor `'out', '.cache',` became `'out',
'ABLATED-22153',`: the anchor count went 1 → 0 and the blob
`cbf54580cb85` → `c2a77abdd38a`. After the restore the blob equals HEAD
and `git diff HEAD` is empty.
- Clean tree, no planted file: 1 failed, 20 passed. Only the new
section-1 pin goes red (`filesScanned` 1 → 2, and the planted site
appears). CI never has a `.cache/`, so it still catches the skip being
removed.
- Planted file present: 4 failed, 17 passed. The new pin goes red, and
so do the three section-3 assertions.
- A first attempt used the replacement `'out',`. The tool refused it
before any test ran, because the replacement is a substring of the
anchor (count 1 → 1). That attempt produced no reading.
## Tests and gates, head `8f395597`
- `pnpm --filter @objectstack/client test`: 51 files, 653 passed. That
is the 652 from before plus the new pin.
- `pnpm --filter @objectstack/client typecheck`: exit 0.
`check:test-typecheck` reports OK with 0 errors. The census file is in
the `tsconfig.test.json` program (`tsc --listFilesOnly` finds it once).
- `dispatch-gates --commands` over this diff derives 54 gates, the same
list the dispatch named; `pnpm lint` (full repo) was run on top. All
exit 0.
- `check:skill-examples` and `check:dual-build-cjs-loads` first exited 3
(PREREQUISITE NOT MET, no `dist/`). After `turbo run build
--filter=!@objectstack/docs`, both re-ran and exited 0.
- `dispatch-gates --ran`: 54 derived, 54 run, 0 NOT-MEASURED, 0 UNRUN.
- No changeset: a test file publishes nothing.
## Acceptance notes
- **Scope (PM reading H3).** The card's full `pnpm test`, with the
checkout present, turned only `@objectstack/client#test` red. No other
test suite has a reproduced instance. The repo-root walkers under
`scripts/` whose skip sets lack `.cache` have not been measured against
a planted checkout. That is inference only, so nothing was filed.
- **Source of the hazard.** `scripts/build-console.sh` clones into the
repo root. Cloning outside the tree, or printing the `rm -rf .cache`
advice, would retire the whole class. Not touched here: it is outside
the claim's file surface.
- **New scratch-dir site.** One `mkdtempSync(join(tmpdir(), ...))` under
the system temp directory, removed in `finally`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01RWZbGvPFcRKvUqASZtunCU)_
Co-authored-by: Claude <noreply@anthropic.com>.cache/ (#22196)1 parent 7d7943d commit b8feb55
1 file changed
Lines changed: 51 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
166 | 178 | | |
167 | | - | |
| 179 | + | |
168 | 180 | | |
169 | 181 | | |
170 | 182 | | |
| |||
657 | 669 | | |
658 | 670 | | |
659 | 671 | | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
660 | 709 | | |
661 | 710 | | |
662 | 711 | | |
| |||
0 commit comments