Skip to content

Commit 76ba5b7

Browse files
claude[bot]claude
andauthored
fix(devx): select the envelope-caller census on scripts-only PRs via the cross-package union (#15709)
* wip(devx): inherited state for #15608 envelope census PR-side selection Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012zGPuVVX3deAx9LdjK8jCk * fix(devx): declare the envelope census's scripts/** read so a scripts-only PR selects it The census walks the whole repo at module load but was selected only through the dependency graph, so a scripts-only diff could not redden it before the merge queue. Declare `scripts/**` on @objectstack/client in the existing cross-package test-input manifest; Layer A (--union-into) then pulls the package into the PR-side affected set and Layer B (turbo.json) moves the task's cache hash. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012zGPuVVX3deAx9LdjK8jCk --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent c2a336c commit 76ba5b7

3 files changed

Lines changed: 67 additions & 12 deletions

File tree

packages/client/src/envelope-caller-census.test.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,19 @@
105105
* - **`objectui` is a RECORDED constant, not a live scan.** A test in this
106106
* repo cannot read that checkout. `OBJECTUI_CENSUS` carries the revision it
107107
* was measured at and the command that reproduces it.
108-
* - **The ratchet in section 3 is only as live as turbo's cache.** This suite
109-
* walks the whole workspace, but `@objectstack/client#test` declares as
110-
* inputs its own package plus the named cross-package files — NOT every
111-
* tree it reads. So a new call site added in ANOTHER package can leave this
112-
* suite cached-green until something else invalidates it. Declaring
113-
* `packages/**` here would re-run the client suite on virtually every
114-
* commit, which is why it is recorded as a known bound rather than bought
115-
* at that price: on a cold cache and in CI's full run the count is exact,
108+
* - **The ratchet in section 3 is only as live as turbo's cache — for the
109+
* trees still undeclared.** This suite walks the whole workspace, while
110+
* `@objectstack/client#test` declares as inputs its own package plus the
111+
* named cross-package globs — NOT every tree it reads. [#15608] `scripts/**`
112+
* is now one of those globs, declared in
113+
* `scripts/cross-package-test-inputs.mjs` and mirrored into `turbo.json`, so
114+
* a diff under that root both pulls this package into CI's PR-side affected
115+
* set (Layer A, the `--union-into` step) and moves this task's cache hash
116+
* (Layer B). ⛔ `packages/**` is still NOT declared: it would re-run the
117+
* client suite on virtually every commit, so it stays a recorded bound
118+
* rather than one bought at that price — a new call site added in another
119+
* PACKAGE can still leave this suite cached-green until something else
120+
* invalidates it. On a cold cache and in CI's full run the count is exact,
116121
* and a call site added inside `packages/client` — where every site lives
117122
* today — invalidates normally.
118123
*/
@@ -269,9 +274,16 @@ const CENSUS = scanCallSites(REPO_ROOT);
269274
* What made that expensive was never the count. It was the FAILURE TEXT. It
270275
* read `expected 21 to be 19` and said nothing about strings, masking or gate
271276
* scripts — in a package the author had not edited, naming a ledger the author
272-
* had never read, at the most expensive point in the pipeline, and invisible
273-
* to every local gate a `scripts/**` edit derives. So the count stands exactly
274-
* as it was, and the message explains itself.
277+
* had never read, and at the most expensive point in the pipeline. So the
278+
* count stands exactly as it was, and the message explains itself.
279+
*
280+
* [#15608] ⭐ The LAST clause of that sentence used to read "and invisible to
281+
* every local gate a `scripts/**` edit derives", and it is no longer true: this
282+
* package now declares `scripts/**` as a cross-package test input, so such a
283+
* diff selects this suite on the PR-side run instead of first reporting from
284+
* the merge queue. That is the WHEN-it-runs axis only — what the census COUNTS
285+
* is untouched, and #13874's suspension of the literal/context distinction
286+
* stands exactly as written above.
275287
*
276288
* ## Three properties this note must have, and what buys each
277289
*

scripts/cross-package-test-inputs.mjs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,49 @@ export const CROSS_PACKAGE_TEST_INPUTS = {
517517
// count changes if the mask does.
518518
'scripts/js-comment-mask.mjs',
519519
'scripts/js-comment-mask.d.mts',
520+
// [#15608] ⭐ THE WHOLE-REPO WALK, declared for the root the incident came
521+
// from. `envelope-caller-census.test.ts` resolves the workspace root and
522+
// walks EVERY `.ts` / `.tsx` / `.js` / `.mjs` / `.cjs` file in the tree at
523+
// module load, so its inputs are the repo -- but the two globs above name
524+
// only the mask it imports, and `turbo ls --affected` reaches this package
525+
// from the dependency graph alone. A diff under `scripts/` therefore
526+
// selected this package for NOTHING, and the census could not report until
527+
// the merge queue.
528+
//
529+
// Measured, not modelled: PR #13596 added a gate refusal MESSAGE containing
530+
// two `client.analytics.query(` call shapes. It masks comments and
531+
// leaves string literals intact by design (#13874, suspended and NOT
532+
// reopened here -- what it counts is unchanged), so it counted them:
533+
// `expected 21 to be 19`. That PR touched `scripts/` and nothing else, so
534+
// no PR-side run could have reddened; it reddened in the merge queue, where
535+
// speculative stacking ejected five PRs, four of them bystanders inheriting
536+
// the same count off the stacked tree.
537+
//
538+
// `scripts/**` and not the whole census radius, and the difference is a
539+
// PRICE, not an oversight. Layer B mirrors every glob here into
540+
// `@objectstack/client#test` inputs, so a declared `packages/**` would
541+
// re-run this suite on virtually every commit -- the bound that test's
542+
// header has recorded as declined since #13079, and this entry does not
543+
// buy it. `scripts/**` is the root where a QUOTED example lives (refusal
544+
// messages, usage banners, embedded fixtures) and the one the incident
545+
// came from; it also needs no ci.yml `crosspkg:` filter change, because
546+
// `@objectstack/spec` already declares it verbatim, so Layer C reaches it
547+
// today. What stays uncovered stays recorded in that test's header.
548+
'scripts/**',
520549
],
550+
heldBy: {
551+
// `scripts/**` is rostered TODAY through the census's own
552+
// `scripts/js-comment-mask.mjs` import, so this witness is not what makes
553+
// the glob held -- it is what keeps the glob attributed to the read that
554+
// actually needs it. The walk is seeded from a recognised expression and
555+
// then descends on a LOOP VARIABLE, so it resolves an escape verdict and
556+
// NO name (`pathExpression`): if the mask import ever moves, the roster
557+
// loses `scripts/` entirely while the whole-repo walk goes right on
558+
// reading it, and #10566's limb would name this glob rather than the read.
559+
// The witness is checked -- this test must still be one of this package's
560+
// escaping tests -- so it cannot rot into prose.
561+
'scripts/**': ['packages/client/src/envelope-caller-census.test.ts'],
562+
},
521563
},
522564
'@objectstack/lint': {
523565
// authoring-rule-wiring / validate-rule-compilability /

turbo.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@
150150
"$TURBO_ROOT$/packages/plugins/plugin-auth/src/auth-route-ledger.conformance.test.ts",
151151
"$TURBO_ROOT$/scripts/check-route-envelope.mjs",
152152
"$TURBO_ROOT$/scripts/js-comment-mask.mjs",
153-
"$TURBO_ROOT$/scripts/js-comment-mask.d.mts"
153+
"$TURBO_ROOT$/scripts/js-comment-mask.d.mts",
154+
"$TURBO_ROOT$/scripts/**"
154155
]
155156
},
156157
"@objectstack/lint#test": {

0 commit comments

Comments
 (0)