From da49e9d630d2d8e5dbf9d77bd5623a1a43e6bed0 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Sep 2026 03:30:08 +0000 Subject: [PATCH] fix(driver-memory,plugin-hono-server): put both objectstack.config.ts manifests inside a tsc program and import ObjectStackManifest from /kernel Both in-repo manifest authoring sites imported `ObjectStackManifest` from `@objectstack/spec/system`, an entry that does not export it, and neither file was read by any tsc program: `tsconfig.json` selects `src/**/*` in both packages and the manifests sit at the package root, so the glob cannot match them. `pnpm --filter ... typecheck` exited 0 with a wrong import in the file. Two moves per package: 1. `import type { ObjectStackManifest } from '@objectstack/spec/kernel'` -- the real home of the type (`kernel/manifest.zod.ts`, re-exported by `kernel/index.ts`). It is a type alias only (`export type ... = z.input<...>`), so the import is type-only and nothing published changes. 2. A sibling `tsconfig.typecheck.json` per package -- `noEmit: true`, `rootDir: "."`, `include: ["objectstack.config.ts"]` -- named by the package's `typecheck` script. Measured: adding the file to the EMITTING `tsconfig.json` raises TS6059 in both packages, under `--noEmit` too, so the sibling shape (`packages/objectql/tsconfig.scripts.json`, `packages/plugins/plugin-auth/tsconfig.examples.json`) is the right one -- it neutralises `rootDir` without putting the manifest in front of the emit. The tsc half of the `retiredKey()` double channel (ADR-0049, #11332/#10724/ #4914) now reaches the only two places in this repo where a plugin manifest is authored in TypeScript. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_0112hMx9hjJ9BgB28X97DS68 --- .../driver-memory/objectstack.config.ts | 2 +- packages/drivers/driver-memory/package.json | 2 +- .../driver-memory/tsconfig.typecheck.json | 41 +++++++++++++++++++ .../plugin-hono-server/objectstack.config.ts | 2 +- .../plugins/plugin-hono-server/package.json | 2 +- .../tsconfig.typecheck.json | 41 +++++++++++++++++++ 6 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 packages/drivers/driver-memory/tsconfig.typecheck.json create mode 100644 packages/plugins/plugin-hono-server/tsconfig.typecheck.json diff --git a/packages/drivers/driver-memory/objectstack.config.ts b/packages/drivers/driver-memory/objectstack.config.ts index 1028c00472..53a8474493 100644 --- a/packages/drivers/driver-memory/objectstack.config.ts +++ b/packages/drivers/driver-memory/objectstack.config.ts @@ -1,6 +1,6 @@ // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. -import { ObjectStackManifest } from '@objectstack/spec/system'; +import type { ObjectStackManifest } from '@objectstack/spec/kernel'; /** * In-Memory Driver Plugin Manifest diff --git a/packages/drivers/driver-memory/package.json b/packages/drivers/driver-memory/package.json index 88d91bbaf0..bb8a002824 100644 --- a/packages/drivers/driver-memory/package.json +++ b/packages/drivers/driver-memory/package.json @@ -16,7 +16,7 @@ "build": "tsup --config ../../../tsup.config.ts && node ../../../scripts/check-dts-emitted.mjs", "dev": "tsc -w", "test": "vitest run", - "typecheck": "tsc --noEmit" + "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.typecheck.json" }, "dependencies": { "@objectstack/core": "workspace:*", diff --git a/packages/drivers/driver-memory/tsconfig.typecheck.json b/packages/drivers/driver-memory/tsconfig.typecheck.json new file mode 100644 index 0000000000..526156f5fb --- /dev/null +++ b/packages/drivers/driver-memory/tsconfig.typecheck.json @@ -0,0 +1,41 @@ +// The MANIFEST-layer type-check program for @objectstack/driver-memory (#13284). +// +// `objectstack.config.ts` sits at the PACKAGE ROOT and declares this driver's +// plugin manifest, annotated `ObjectStackManifest`. Until this file existed no +// tsc program read a line of it: `tsconfig.json` selects `src/**/*`, and that +// glob cannot match a root-level file. The annotation was therefore decorative +// -- the file imported the type from `@objectstack/spec/system`, an entry that +// does not export it, and `pnpm --filter @objectstack/driver-memory typecheck` +// still exited 0. A wrong key or a wrong import here cost nothing at author +// time, which is the whole defect: the ADR-0049 manifest retirements +// (#11332 / #10724 / #4914) lean on the `retiredKey()` DOUBLE channel -- tsc +// (input typed `never`) plus parse -- and the tsc half was blind at the only +// two places in this repo where a plugin manifest is authored in TypeScript. +// +// A SIBLING rather than a wider `include` on `tsconfig.json`, the distinction +// #5475 drew for `packages/spec` and #10756 for `packages/objectql/scripts`: +// that config EMITS (`rootDir: "./src"`, `outDir: "./dist"`, and `dev` runs +// `tsc -w` through it), so widening it to reach the package root would put the +// manifest in front of the emit -- measured, that is exactly TS6059 ("File +// ... is not under 'rootDir' ... 'rootDir' is expected to contain all source +// files"), and it fires under `--noEmit` too. This program emits nothing, so +// it can neutralise `rootDir` without touching what ships. `tsup` builds +// `src/index.ts` and `files` publishes `dist` only, so nothing about the +// published package moves. +// +// STRICTNESS IS INHERITED and deliberately not relaxed: `strict`, +// `esModuleInterop`, `forceConsistentCasingInFileNames` and the rest come from +// the root config through `tsconfig.json`. The manifest type-checks clean +// under them -- it enters with ZERO recorded debt, and there is no ledger here +// to record any in. +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": true, + // `.` rather than the inherited `src`, because the file this program checks + // is the one outside `src`. Safe precisely because nothing is emitted from + // here -- see the header. + "rootDir": "." + }, + "include": ["objectstack.config.ts"] +} diff --git a/packages/plugins/plugin-hono-server/objectstack.config.ts b/packages/plugins/plugin-hono-server/objectstack.config.ts index 5b902ebbdf..7af2af28d2 100644 --- a/packages/plugins/plugin-hono-server/objectstack.config.ts +++ b/packages/plugins/plugin-hono-server/objectstack.config.ts @@ -1,6 +1,6 @@ // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. -import { ObjectStackManifest } from '@objectstack/spec/system'; +import type { ObjectStackManifest } from '@objectstack/spec/kernel'; /** * Hono Server Plugin Manifest diff --git a/packages/plugins/plugin-hono-server/package.json b/packages/plugins/plugin-hono-server/package.json index 42f82145f8..ccb8740bf1 100644 --- a/packages/plugins/plugin-hono-server/package.json +++ b/packages/plugins/plugin-hono-server/package.json @@ -15,7 +15,7 @@ "scripts": { "build": "tsup --config ../../../tsup.config.ts && node ../../../scripts/check-dts-emitted.mjs", "test": "vitest run", - "typecheck": "tsc --noEmit" + "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.typecheck.json" }, "dependencies": { "@hono/node-server": "^2.1.1", diff --git a/packages/plugins/plugin-hono-server/tsconfig.typecheck.json b/packages/plugins/plugin-hono-server/tsconfig.typecheck.json new file mode 100644 index 0000000000..cc3a22c3ac --- /dev/null +++ b/packages/plugins/plugin-hono-server/tsconfig.typecheck.json @@ -0,0 +1,41 @@ +// The MANIFEST-layer type-check program for @objectstack/plugin-hono-server +// (#13284). +// +// `objectstack.config.ts` sits at the PACKAGE ROOT and declares this adapter's +// plugin manifest, annotated `ObjectStackManifest`. Until this file existed no +// tsc program read a line of it: `tsconfig.json` selects `src/**/*`, and that +// glob cannot match a root-level file. The annotation was therefore decorative +// -- the file imported the type from `@objectstack/spec/system`, an entry that +// does not export it, and `pnpm --filter @objectstack/plugin-hono-server +// typecheck` still exited 0. A wrong key or a wrong import here cost nothing at +// author time, which is the whole defect: the ADR-0049 manifest retirements +// (#11332 / #10724 / #4914) lean on the `retiredKey()` DOUBLE channel -- tsc +// (input typed `never`) plus parse -- and the tsc half was blind at the only +// two places in this repo where a plugin manifest is authored in TypeScript. +// +// A SIBLING rather than a wider `include` on `tsconfig.json`, the distinction +// #5475 drew for `packages/spec` and #10756 for `packages/objectql/scripts`: +// that config EMITS (`rootDir: "./src"`, `outDir: "./dist"`, `declaration: +// true`), so widening it to reach the package root would put the manifest in +// front of the emit -- measured, that is exactly TS6059 ("File ... is not under +// 'rootDir' ... 'rootDir' is expected to contain all source files"), and it +// fires under `--noEmit` too. This program emits nothing, so it can neutralise +// `rootDir` without touching what ships. `tsup` builds `src/index.ts` and +// `files` publishes `dist` only, so nothing about the published package moves. +// +// STRICTNESS IS INHERITED and deliberately not relaxed: `strict`, +// `esModuleInterop` and the NodeNext module semantics all come from +// `tsconfig.json`, which -- unlike its `driver-memory` twin -- extends nothing +// and is self-contained. The manifest type-checks clean under them: it enters +// with ZERO recorded debt, and there is no ledger here to record any in. +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": true, + // `.` rather than the inherited `src`, because the file this program checks + // is the one outside `src`. Safe precisely because nothing is emitted from + // here -- see the header. + "rootDir": "." + }, + "include": ["objectstack.config.ts"] +}