Skip to content

fix(#21): lexicon root re-exports + silent build-failure guard + composite spread#22

Merged
lex00 merged 6 commits intomainfrom
fix/lexicon-root-exports-issue-21
May 7, 2026
Merged

fix(#21): lexicon root re-exports + silent build-failure guard + composite spread#22
lex00 merged 6 commits intomainfrom
fix/lexicon-root-exports-issue-21

Conversation

@lex00
Copy link
Copy Markdown
Contributor

@lex00 lex00 commented May 7, 2026

Summary

Closes #21. Three bugs were called out in that issue, plus one I tripped over while verifying the fix end-to-end.

  • gcp/k8s lexicon root indexes were missing re-exports for MultiRegionVpc, GkeCrdbRegion, CockroachDbRegionStack (and their config types) — they were exported from each lexicon's composites/index.ts but not surfaced at the package root, so import { MultiRegionVpc } from "@intentius/chant-lexicon-gcp" failed on a fresh npm install. Existing dev machines hid the gap because node_modules/@intentius/chant-lexicon-* was a symlink into source.
  • chant build silent-success-with-empty-output (the secondary bug in lexicon root index.ts misses three composites — chant build fails silently when examples import them #21): when imports resolved to undefined without being invoked, discovery completed with zero declarables, chant wrote "{}" to the output file and exited 0. First sign of trouble was kubectl apply failing at deploy time. Now: when sourceFileCount > 0 but outputs.size === 0, surface a descriptive error and skip the file write.
  • Composite spread footgun (new): spreading a composite instance (...someComposite) leaked the framework's bookkeeping (members, _definition) into the receiving object. A parent composite that did ...childResult then tripped its own member validation with "is not a Declarable or CompositeInstance". Made members/_definition non-enumerable so spread only exposes actual member resources.
  • Example cleanup: temporal-crdb-deploy had per-region export const cluster = east.cluster re-exports that duplicated the same Declarables under names that collided when chant scanned the full src/ tree (e.g. for build:temporal). Composite expansion already produces uniquely-prefixed names, so the re-exports were redundant.

Verification

  • All 1377 core tests pass.
  • Reproduced and confirmed fixed: silent-exit-0 path with a probe file importing a non-existent symbol — now exits 1 with a clear message and no out.yaml written.
  • Before/after probe inside examples/temporal-crdb-deploy: 10 TS2305 missing-export errors → 0 after the lexicon fix.
  • Built examples/temporal-crdb-deploy end-to-end: all 8 dist artifacts produced (temporal-setup.sh, shared-infra.yaml, {east,central,west}-{infra,k8s}.yaml).

Version bumps

  • @intentius/chant 0.1.6 → 0.1.7 (silent-build-failure guard, composite spread fix)
  • @intentius/chant-lexicon-gcp 0.1.5 → 0.1.6 (root re-exports)
  • @intentius/chant-lexicon-k8s 0.1.5 → 0.1.6 (root re-export)

Release plan

Once this is merged, push these three tags from main to trigger the publish workflows:

git tag chant-v0.1.7
git tag lexicon-gcp-v0.1.6
git tag lexicon-k8s-v0.1.6
git push origin chant-v0.1.7 lexicon-gcp-v0.1.6 lexicon-k8s-v0.1.6

After publish, a fresh cd examples/temporal-crdb-deploy && npm install && npm run build will pick up the new versions and build cleanly.

Test plan

  • CI: npx vitest run passes (1377 tests in core).
  • CI: npm run build per touched lexicon prepack (covered by the existing test job in .github/workflows/publish.yml).
  • Manual: with workspace symlinks, cd examples/temporal-crdb-deploy && npm run build produces 8 dist artifacts with no errors.
  • Manual: probe file with a missing import and no invocation — chant build exits 1, no output file written.

lex00 added 6 commits May 7, 2026 13:23
…gionStack from lexicon roots

These three composites were exported from each lexicon's composites/index.ts
but missing from the lexicon root index.ts. Examples that import them via
@intentius/chant-lexicon-gcp / @intentius/chant-lexicon-k8s — including
examples/temporal-crdb-deploy — failed to resolve the symbols on a fresh
install (existing dev machines hid the gap because their node_modules entries
were symlinks into the source tree).

Fixes #21.
When source files import names that resolve to undefined (e.g. missing
re-exports from a lexicon root) without invoking them, discovery completes
with zero declarables and chant build silently writes "{}" and exits 0.
The first sign of trouble is then "kubectl apply" failing at deploy time.

Add a guard: when sourceFileCount > 0 but outputs.size === 0 (and no other
errors fired), surface a descriptive error and skip the file write. This is
the secondary bug called out in #21.
Spreading a composite instance (`...someComposite`) used to leak the
framework's bookkeeping properties — `members` (the inner CompositeMembers
record) and `_definition` — into the receiving object. When a parent
composite did `...childResult`, its own member validation then saw a
`members` key pointing at a plain object and threw 'is not a Declarable
or CompositeInstance'.

Surfaced in CockroachDbRegionStack which spreads NamespaceEnv's result.
Fix is in the framework so the pattern works for any composite that
delegates to another composite via spread.
- @intentius/chant 0.1.6 → 0.1.7 (silent-build-failure guard, composite
  spread fix)
- @intentius/chant-lexicon-gcp 0.1.5 → 0.1.6 (root re-exports for
  MultiRegionVpc, GkeCrdbRegion)
- @intentius/chant-lexicon-k8s 0.1.5 → 0.1.6 (root re-export for
  CockroachDbRegionStack)
…orts

Each region's infra.ts re-exported individual GkeCrdbRegion members under
short names (`cluster`, `nodePool`, `dnsZone`, ...). Composite expansion
already produces uniquely-prefixed names (`eastCluster`, `centralCluster`,
`westCluster`, ...), so the re-exports were duplicating the same
underlying Declarables under names that collided when chant scanned the
full src/ tree (e.g. for `build:temporal`).
Reflects @intentius/chant 0.1.7, lexicon-gcp/k8s 0.1.6 in the workspace
lockfile. No transitive dep changes.
@lex00 lex00 force-pushed the fix/lexicon-root-exports-issue-21 branch from 2c2a056 to da77b53 Compare May 7, 2026 19:23
@lex00 lex00 merged commit 80f02dd into main May 7, 2026
9 checks passed
@lex00 lex00 deleted the fix/lexicon-root-exports-issue-21 branch May 7, 2026 19:28
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.

lexicon root index.ts misses three composites — chant build fails silently when examples import them

1 participant