Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions packages/adapters/hono/vitest.config.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,8 +9,33 @@ export default defineConfig({
environment: 'node',
},
resolve: {
alias: {
'@objectstack/runtime': path.resolve(__dirname, 'src/__mocks__/runtime.ts'),
},
// ARRAY form, deliberately. The object form matches by PREFIX, so a bare
// key whose replacement is a FILE also swallows that package's subpaths and
// resolves them to `…/index.ts/<subpath>` — ENOTDIR at run time, in a
// config that reads as correct. An anchored regex `find` cannot do that.
// `scripts/check-test-source-alias.mjs` is the authority on the rule.
alias: [
// `src/index.ts` imports createOriginMatcher, hasWildcardPattern,
// DEFAULT_CORS_ALLOW_HEADERS and DEFAULT_CORS_EXPOSE_HEADERS from
// @objectstack/plugin-hono-server as VALUES, at module scope. Without
// this entry the specifier resolves through that package's `exports` to
// its `dist/`, and this suite's verdicts become a function of another
// package's build state: measured on this branch, gutting
// `createOriginMatcher` in plugin-hono-server's SOURCE with no rebuild
// left all 74 cases green — including the five CORS wildcard cases whose
// whole subject that function is.
{
find: /^@objectstack\/plugin-hono-server$/,
replacement: path.resolve(__dirname, '../../plugins/plugin-hono-server/src/index.ts'),
},
// Unchanged in reach from the object entry this array replaced: a bare
// string `find` still matches by prefix, so the kernel mock keeps exactly
// the surface it had. @objectstack/runtime publishes only `.`, so there
// is no subpath here for the prefix to swallow.
{
find: '@objectstack/runtime',
replacement: path.resolve(__dirname, 'src/__mocks__/runtime.ts'),
},
],
},
});
32 changes: 15 additions & 17 deletions scripts/check-test-source-alias.mjs
Original file line numberDiff line numberDiff line change
Expand Up@@ -408,23 +408,21 @@ const KNOWN_UNALIASED_TEST_IMPORTS = {
'@objectstack/service-automation', '@objectstack/spec', '@objectstack/trigger-record-change',
],
'@objectstack/formula': ['@objectstack/spec'],
// #12555 — RE-MEASURED, not widened. `@objectstack/plugin-hono-server` was always
// an unaliased artifact import of this package; the detector could not see it. Its
// import in `src/index.ts` sits directly under `export type EnvironmentDriverRegistry
// = any;`, and the unbounded clause capture above used to start at that `export`,
// run through the `;` and swallow the whole import statement — leaving a clause that
// BEGINS with `type`, which `isTypeOnlyClause` then discarded as type-only. A real
// runtime import was therefore filtered out as erased-at-compile-time. `--list` on
// the corrected detector adds exactly this one pair repo-wide (303 -> 304); the
// sibling gate corroborates it, `check-type-source-resolution.mjs` having carried
// `@objectstack/plugin-hono-server` in ITS entry for this package all along because
// `extractTypeImports` never applies the type-only filter.
// ⚠️ This is a LEDGER CORRECTION, not a remediation: hono's unit verdicts are still a
// function of build state for this pair. The fix the gate prescribes — an anchored
// alias in `packages/adapters/hono/vitest.config.ts` — is filed separately, because
// it makes that suite execute plugin-hono-server's SOURCE and so needs its own
// verification rather than a ride-along in a detector PR.
'@objectstack/hono': ['@objectstack/plugin-hono-server', '@objectstack/types'],
// #12555 recorded `@objectstack/plugin-hono-server` here as a ledger CORRECTION —
// the pair was always unaliased and the detector could not see it, because the
// runtime import in `src/index.ts` sits directly under `export type
// EnvironmentDriverRegistry = any;` and the unbounded clause capture swallowed it
// into a clause that BEGAN with `type`. #12767 is the remediation that took it back
// off: `packages/adapters/hono/vitest.config.ts` now carries an anchored array-form
// alias resolving that specifier to `packages/plugins/plugin-hono-server/src/index.ts`.
// Positive control on the remediation branch, because a suite that passes does not
// say WHICH file it loaded: `createOriginMatcher` gutted in plugin-hono-server's
// SOURCE with no rebuild left all 74 hono cases GREEN before the alias and failed
// exactly the 4 CORS-wildcard cases after it.
// `@objectstack/types` stays: `src/index.ts` imports readEnvWithDeprecation,
// looksLikeInternalErrorLeak, INTERNAL_ERROR_MESSAGE and resolveThrownHttpError from
// it as values, still through `dist/` — a remediation of its own, not this one.
'@objectstack/hono': ['@objectstack/types'],
'@objectstack/http-conformance': [
'@objectstack/core', '@objectstack/driver-sqlite-wasm', '@objectstack/objectql',
'@objectstack/plugin-hono-server', '@objectstack/runtime',
Expand Down
Loading