Skip to content

Commit 2fb2e3f

Browse files
os-steveclaude
andauthored
fix(test): list the published FILE subpaths ahead of the bare @objectstack/core / @objectstack/types alias entries (#9892)
* fix(test): list the published FILE subpaths ahead of the bare `@objectstack/core` / `@objectstack/types` alias entries A string `find` in a vitest alias table matches by PREFIX, so a bare entry with a FILE replacement swallows the package's published subpaths: `@objectstack/core/logger` resolved to `…/core/src/index.ts/logger` and `@objectstack/types/node` to `…/types/src/index.ts/node` — ENOTDIR at run time, in a config that reads as correct, reported against whichever module performed the import rather than against the table. Measured on main: 11 (config, subpath) pairs across 8 configs — 7 for `./logger`, 4 for `./node`. All of them latent: `check:test-source-alias` rule 5 only judges a specifier a test graph actually reaches, and none of these had been reached yet. Also adds the reachability-independent half to that gate: every subpath a workspace package publishes in its own `exports` map is now resolved through every config's alias table, so the next such pair fails at the table instead of on whoever first writes the import. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja * test(tooling): report the published-subpath population on the gate's green line The #9674 rule added a second scanned population (every subpath a workspace package publishes in its own `exports` map) and a census guard for the exact zero, but the OK line printed only the two older readings. A population that silently shrinks — 43 to 1, say, from an `exports` read that regresses to the first key — clears the zero guard and reads as a spotless repo, which is the #4690 failure this file's census convention exists to refuse. The number a human actually reads is on the green line, so it belongs there. Self-test pins it as a positive NUMBER, not just non-zero: returning it under a different name from `check()` passes every failure assertion and prints `undefined published subpath(s)`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent a065e46 commit 2fb2e3f

9 files changed

Lines changed: 299 additions & 6 deletions

File tree

packages/drivers/driver-memory/vitest.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ export default defineConfig({
1010
},
1111
resolve: {
1212
alias: [
13+
// Subpath BEFORE the bare package: `@objectstack/core` is a PREFIX match with a
14+
// FILE replacement, so without this entry it swallows the published `./logger`
15+
// subpath and resolves it to `…/core/src/index.ts/logger` — ENOTDIR at run time.
16+
// Pinned by the published-subpath rule in `scripts/check-test-source-alias.mjs`,
17+
// which derives the population from `@objectstack/core`'s own `exports` map.
18+
{ find: /^@objectstack\/core\/logger$/, replacement: path.resolve(__dirname, '../../core/src/logger.ts') },
1319
{ find: '@objectstack/core', replacement: path.resolve(__dirname, '../../core/src/index.ts') },
20+
// Subpath BEFORE the bare package, same prefix-match reason: `./node` is a
21+
// published subpath served by a FILE (`types/src/node.ts` — the node-only slice
22+
// the root export deliberately excludes), so the bare entry would resolve it to
23+
// `…/types/src/index.ts/node`. Same published-subpath rule pins it.
24+
{ find: /^@objectstack\/types\/node$/, replacement: path.resolve(__dirname, '../../types/src/node.ts') },
1425
// [ADR-0105 D1] `resolveTenancyPosture()`, read by the #6915 tenancy guard.
1526
{ find: '@objectstack/types', replacement: path.resolve(__dirname, '../../types/src/index.ts') },
1627
// #9457: ONE anchored rule for every `@objectstack/spec` namespace, in place

packages/drivers/driver-sql/vitest.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ export default defineConfig({
3737
replacement: path.join(path.resolve(__dirname, '../..'), 'spec/src/$1/index.ts'),
3838
},
3939
{ find: /^@objectstack\/spec$/, replacement: path.resolve(__dirname, '../../spec/src/index.ts') },
40+
// Subpath BEFORE the bare package: `@objectstack/core` is a PREFIX match with a
41+
// FILE replacement, so without this entry it swallows the published `./logger`
42+
// subpath and resolves it to `…/core/src/index.ts/logger` — ENOTDIR at run time.
43+
// Pinned by the published-subpath rule in `scripts/check-test-source-alias.mjs`,
44+
// which derives the population from `@objectstack/core`'s own `exports` map.
45+
{ find: /^@objectstack\/core\/logger$/, replacement: path.resolve(__dirname, '../../core/src/logger.ts') },
4046
{ find: '@objectstack/core', replacement: path.resolve(__dirname, '../../core/src/index.ts') },
4147
],
4248
},

packages/metadata/vitest.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import path from 'node:path';
66
export default defineConfig({
77
resolve: {
88
alias: [
9+
// Subpath BEFORE the bare package: `@objectstack/core` is a PREFIX match with a
10+
// FILE replacement, so without this entry it swallows the published `./logger`
11+
// subpath and resolves it to `…/core/src/index.ts/logger` — ENOTDIR at run time.
12+
// Pinned by the published-subpath rule in `scripts/check-test-source-alias.mjs`,
13+
// which derives the population from `@objectstack/core`'s own `exports` map.
14+
{ find: /^@objectstack\/core\/logger$/, replacement: path.resolve(__dirname, '../core/src/logger.ts') },
915
{ find: '@objectstack/core', replacement: path.resolve(__dirname, '../core/src/index.ts') },
1016
// #9457: ONE anchored rule for every `@objectstack/spec` namespace, in place
1117
// of the hand-maintained list of the subpaths this package's tests happened
@@ -37,6 +43,11 @@ export default defineConfig({
3743
replacement: path.join(path.resolve(__dirname, '..'), 'spec/src/$1/index.ts'),
3844
},
3945
{ find: /^@objectstack\/spec$/, replacement: path.resolve(__dirname, '../spec/src/index.ts') },
46+
// Subpath BEFORE the bare package, same prefix-match reason: `./node` is a
47+
// published subpath served by a FILE (`types/src/node.ts` — the node-only slice
48+
// the root export deliberately excludes), so the bare entry would resolve it to
49+
// `…/types/src/index.ts/node`. Same published-subpath rule pins it.
50+
{ find: /^@objectstack\/types\/node$/, replacement: path.resolve(__dirname, '../types/src/node.ts') },
4051
{ find: '@objectstack/types', replacement: path.resolve(__dirname, '../types/src/index.ts') },
4152
],
4253
},

packages/plugins/knowledge-memory/vitest.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ export default defineConfig({
1010
},
1111
resolve: {
1212
alias: [
13+
// Subpath BEFORE the bare package: `@objectstack/core` is a PREFIX match with a
14+
// FILE replacement, so without this entry it swallows the published `./logger`
15+
// subpath and resolves it to `…/core/src/index.ts/logger` — ENOTDIR at run time.
16+
// Pinned by the published-subpath rule in `scripts/check-test-source-alias.mjs`,
17+
// which derives the population from `@objectstack/core`'s own `exports` map.
18+
{ find: /^@objectstack\/core\/logger$/, replacement: path.resolve(__dirname, '../../core/src/logger.ts') },
1319
{ find: '@objectstack/core', replacement: path.resolve(__dirname, '../../core/src/index.ts') },
1420
{
1521
find: '@objectstack/service-knowledge',

packages/plugins/knowledge-ragflow/vitest.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ export default defineConfig({
1010
},
1111
resolve: {
1212
alias: [
13+
// Subpath BEFORE the bare package: `@objectstack/core` is a PREFIX match with a
14+
// FILE replacement, so without this entry it swallows the published `./logger`
15+
// subpath and resolves it to `…/core/src/index.ts/logger` — ENOTDIR at run time.
16+
// Pinned by the published-subpath rule in `scripts/check-test-source-alias.mjs`,
17+
// which derives the population from `@objectstack/core`'s own `exports` map.
18+
{ find: /^@objectstack\/core\/logger$/, replacement: path.resolve(__dirname, '../../core/src/logger.ts') },
1319
{ find: '@objectstack/core', replacement: path.resolve(__dirname, '../../core/src/index.ts') },
1420
{
1521
find: '@objectstack/service-knowledge',

packages/plugins/plugin-dev/vitest.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@ export default defineConfig({
1515
},
1616
resolve: {
1717
alias: [
18+
// Subpath BEFORE the bare package: `@objectstack/core` is a PREFIX match with a
19+
// FILE replacement, so without this entry it swallows the published `./logger`
20+
// subpath and resolves it to `…/core/src/index.ts/logger` — ENOTDIR at run time.
21+
// Pinned by the published-subpath rule in `scripts/check-test-source-alias.mjs`,
22+
// which derives the population from `@objectstack/core`'s own `exports` map.
23+
{ find: /^@objectstack\/core\/logger$/, replacement: path.resolve(__dirname, '../../core/src/logger.ts') },
1824
{ find: '@objectstack/core', replacement: path.resolve(__dirname, '../../core/src/index.ts') },
25+
// Subpath BEFORE the bare package, same prefix-match reason: `./node` is a
26+
// published subpath served by a FILE (`types/src/node.ts` — the node-only slice
27+
// the root export deliberately excludes), so the bare entry would resolve it to
28+
// `…/types/src/index.ts/node`. Same published-subpath rule pins it.
29+
{ find: /^@objectstack\/types\/node$/, replacement: path.resolve(__dirname, '../../types/src/node.ts') },
1930
{ find: '@objectstack/types', replacement: path.resolve(__dirname, '../../types/src/index.ts') },
2031
// #9457: ONE anchored rule for every `@objectstack/spec` namespace, in place
2132
// of the hand-maintained list of the subpaths this package's tests happened

packages/plugins/plugin-hono-server/vitest.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ export default defineConfig({
1010
},
1111
resolve: {
1212
alias: [
13+
// Subpath BEFORE the bare package: `@objectstack/core` is a PREFIX match with a
14+
// FILE replacement, so without this entry it swallows the published `./logger`
15+
// subpath and resolves it to `…/core/src/index.ts/logger` — ENOTDIR at run time.
16+
// Pinned by the published-subpath rule in `scripts/check-test-source-alias.mjs`,
17+
// which derives the population from `@objectstack/core`'s own `exports` map.
18+
{ find: /^@objectstack\/core\/logger$/, replacement: path.resolve(__dirname, '../../core/src/logger.ts') },
1319
{ find: '@objectstack/core', replacement: path.resolve(__dirname, '../../core/src/index.ts') },
1420
{ find: '@objectstack/observability', replacement: path.resolve(__dirname, '../../observability/src/index.ts') },
1521
// #9457: ONE anchored rule for every `@objectstack/spec` namespace, in place

packages/runtime/vitest.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ export default defineConfig({
9292
replacement: path.join(path.resolve(__dirname, '..'), 'spec/src/$1/index.ts'),
9393
},
9494
{ find: /^@objectstack\/spec$/, replacement: path.resolve(__dirname, '../spec/src/index.ts') },
95+
// Subpath BEFORE the bare package, same prefix-match reason: `./node` is a
96+
// published subpath served by a FILE (`types/src/node.ts` — the node-only slice
97+
// the root export deliberately excludes), so the bare entry would resolve it to
98+
// `…/types/src/index.ts/node`. Same published-subpath rule pins it.
99+
{ find: /^@objectstack\/types\/node$/, replacement: path.resolve(__dirname, '../types/src/node.ts') },
95100
{ find: '@objectstack/types', replacement: path.resolve(__dirname, '../types/src/index.ts') },
96101
// Dev-only: app-plugin.jobs.test.ts drives the REAL CronJobAdapter, so
97102
// the #4567 regression (croner rejecting the expression envelope) is

0 commit comments

Comments
 (0)