Skip to content

Commit c2f8324

Browse files
committed
build(auth): resolve @objectstack/service-messaging from source in tsc and vitest
`check:type-source-resolution` and `check:test-source-alias` both refused the new value import: without wiring, plugin-auth's typecheck and its unit tests would render a verdict about the producer's last `pnpm build` rather than about its source in this checkout. - `tsconfig.json` gains one anchored `paths` rule for the bare name, and `rootDir` widens to `packages/` as its consequence -- the same shape `plugin-security` (#11184) and `packages/rest` (#9960) each record. Emit is unaffected: this package builds with tsup and typechecks with `--noEmit`. - `tsconfig.examples.json` widens its own `rootDir` for the same reason. - `vitest.config.ts` gains the matching anchored alias. Neither shrink-only registry is widened. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AUF1NoViznQK32gqpK8wS8
1 parent 6ce4754 commit c2f8324

3 files changed

Lines changed: 42 additions & 6 deletions

File tree

‎packages/plugins/plugin-auth/tsconfig.examples.json‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@
4242
"extends": "./tsconfig.json",
4343
"compilerOptions": {
4444
"noEmit": true,
45-
// `.` rather than the inherited `src`, because the files this program
46-
// checks (`examples/**/*`, `objectstack.config.ts`) sit outside `src`.
47-
// Safe precisely because nothing is emitted from here -- see the header.
48-
"rootDir": "."
45+
// `../..` (= `packages/`) rather than the inherited value, because the
46+
// files this program checks (`examples/**/*`, `objectstack.config.ts`) sit
47+
// outside `src`, and #14762's `paths` rule on the parent config pulls
48+
// `packages/services/service-messaging/src/**` into the program too --
49+
// `rootDir` is enforced over every program file even under `--noEmit`, so
50+
// it has to be the directory containing both. Safe precisely because
51+
// nothing is emitted from here -- see the header.
52+
"rootDir": "../.."
4953
},
5054
"include": ["examples/**/*", "objectstack.config.ts"]
5155
}

‎packages/plugins/plugin-auth/tsconfig.json‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,33 @@
22
"extends": "../../../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "./dist",
5-
"rootDir": "./src",
5+
// [#14762] Widened from `./src` as a CONSEQUENCE of the `paths` rule below,
6+
// the same consequence `packages/plugins/plugin-security/tsconfig.json`
7+
// (#11184) and `packages/rest/tsconfig.json` (#9960) each record:
8+
// redirecting a workspace specifier to its source puts that package's
9+
// `src/**` into this program, and `rootDir` is enforced over every program
10+
// file even under `--noEmit`. `../..` (= `packages/`) is the directory that
11+
// contains every file in the program. Emit is unaffected: this package
12+
// builds with tsup, and `typecheck` passes `--noEmit`.
13+
"rootDir": "../..",
614
"types": [
715
"node"
8-
]
16+
],
17+
// [#14762] `@objectstack/service-messaging` is imported as a VALUE by
18+
// `src/auth-manager.ts` (`normalizeRecipientLocale`, the platform's one
19+
// reader of a `sys_user.locale` at rest — reused rather than copied).
20+
// Without this rule tsc resolves the specifier through the dependency's
21+
// `exports` map — `dist/index.d.ts`, a BUILD ARTIFACT — so this package's
22+
// typecheck would render a verdict about the last `pnpm build` rather than
23+
// about the producer's source in the checkout, which
24+
// `check:type-source-resolution` refuses (its header states why the
25+
// dangerous case is a typecheck that PASSES). ONE rule for the bare name
26+
// only: this package imports no `@objectstack/service-messaging/*` subpath
27+
// — that package declares none — and a `paths` target matching nothing on
28+
// disk would silently fall back to node resolution.
29+
"paths": {
30+
"@objectstack/service-messaging": ["../../services/service-messaging/src/index.ts"]
31+
}
932
},
1033
"include": [
1134
"src/**/*"

‎packages/plugins/plugin-auth/vitest.config.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ export default defineConfig({
2828
find: /^@objectstack\/plugin-security$/,
2929
replacement: path.resolve(here, '../plugin-security/src/index.ts'),
3030
},
31+
// [#14762] `auth-manager.ts` takes a VALUE import on
32+
// `@objectstack/service-messaging` (`normalizeRecipientLocale`). Same
33+
// reason as the entry above, and the same anchoring: a unit test is a
34+
// verdict about the SOURCE in this checkout, so the specifier must not
35+
// resolve to a `dist/` that may predate the edit under test.
36+
{
37+
find: /^@objectstack\/service-messaging$/,
38+
replacement: path.resolve(here, '../../services/service-messaging/src/index.ts'),
39+
},
3140
],
3241
},
3342
});

0 commit comments

Comments
 (0)