Uh oh!
There was an error while loading. Please reload this page.
test(showcase): put e2e/global-setup.ts in a tsc program and fix what that reads - #8178
Merged
Merged
Conversation
… that reads The package include was `e2e/**/*.spec.ts`, so `e2e/global-setup.ts` — the fixture that authenticates the whole smoke run — was read by no tsc program at all, and the coverage gate counts test files so nothing else covered it either. Widen the glob to the wholesale `e2e/**/*` and fix the 6 errors that exposes at their source rather than excluding them: - file-local `declare const process` in global-setup.ts, the idiom already used by objectstack.config.ts, src/system/self-url.ts and the three e2e specs (3x TS2339); - `mkdirSync`/`writeFileSync` on the `node:fs` shim and a minimal `node:path` module declaration (TS2305 / TS2724 / TS2591). The shim moves `test/node-shim.d.ts` -> `types/node-shim.d.ts`: both trees depend on it now, and under the old name a narrowing for the test layer would have broken the e2e program with nothing in the path to warn the author. `playwright.config.ts` was dark in exactly the same way and takes the same one-liner. `vitest.config.ts` is deliberately left out — its `vitest/config` import transitively pulls in the whole of `@types/node`, the type surface this package is deliberately without. All changes are type-level (`declare` statements erase at emit, `.d.ts` files emit nothing), so the smoke run's runtime behaviour is unchanged.
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
hotlong
marked this pull request as ready for review
August 12, 2026 19:17
This was referenced Aug 12, 2026
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes#8062
examples/app-showcase/e2e/global-setup.ts— the fixture that authenticates thewhole smoke run — was read by no tsc program at all. The package
includewase2e+/**/*.spec.ts, and the coverage gate counts test files, so nothinghad an opinion on it. This puts it in a program and fixes what that program
then reads.
Re-measurement first (the card's numbers were taken at
3373a29)Every number in the issue predates PR #8061 landing. Re-measured on
origin/main@7cfe7adin a clean worktree, by widening the packageincludeto the wholesalee2e+/**/*and runningtsc --noEmit:The card reproduces exactly — same six errors, same codes, same lines, same
3+3 split. The baseline (
includeas onmain) is green, so all six are thewidening's, none pre-existing.
What the measurement said beyond the card
A. The widened glob adds exactly one file. Diffing
tsc --listFilesbetween the narrow and wholesale globs, package-local files only, the entire
delta is
e2e/global-setup.ts. (e2e/.gitignoreis not a TS file; the treeholds nothing else.) The card's blast radius holds.
B. The file-local
declare const processidiom is still current. Verifiedat all three sites the card names —
objectstack.config.ts:55,src/system/self-url.ts:47,test/connector-self-url.test.ts:38— plus thethree specs #8061 applied it to. Unchanged, so
global-setup.tsgets the sameone-liner rather than a new convention.
C. Partly falsified, and it changed a decision. The card reads the shim
gaps as "no
@types/node".@types/node@26.1.2is installed at theworkspace root and physically resolvable from this package. It is simply not in
the program — nothing names it in
compilerOptions.types. Probing withtypes: ["node"]added:@types/nodewould fix that half;process.enverrors stay, because the shim's globaldeclare const process: { cwd(): string }shadows the real one.So "just add
@types/node" is not the smaller repair: it fixes half the errors,forces the shim's
processglobal out, and widens the package's type surface —which two separate comments in this package (
objectstack.config.ts,node-shim.d.ts) record as a deliberate choice. Kept the narrow shim andextended it; the reasoning is now written into
types/node-shim.d.tsso thenext author does not have to re-derive it.
The open question, answered: the shim moves to
types/test/node-shim.d.ts→types/node-shim.d.ts. Measured, not assumed: the shimis consumed by both trees —
test/forexistsSync/readFileSync/readdirSyncand theprocess.cwd()global,e2e/formkdirSync/writeFileSync/dirnameplus that same global (the three specs alreadyreference it by name in their comments today). Under the
test/name anarrowing made for the test layer would break the e2e program with nothing in
the path to warn the author. Two callers, both real, so this is not an
abstraction built for one. The four stale path references in comments are
updated with it; a
.d.tsis type-only, so the vitest layer is untouched(re-run below).
playwright.config.ts— a deliberate, measured scope callIt was dark in exactly the same way (three
process.envreads, in no tscprogram) and it configures the very smoke lane
global-setup.tsauthenticates.Measured separately: naming it in
includeadds only those three errors andpulls in no new types, so it takes the identical one-liner. Included.
vitest.config.tsis dark too and is deliberately left out: measured, itsvitest/configimport transitively pulls the whole of@types/nodeinto theprogram — the exact type-surface widening this package is built to avoid. That
is a separate decision, not a rider on this one.
Runtime equivalence — argued, then proved
test:smokeis non-blocking nightly, so a repair that satisfies tsc whilechanging runtime behaviour would be silent. Every change here is type-level:
declarestatements erase at emit and.d.tsfiles emit nothing. Proof ratherthan assertion — compiled the pre- and post-change sources and diffed the
emitted JS:
This required care: the first attempt put the
declarebetween the file'sleading block comment and the first statement, which detached the comment and
dropped it from the emit. Declaring it above that comment restores
byte-identity, and each site carries a note saying so. The sign-in call, the
header read, the storage-state write and the env precedence are untouched.
:3000 and this container has parallel agents' work on it. The claim above is a
byte-identity proof of the emitted module, not an execution of the suite.
Verification
pnpm --filter @objectstack/example-showcase typecheck→ exit 0, and--listFilesconfirmse2e/global-setup.ts,playwright.config.tsandtypes/node-shim.d.tsare all in the program, with@types/nodestill absent(0 files) — the file is genuinely read, not merely error-free.
pnpm --filter @objectstack/example-showcase test→ 20 files, 193 testspassed, before and after the shim move.
eslintover every touched path → exit 0.pnpm check:nul-bytes→ OK (7422files).
pnpm check:type-check-coverage→ OK.pre-fix
global-setup.tsand shim while keeping the widened glob → exactlythe six errors above, red; restore from the commit → green,
git statusclean.
pnpm check:type-check-debtcould not be run locally:--re-measurerefuses without the full package closure built, naming
@objectstack/service-knowledgeas unbuilt here, and the script is explicitthat measuring anyway would record a different world. CI builds that closure
first. The diff cannot move a ledger number in any case — this package left
TEST_DEBTin #7923, and the one DEBT entry that tracks showcase files(
@objectstack/spec-monorepo, 4 of its 80) counts files underexamples/app-showcase/src, which this PR does not touch.Note for the PM, not changed here
scripts/check-type-check-coverage.mjs(~line 1410) uses this exact file as itsworked example of why hidden tests are added one at a time — "
e2e/**/*wouldhave pulled
e2e/global-setup.tsinto app-showcase's measurement and billed thetest layer 6 errors". The mechanism rationale stays correct, but the illustration
is now historical: the file is in the real program with zero errors.
scripts/was fenced off this card, so it is left untouched and flagged instead.
Related: #7923 · #8061 · #7353 · #7312 · #5286 — none addressed here.
Generated by Claude Code