Skip to content

Commit c49007a

Browse files
os-warrenclaude
andauthored
fix(plugin-auth): declare plugin-hono-server and put the published example in a tsc program (#11008)
`packages/plugins/plugin-auth/examples/basic-usage.ts` — published by `content/docs/permissions/authentication.mdx` as "Basic Auth Example" — imports `@objectstack/plugin-hono-server`, which this package declared in none of its dependency blocks, so the example could not resolve, compile or run for anyone who copied it (TS2307 at 12,34). Declaring the dependency alone would have been unverifiable: `tsconfig.json` selects `src/**/*`, so `examples/` was in no tsc program at all. A non-emitting sibling `tsconfig.examples.json` named in the `typecheck` script now compiles it, on the `packages/spec` / `packages/objectql` precedent. It type-checks clean under inherited strictness, so the directory graduates out of UNCHECKED_SOURCE_DEBT with zero debt recorded — which RECONCILED forces. Part of #10869 Claude-Session: https://claude.ai/code/session_01PnJHU45vPJj5UQrxe946Bx Co-authored-by: Claude <noreply@anthropic.com>
1 parent d9353b9 commit c49007a

5 files changed

Lines changed: 99 additions & 6 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
"@objectstack/plugin-auth": patch
3+
---
4+
5+
Declare `@objectstack/plugin-hono-server` and put the published auth example in a
6+
tsc program (#10869).
7+
8+
`packages/plugins/plugin-auth/examples/basic-usage.ts` — the file
9+
`content/docs/permissions/authentication.mdx` publishes as "Basic Auth Example" —
10+
imports `HonoServerPlugin` from `@objectstack/plugin-hono-server` on line 12, and
11+
this package declared that dependency in **none** of `dependencies`,
12+
`devDependencies` or `peerDependencies`. (It declares `hono`, which is a different
13+
package.) So the example could not resolve, compile or run for anyone who copied
14+
it out of the docs:
15+
16+
```
17+
examples/basic-usage.ts(12,34): error TS2307: Cannot find module
18+
'@objectstack/plugin-hono-server' or its corresponding type declarations.
19+
```
20+
21+
The declaration is now there (`devDependencies`, `workspace:*` — the example is
22+
development material, and `files` ships only `dist`, so nothing new reaches a
23+
published tarball).
24+
25+
**The dependency alone would have been unverifiable, which is the other half of
26+
this change.** `tsconfig.json` selects `include: ["src/**/*"]`, so `examples/` sat
27+
in no tsc program at all — the type-check-coverage census's only instance of that
28+
— and a manifest edit does not change an `include`. The fix would have had no
29+
compile behind it and the defect could return unseen. So the directory now has a
30+
program: `packages/plugins/plugin-auth/tsconfig.examples.json`, a non-emitting
31+
sibling named in the package's `typecheck` script, following the precedent
32+
`packages/spec/tsconfig.scripts.json` and `packages/objectql/tsconfig.scripts.json`
33+
set. Strictness is inherited, not relaxed, and the directory enters with zero
34+
recorded debt — the example type-checks clean under `strict`, which also measures
35+
that every API it demonstrates (`ObjectKernel.use`/`bootstrap`/`getService`,
36+
`HonoServerPlugin({ port })`, and every `AuthPluginOptions` key it passes) still
37+
exists as written, so it is a working reference rather than a stale one.
38+
39+
Because the directory is now read, `packages/plugins/plugin-auth/examples` leaves
40+
`UNCHECKED_SOURCE_DEBT` in `scripts/check-type-check-coverage.mjs` — the ratchet
41+
shrinks because the thing was repaired, and `RECONCILED` required the deletion in
42+
the same change.

packages/plugins/plugin-auth/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"scripts": {
2222
"build": "tsup",
2323
"test": "vitest run",
24-
"typecheck": "tsc --noEmit"
24+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.examples.json"
2525
},
2626
"dependencies": {
2727
"@better-auth/core": "^1.7.1",
@@ -40,6 +40,7 @@
4040
"devDependencies": {
4141
"@objectstack/driver-sql": "workspace:*",
4242
"@objectstack/objectql": "workspace:*",
43+
"@objectstack/plugin-hono-server": "workspace:*",
4344
"@types/node": "^26.2.0",
4445
"hono": "^4.13.2",
4546
"typescript": "^6.0.3",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// The EXAMPLES-layer type-check program for @objectstack/plugin-auth (#10869).
2+
//
3+
// `packages/plugins/plugin-auth/examples/` held `basic-usage.ts` -- the file
4+
// `content/docs/permissions/authentication.mdx` publishes as "Basic Auth
5+
// Example" -- and no tsc program had ever read a line of it. `tsconfig.json`
6+
// selects `src/**/*`, tsup builds only `src`, and nothing imports it, so it was
7+
// the source census's single instance of a file in NO tsc program at all. What
8+
// that hid: line 12 imports `@objectstack/plugin-hono-server`, which this
9+
// package declared in none of its dependency blocks, so the published example
10+
// could not resolve, compile or run for anyone who copied it.
11+
//
12+
// A SIBLING rather than a wider `include` on `tsconfig.json`, the distinction
13+
// #5475 drew for `packages/spec` and #10756 for `packages/objectql/scripts`,
14+
// and it holds here for the same reason: that config EMITS (`rootDir: "src"`,
15+
// `outDir: "dist"`), so widening it to reach `examples/` would put the
16+
// directory in front of the emit and `rootDir` would reject it -- and `tsup`
17+
// would start shipping the example. This program emits nothing, so it can
18+
// neutralise `rootDir` without touching what ships.
19+
//
20+
// STRICTNESS IS INHERITED and deliberately not relaxed: `strict`,
21+
// `noUnusedLocals`, `noUnusedParameters`, `noImplicitReturns` and the rest come
22+
// from the root config through `tsconfig.json`. The directory type-checks clean
23+
// under them -- it enters with ZERO recorded debt, and there is no ledger here
24+
// to record any in. A published example that does not compile is the finding,
25+
// not a line to write down.
26+
{
27+
"extends": "./tsconfig.json",
28+
"compilerOptions": {
29+
"noEmit": true,
30+
// `.` rather than the inherited `src`, because the file this program checks
31+
// is the one outside `src`. Safe precisely because nothing is emitted from
32+
// here -- see the header.
33+
"rootDir": "."
34+
},
35+
"include": ["examples/**/*"]
36+
}

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/check-type-check-coverage.mjs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,17 +1058,28 @@ const PHANTOM_PIN_DEBT = {};
10581058
// `rootDir` neutralised (it emits nothing) against a built dependency closure on
10591059
// main @ 5886ee6d22. Those counts are prose, deliberately: nothing here compares
10601060
// them, and a number this gate does not read must not look like one it does.
1061+
//
1062+
// GRADUATED SINCE, so the seed count above is a starting line and not a census
1063+
// of what is left: `packages/plugins/plugin-auth/examples` (#10869). Its entry
1064+
// recorded 1 x TS2307 for `@objectstack/plugin-hono-server`, a package
1065+
// plugin-auth declared in none of its dependency blocks -- and the file was the
1066+
// census's only instance of source in NO tsc program at all, which is precisely
1067+
// why the missing dependency could sit in a PUBLISHED example
1068+
// (`content/docs/permissions/authentication.mdx` links it as "Basic Auth
1069+
// Example") without any gate reading it. Repaired on the terms this header
1070+
// names rather than by rewriting the entry: the dependency is declared
1071+
// (`devDependencies`, `workspace:*`) AND `packages/plugins/plugin-auth/
1072+
// tsconfig.examples.json` puts the directory in a program named in that
1073+
// package's `typecheck` script, so the compile that reproduced the TS2307 now
1074+
// runs on every typecheck. It type-checks clean, so it graduated with zero debt
1075+
// recorded anywhere -- and RECONCILED forced the entry out, as this header said
1076+
// it would.
10611077
const UNCHECKED_SOURCE_DEBT = {
10621078
'packages/cli/test': 'One non-test module, `test/helpers/serve-process.ts`, the spawn harness the '
10631079
+ '`os serve` e2e tests share. It measures 0 errors on its own, and it is not separate debt: it '
10641080
+ 'sits inside the hidden test tree already measured by TEST_DEBT[\'@objectstack/cli\'] (56 of '
10651081
+ 'that package\'s 110 test files are outside `include`). Repairing it means repairing that '
10661082
+ 'layer, so this entry graduates with the TEST_DEBT one rather than before it.',
1067-
'packages/plugins/plugin-auth/examples': 'One file, `basic-usage.ts`, and it does not compile: '
1068-
+ '1 x TS2307 for `@objectstack/plugin-hono-server`, which this package declares in NO dependency '
1069-
+ 'block. The census\'s only instance of source in no tsc program AT ALL rather than merely '
1070-
+ 'outside its own package\'s -- nothing imports it, tsup builds only `src`. Repair is a manifest '
1071-
+ 'change or a rewrite, tracked in #10869.',
10721083
'packages/platform-objects/scripts': '`i18n-extract.config.ts`, 1 x TS2883: the inferred type of '
10731084
+ 'its `default` export names a hash-suffixed internal chunk of `@objectstack/spec`\'s dist '
10741085
+ '(`state-machine.zod-<hash>`), so it is non-portable by construction. One of 8 identical '

0 commit comments

Comments
 (0)