Uh oh!
There was an error while loading. Please reload this page.
fix(turbo): declare plugin-auth's typecheck dependency on its own build - #12043
Merged
yinlianghui merged 1 commit intoAug 25, 2026
Merged
Conversation
`@objectstack/plugin-auth`'s `typecheck` script runs a second tsc program (`tsconfig.examples.json`) over `examples/basic-usage.ts`, which imports the package by its own name. That resolves through `exports` to `./dist/index.d.ts`, so the program's inputs include an artifact the package itself produces -- and nothing declared it. The generic `typecheck` task depends on `^build` (dependencies' build), never the package's own, so `turbo run typecheck --filter=@objectstack/plugin-auth` on a tree without the package's `dist/` fails with TS2307 on the example. Declared with a package-scoped task carrying `dependsOn: ["build"]` -- the shape the repo already uses for a task that needs its own package's build output (`@objectstack/metadata#test`, `@objectstack/cli#test`, `test:e2e`). Own `build` transitively pulls `^build`, so dependency ordering is unchanged.
This was referenced Aug 25, 2026
yinlianghui
marked this pull request as ready for review
August 25, 2026 06:50
This was referenced Aug 25, 2026
Uh oh!
There was an error while loading. Please reload this page.
yinlianghui
deleted the
claude/issue-11620-plugin-auth-examples-typecheck-dep
branch
August 25, 2026 07:09
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#11620
The defect, reproduced
@objectstack/plugin-auth'stypecheckscript runs two tsc programs:The second checks
examples/basic-usage.ts, whose line 13 imports the package by its own name. That resolves through the package'sexportsto./dist/index.d.ts— so the program's inputs include an artifact the package itself produces, and nothing in the task graph said so. The generictypechecktask depends on^build, the dependencies' build, never the package's own.Measured on this branch's merge base, in a fresh worktree with
OS_SKIP_DTSunset andpackages/plugins/plugin-auth/dist/absent:Turbo built 25 dependency packages via
^buildand never built plugin-auth;dist/was still absent when the run ended.Why this repair, and not the card's other two
The card listed three candidate repairs and deliberately declined to pick. Triage picked by deferring to whichever convention the repo already uses. Measured against the tree:
@objectstack/metadata#test,@objectstack/cli#testandtest:e2eall carrydependsOn: ["build"]— self, no caretsrc/via apathsmappingpaths; every entry maps another package's name to that package'ssrc/, redirects a third-party type root (knex), or is a within-app alias. Not one maps a package's own name to its ownsrc/typecheck:examplestypecheck:-prefixed variant exists in any workspacepackage.json. The convention for a second tsc program is to chain it into the singletypecheckscript with&&— thirteen packages do exactly that (ninetsconfig.scripts.json, threetsconfig.test.json, onetsconfig.examples.json), which is the shape plugin-auth already hasOnly the first follows a convention this repo actually has; the other two would each establish a new one.
That also settles the card's semantic question in the direction that preserves today's behaviour: the examples keep type-checking against the published surface, and the ordering requirement simply becomes explicit. The
pathsprecedents point the other way by design —packages/qa/downstream-contractuses one specifically to move a dependency offdistand ontosrc, and its own comment records that without the rule the types came fromdist— but none of them is self-referential, so nothing in the tree supports doing that to a package's own name.The change
Five lines in
turbo.json, next to the package's existing#testentry:dependsOn: ["build"]alone is sufficient: thebuildtask itself depends on^build, so the dependency closure stays ordered ahead. Both existing self-build entries also list only["build"].inputsis repeated verbatim from the generictypechecktask because package-scoped entries in this file do not merge with the generic definition — every existing package-scoped entry repeats it in full.!dist/**stays. Ordering is now carried by the task dependency, which contributes the build's hash; hashingdist/content as an input is neither needed nor what the convention does.After
Same command, same worktree:
26 tasks to 27 — the declaration added exactly one node to the graph, and both the build and the typecheck were real executions, not cache hits. Turbo's own resolved graph agrees:
CI cost is unchanged: the lint job builds the workspace before type-checking, so plugin-auth's build is a cache hit there.
Gates
Derived at the final commit
2e70f26c1withnode scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack— no hand-written path list; the script takes the change set from the merge base itself.turbo.json, one pathRun anyway, as visibly implicated by the edit:
pnpm check:nul-bytescheck-nul-bytes: OK (scanned 6672 text file(s) -- 6672 tracked, 0 untracked-not-ignored; skipped 6 binary; no raw ASCII control bytes).pnpm check:cross-package-test-inputsOK: 16 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob.turbo run typecheck --filter=@objectstack/plugin-authTasks: 27 successful, 27 totalThe second parses
turbo.jsondirectly in its Layer B, which is why it is here; it inspects onlypkg#testtasks, and this change adds a#typechecktask.Scope
tsconfig.examples.jsonstill exists in exactly one package repo-wide — re-verified,find . -name 'tsconfig.examples*.json' -not -path '*/node_modules/*'returns one path. The card's count holds, so nothing is widened.skip-changeset.@objectstack/plugin-authbuild in a fresh worktree withOS_SKIP_DTSunset — its own typecheck then reds on a diff that never touched it #11907, a different defect in the same package's build-graph neighbourhood — a local turbo cache serving a DTS-less build. It was read before choosing this repair, as triage required, and it remains open and untouched here. No DTS-less artifact appeared during this work: the build above emitted all four declaration files.Generated by Claude Code