Repository navigation
feat: resolve the library from a registry, behind remoteCoreLib - #131
Merged
Merged
Conversation
A scope's clients/dagger is the prebuilt bundle: ~5MB of core.js and its declarations, vendored per scope. Now that core, session, module and telemetry are published, it can be the facade's own source over them instead — the same package surface, 16K against 5.2M, shared between scopes by the resolver rather than copied. Off by default, and that is the point. The versions pinned are the ones the bundle was built against, so an engine whose core was never published has nothing to resolve, and there is no way to know that short of asking a registry. Carrying the bundle is the only thing that always works, so it stays the default until the fallback has an answer. This is step 5 of design/package-split.md, available rather than taken. The facade source is not written by the SDK. The packager copies src/index.ts and src/connection.ts into library/bundle/facade/ with a manifest, so what a module sees cannot drift from what the library exports, and library-bundle keeps it honest. Versions are pinned rather than ranged: core at the engine release the bundle announces, the other three at their committed manifests. The entrypoint guard had to learn about it. It requires clients/dagger's client.gen.ts and core.js, neither of which exists in this layout, so it would refuse to run a correctly generated module — hence --remote-core-lib through codegen to drop those two from the required set. One swap point, because every generated file already imports @dagger.io/dagger and nothing else: corePackage. The module's own package.json does not change at all, and neither does a client's — clients/hello still depends on file:../dagger either way. e2e:generate/remote-core-lib-check holds both shapes, and goes red if the setting stops being honoured. Verified beyond that by hand: a module generated with --remote-core-lib installs from npmjs and runs, `dagger call` returning through a real dag query, while a module generated without it is byte-for-byte the 5.2M it was. Full inner suite: 127 passed. Signed-off-by: Tom Chauveau <[email protected]>
Under remoteCoreLib a client named the scope's local facade by file:../dagger, which made it a thing that only works inside the scope that generated it. It now names the published packages it actually imports. Both of them, because its runtime lives in two places: Context and BaseClient in @dagger.io/session, dag and every core type in @dagger.io/core. session exports the pair, so one specifier still covers that import line. loader.gen.ts and compat.gen.ts keep the facade specifier on purpose. They sit flat in clients/ rather than in a package of their own, they are module-internal, and the module's own dependency on the facade already covers them — so pointing them at core would mean declaring core in the module's package.json and extending config-updater to write a version where it writes paths, for no gain. Found while doing it: **the facade never declared @dagger.io/session**, though index.ts re-exports from it in three places. npm hid that by hoisting it as a transitive dependency of core and module; Deno refuses an undeclared transitive import, so it would have failed there and nowhere else. The check now asserts all four, and goes red without it. Verified: a client's manifest names core and session and not file:../dagger, its source imports from session and nothing from the facade, one deduped copy of each lands in the tree, and a module calling through such a client returns. Full inner suite: 127 passed, no failures. Signed-off-by: Tom Chauveau <[email protected]>
`connection` was the one part of the library that lived only in the facade. It is a composition — a session from @dagger.io/session plus the tracer's lifetime from @dagger.io/telemetry — so it sat above both layers rather than in either, and the facade was the only thing above them. That made it the single reason a module could not drop the facade entirely. It is now its own published package, fifth in publishedLayers. The facade re-exports it like any other layer, and the bundle's facade/ no longer carries connection.ts at all. Two things this touched that are worth knowing. The introspector entrypoint also imported it, and that is bundle-only code the module package deliberately excludes — `include` there names three files — so it reaches the new path relatively and adds no edge to any published manifest. And `tsc -b` has to name src/connect at all three build sites: nothing references it, so the project graph does not reach it on its own. The bundle was regenerated by the packager rather than by hand. Built locally it produced a 49k-line diff for a one-file move; through the generator it is four lines. Verified: layering-check, manifest-is-honest-check, manifest-installs-check, library-tests, published-layers-check and remote-core-lib-check all pass. Note the ordering this creates: the facade now names @dagger.io/connect, which is not published, so a remoteCoreLib module cannot install until it is. The release command already covers it. Signed-off-by: Tom Chauveau <[email protected]>
connect has to go out, and reusing 1.0.0-beta.1 would not do it properly. session's published tarball is already stale: it announces engine v1.0.0-beta.24 while the repo pairs with beta.25, and a published version cannot be rewritten. So all four move to beta.2 and connect arrives with them. core keeps 0.0.0 — it ships from dagger/dagger at the engine's version — but its pin on session moves with the rest, as do connect's on session and telemetry. The facade's pins follow automatically: facade-manifest.cjs reads the committed manifests, so the bundle regenerated to beta.2 with nothing else changing. Verified: all five layers build, and layering-check, manifest-is-honest-check, manifest-installs-check, library-tests, published-layers-check, library-bundle and remote-core-lib-check all pass. Signed-off-by: Tom Chauveau <[email protected]>
Patched in place rather than regenerated. Deleting the lockfile re-resolves every third-party package against today's registry: it moved @opentelemetry/sdk-trace-base 2.8.0 to 2.12.0 and *downgraded* serialize-javascript 7.0.3 to 6.0.2, none of which belongs in a version bump. This touches only the workspace members' own versions and their sibling pins, and it fixes two that still said 0.0.0 because an incremental install never refreshes them. Signed-off-by: Tom Chauveau <[email protected]>
TomChv
added a commit
that referenced
this pull request
Nov 10, 2026
The one thing from #131 that did not land: the squash took the tree before the revert, so core still pins session at an exact version. That matters because core's version is the engine release, so it cannot be republished on its own cadence — and an exact pin means every session release needs a core republish there is often no version for. Reproduced against real npmjs: [email protected] pinning session 1.0.0-beta.1 next to a scope on beta.2 installs both, node_modules/@dagger.io/session -> 1.0.0-beta.2 node_modules/@dagger.io/core/node_modules/@dagger.io/session -> 1.0.0-beta.1 and with a range the same install resolves to one. ^1.0.0-beta.2 matches beta.2, beta.3, 1.0.0 and 1.0.1 by semver, so core follows a session release without moving. Signed-off-by: Tom Chauveau <[email protected]>
TomChv
added a commit
that referenced
this pull request
Nov 10, 2026
The one thing from #131 that did not land: the squash took the tree before the revert, so core still pins session at an exact version. That matters because core's version is the engine release, so it cannot be republished on its own cadence — and an exact pin means every session release needs a core republish there is often no version for. Reproduced against real npmjs: [email protected] pinning session 1.0.0-beta.1 next to a scope on beta.2 installs both, node_modules/@dagger.io/session -> 1.0.0-beta.2 node_modules/@dagger.io/core/node_modules/@dagger.io/session -> 1.0.0-beta.1 and with a range the same install resolves to one. ^1.0.0-beta.2 matches beta.2, beta.3, 1.0.0 and 1.0.1 by semver, so core follows a session release without moving. Signed-off-by: Tom Chauveau <[email protected]>
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.
Now that
core,session,moduleandtelemetryare published, a scope need not carry the library at all. With theremoteCoreLibsetting,clients/daggerbecomes the facade's own source over the published packages — 16K against 5.2M — and each generated client becomes an independent package naming what it imports.Off by default, deliberately
The versions pinned are the ones the bundle was built against, so an engine whose
corewas never published has nothing to resolve, and there is no way to know that short of asking a registry. Carrying the bundle is the only thing that always works, so it stays the default until that fallback has an answer. This is step 5 ofdesign/package-split.md, made available rather than taken.Two shapes
The facade is no longer bundled. The packager copies
src/index.tsandsrc/connection.tsintolibrary/bundle/facade/with a generated manifest, so what a module sees cannot drift from what the library exports, andlibrary-bundlekeeps it honest.A generated client is independent. It used to name the scope's local facade by
file:../dagger, which made it a thing that only works inside the scope that generated it. It now names both published packages it imports, because its runtime lives in two places:Context,BaseClient@dagger.io/sessiondag,Container,ID, every core type@dagger.io/coreloader.gen.tsandcompat.gen.tskeep the facade specifier on purpose: they sit flat inclients/rather than in packages of their own, they are module-internal, and the module's own dependency already covers them.A bug this turned up
The facade never declared
@dagger.io/session, thoughindex.tsre-exports from it in three places. npm hid it by hoisting it as a transitive dependency ofcoreandmodule. Deno refuses an undeclared transitive import, so it would have failed there and nowhere else. Fixed, and the check now asserts all four and goes red without it.Verification
e2e:generate/remote-core-lib-checkcovers both shapes and the client, and I confirmed it fails when the setting is ignored and whensessionis undeclared.By hand, beyond that:
dagger callreturns through a realdagquerycoreandsessionin the treeNot here
No fallback for an unpublished engine pairing, which is why this is opt-in. No change to the legacy
[runtime]layout: the engine mountssdk/asnode_modules/@dagger.io/daggerthere, so that contract is the runtime's and the bundle stays.