Skip to content

fix(bazel): make //:pkg consumable as an external Bzlmod module#106

Merged
Jesssullivan merged 1 commit into
mainfrom
codex/fix-external-module-pkg-output
Jun 11, 2026
Merged

fix(bazel): make //:pkg consumable as an external Bzlmod module#106
Jesssullivan merged 1 commit into
mainfrom
codex/fix-external-module-pkg-output

Conversation

@Jesssullivan

Copy link
Copy Markdown
Owner

Summary

scheduling-bridge is adopting pure-Bazel consumption of the kit (bazel_dep + npm_link_package of @tummycrypt_scheduling_kit//:pkg, refs Jesssullivan/scheduling-bridge#82). As the first non-leaf module consumed through the tinyland-inc/bazel-registry module graph, two latent defects surfaced:

  1. Empty dist/ in external-module builds. scripts/svelte-package-bazel-wrapper.mjs resolved -o dist against the action cwd (BAZEL_BINDIR root). When this module is built as an external module, declared outputs live under bazel-out/.../bin/external/tummycrypt_scheduling_kit+/, so svelte-package wrote outside the declared tree and Bazel silently packaged an empty dist/ (declared tree artifacts are tolerated empty). The wrapper now anchors the output next to the resolved input tree artifact, which is correct in both the own-workspace and external-module contexts.

  2. No npm store entries for runtime deps. //:scheduling_kit declared no npm deps, so consumers linking //:pkg had no package-store siblings for the kit's runtime dependencies and failed at import time (ERR_MODULE_NOT_FOUND: zod). drizzle-orm and zod are now declared on the packaged js_library. effect is deliberately NOT linked: consumers declare their own copy and effect values cross the package boundary (re-exported Errors), so a second linked copy forks runtime identity (instanceof) and breaks consumer declaration emit (TS2742).

Validation

  • This workspace: bazel build //:pkg //:typecheck and bazel test //:test green (local, disk cache, no RBE); bazel-bin/pkg/dist populated as before.
  • Consumer proof: scheduling-bridge //:pkg, //:typecheck, //:test (158 vitest tests) green consuming this tree via --override_module=tummycrypt_scheduling_kit=<this checkout>.

Release plan: 0.9.1 patch release follows, then registration in tinyland-inc/bazel-registry, then the bridge bumps its bazel_dep to 0.9.1.

Refs Jesssullivan/scheduling-bridge#82

Two defects surfaced when scheduling-bridge consumed this module via
bazel_dep + npm_link_package (the first non-leaf consumer):

- scripts/svelte-package-bazel-wrapper.mjs resolved the -o output against
  the action cwd (BAZEL_BINDIR root). In an external-module build the
  declared output tree lives under bazel-out/.../bin/external/<repo>/, so
  svelte-package wrote outside the declared output and Bazel silently
  packaged an empty dist/. The output is now anchored next to the resolved
  input tree artifact, which is correct in both repo contexts.
- //:scheduling_kit declared no npm deps, so consumers linking //:pkg got
  no package store entries for the kit's runtime dependencies and failed
  at import time (ERR_MODULE_NOT_FOUND on zod). drizzle-orm and zod are
  now declared; effect is deliberately left to the consumer's copy so
  effect identity stays shared across the package boundary.

Validated: //:pkg, //:typecheck, //:test green in this workspace, and
scheduling-bridge //:pkg //:typecheck //:test green consuming this tree
via --override_module.

Refs: scheduling-bridge#82
@Jesssullivan Jesssullivan merged commit 56e42a6 into main Jun 11, 2026
5 checks passed
Jesssullivan added a commit that referenced this pull request Jun 11, 2026
- package.json, MODULE.bazel, BUILD.bazel aligned at 0.9.1
- regenerate docs/generated surfaces

Patch release carrying the external-Bzlmod-module packaging fix (#106)
so scheduling-bridge can consume //:pkg from the module graph
(refs Jesssullivan/scheduling-bridge#82).
@Jesssullivan Jesssullivan deleted the codex/fix-external-module-pkg-output branch June 11, 2026 18:19
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