Repository navigation
fix(codegen-ts): make meta docs honour routesFile expose option - #424
Merged
Merged
Conversation
…tion The API pages listed all five verbs for an entity whose routes file mounts fewer. Routes generators now carry the option in a mountsRoutes marker and meta docs documents only the verbs mounted. Output without expose is byte-identical.
… generators only Assisted-by: no-mistakes:claude:claude-sonnet-5-5
…a gen runner Assisted-by: no-mistakes:claude:claude-sonnet-5-5
Assisted-by: no-mistakes:claude:claude-haiku-5-5
A narrowed Fastify routes file beside a default Hono one (or the reverse) made the shared verb list undefined, so the narrowed surface documented all five verbs. Each API docs surface now reads the expose of the generators that produce it.
…urface semantics Assisted-by: no-mistakes:claude:claude-haiku-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
routesFile({ expose })androutesFileHono({ expose })now emit amountsRoutesmarker on the generator.runRoutesExposeincodegen-tsreads it off the resolved suite per routes surface (Fastify and Hono separately), andmeta docspasses the result to the API pages. A narrowed surface documents only the verbs it mounts, soDELETEno longer appears for an entity exposed as["list", "get"]. Output withoutexposeis byte-identical.api-modeland the API docs generator apply the per-surface expose.updatelists bothPATCHandPUT, and a read-only projection or report still listsGET. A TPH base is narrowed from its read-only pair. Covered bycodegen-ts/test/api-docs-expose.test.tsandcli/test/docs-expose.test.ts.mountsRoutesmarker to be honoured. Re-runmeta eject routes --force(orroutes-hono --force), or add the marker by hand. Documented inCHANGELOG.mdanddocs/features/own-your-codegen.md. TypeScript only.🤖 Generated with Claude Code
Validation
Risk Assessment
✅ Low: Docs-only behavior change gated on an opt-in marker; output without
exposeis unchanged, verb logic matches the routes generators, and earlier review decisions are honored.Testing
Drove
meta docslive against four disposable projects built from ejected reference routes generators. Narrowedexpose: [list,get]lists only GET verbs. Control with no expose lists all five verbs.expose: [get]lists only GET by id. Mixed Fastify-narrowed plus default Hono keeps Fastify REST narrow and Hono full, per surface. Targeted tests, the full cli and codegen-ts suites, and typecheck all pass. Scenario "meta gen with apiDocsFile()" was not tested, per the recorded decision that meta gen skips api-docs by design. Full server-widebun testwas not run, per the recorded instruction (machine overloaded); cli and codegen-ts suites run instead.Evidence: narrow api page (expose list,get)
Evidence: control api page (no expose)
Evidence: getonly api page (expose get)
Evidence: mixed api page (Fastify narrow, Hono default)
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainsbun test test/docs-expose.test.ts(cli): 4 passbun test test/api-docs-expose.test.ts(codegen-ts): 10 passbun run buildin codegen-ts and cli (dist rebuilt from current source)Live: disposable projects under evidence dir, ejected referenceroutes.ts/routes-hono.tsintocodegen/generators/, ranbun dist/bin/meta.js docs . --out docs-out(exit 0 for all four)Live scenario check: grep of verbs in generatedapi/AuditEntry.mdper projectbun testfull cli package: 1473 tests, 0 failbun testfull codegen-ts package: 2555 tests, 0 failbun run typecheckin cli and codegen-ts: cleanConfirmed noroutesExposethreading remains in codegen-ts runner.ts (only docs.ts path, per recorded decision)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Test evidence (maintainer-recorded)
e1cceb2566c649de38fce96daf75e9160e0c068a(the pushed head), suites run one after the other.server/typescript/packages/cli: 1470 pass, 3 skip, 0 fail.server/typescript/packages/codegen-ts: 2555 pass, 0 fail. Workspace typecheck clean.meta docs and routesFile({ expose }) > a routes generator that exposes list and get documents no write verband the two mixed cases (narrowed Fastify beside default Hono, and the reverse) incli/test/docs-expose.test.ts, and byeach routes surface documents its own generator's exposeplusapi docs follow the routes generator's expose optionincodegen-ts/test/api-docs-expose.test.ts, which also asserts that output withoutexposeequals exposing every verb.meta gen+apiDocsFile()scenario cannot exist:meta genskips api-docs with a warning by design (ADR-0025), pinned byrunner-docs-shim.test.ts.server/typescriptsuite did not complete under machine load in the first run (about 30 minutes with no output) and was not run again.