Skip to content

fix(bazel): self-anchoring svelte-package wrapper so build works as an external RBE module (TIN-1721) [0.3.1] - #14

Merged
Jess Sullivan (Jesssullivan) merged 2 commits into
mainfrom
fix/tin-1721-svelte-package-rbe-external-module
Jul 5, 2026
Merged

Jess Sullivan (Jesssullivan) merged 2 commits into
mainfrom
fix/tin-1721-svelte-package-rbe-external-module

Conversation

@Jesssullivan

Copy link
Copy Markdown
Contributor

Root cause

tinyland-stores builds green standalone but fails as an external Bazel registry module under RBE: svelte_package -i src resolves relative to process.cwd(), which rules_js leaves at $(BINDIR) with no chdir. As the root package, src sits at $(BINDIR)/src (works). As an external registry dep under the un-vendored tinyland.dev //:app_node_build (--noremote_local_fallback), src lands at $(BINDIR)/external/tummycrypt_tinyland_stores+/src while cwd stays $(BINDIR)-i src misses → 'src does not exist' (GF run 28750623854 — the sole remaining TIN-1721 un-vendoring blocker).

Fix

Replace the raw svelte_package.svelte_package_binary with a thin js_binary over a new self-anchoring build-svelte.mjs wrapper that process.chdir()s to its own copied-to-bin package dir (via import.meta.url) before delegating to @sveltejs/package, so -i src/-o dist resolve in BOTH the root and external-module layouts. A resolve hook pins typescript to the sandboxed toolchain copy. Mirrors the mothership's in-tree build-svelte.mjs + composables' proven wrapper (composables builds green as a registry module in the same graph). Version 0.3.0 → 0.3.1 (MODULE.bazel, BUILD npm_package, package.json).

Validation

Standalone gate green: bazelisk build //:pkg --config=ci → Build completed successfully, 639 actions (confirms no regression to the root-package path). The external-module fix is validated by the tinyland.dev #616 un-vendored RBE proof re-dispatch after registry promotion of 0.3.1 (the layout that can't be reproduced on a single-machine build). Tag v0.3.1 + bazel-registry promotion are the follow-ups.

Jess Sullivan added 2 commits July 5, 2026 15:32
The raw svelte_package.svelte_package_binary resolved `-i src` relative to
process.cwd(), which rules_js leaves at $(BINDIR) with no chdir. That works
when stores is the ROOT package (standalone `bazel build //:pkg`, src at
$(BINDIR)/src) but breaks when stores is consumed as an EXTERNAL registry
module under RBE: src lands at $(BINDIR)/external/<repo>+/src while cwd stays
$(BINDIR), so `-i src` misses and the package build fails.

Replace the generated binary with a thin js_binary wrapper (build-svelte.mjs)
that chdir's to its own copied-to-bin package dir via import.meta.url before
delegating to @sveltejs/package, so `-i src` / `-o dist` resolve correctly in
both the root and external-module layouts. A data-URL module hook pins the
`typescript` resolution to the sandboxed toolchain copy.

Bump 0.3.0 -> 0.3.1 (MODULE.bazel, BUILD.bazel npm_package, package.json).

Gate: `bazelisk build //:pkg --config=ci` -> Build completed successfully
(639 actions); wrapper action `JsRunBinary dist` runs, pkg assembled.
The raw svelte_package_binary was replaced by the js_binary wrapper; its
@sveltejs/package bin loader is no longer referenced.
@Jesssullivan
Jess Sullivan (Jesssullivan) merged commit 1e5a678 into main Jul 5, 2026
4 checks passed
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