From 8956cac0eacbe3a3c34e72adf0eaea25f0603192 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 30 Aug 2026 03:54:09 +0000 Subject: [PATCH 1/2] test(hono): resolve @objectstack/plugin-hono-server to source in the unit suite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `packages/adapters/hono/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, and the suite's vitest config aliased only @objectstack/runtime — so that specifier resolved through the dependency's `exports` to its `dist/`, making this package's unit verdicts a function of another package's build state. The alias is added in ARRAY form with an anchored regex `find`; the existing @objectstack/runtime entry is carried over unchanged in reach (a bare string `find` still matches by prefix). Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01TvqBFLRzXdSPcbusDoED9k --- packages/adapters/hono/vitest.config.ts | 31 ++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/packages/adapters/hono/vitest.config.ts b/packages/adapters/hono/vitest.config.ts index e2051df210..d0bd8f175c 100644 --- a/packages/adapters/hono/vitest.config.ts +++ b/packages/adapters/hono/vitest.config.ts @@ -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/` — 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'), + }, + ], }, }); From 8ea75a24157f057976cb86226d36a1698ae56dd0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 30 Aug 2026 04:01:36 +0000 Subject: [PATCH 2/2] chore(gates): shrink the @objectstack/hono ledger entry to what is still unaliased `check-test-source-alias` audits `KNOWN_UNALIASED_TEST_IMPORTS` for set EQUALITY, so the alias added in the previous commit makes the entry stale and the gate names the exact narrowing. Repo-wide the ledger goes 303 -> 302 (package, unaliased dep) pairs across an unchanged 61 packages; the only registry line that moves is hono's, and it only loses a member. `@objectstack/types` stays on the entry: hono's `src/index.ts` still imports four values from it through `dist/`. That is a separate remediation. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01TvqBFLRzXdSPcbusDoED9k --- scripts/check-test-source-alias.mjs | 32 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/scripts/check-test-source-alias.mjs b/scripts/check-test-source-alias.mjs index 16b902e40e..9fda70f466 100644 --- a/scripts/check-test-source-alias.mjs +++ b/scripts/check-test-source-alias.mjs @@ -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',