You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new Workspace.withDirectorymerges the source onto what the path already holds, the same contract Directory.withDirectory has.
Both workarounds #35 had to write — the read-back-and-layer, and pruning the bindings twice — are that second field, so they can go away.
What to change
Once dagger.json moves to engineVersion: v1.0.0-beta.11:
initModule (typescript-sdk.dang:234)
# withNewDirectory replaces the directory it writes, so layer the starter
# onto what is already there: init must never remove a user's files, nor
# the config the engine wrote at `modPath` before calling us.
ws.withNewDirectory(
"/" + modPath,
existingDir(ws, modPath).withDirectory(".", templateSource),
).changes(ws)
becomes ws.withDirectory("/" + modPath, templateSource).changes(ws), and that half of the comment goes with it. The modPath anchoring note above it still applies and should stay.
generateClient (typescript-sdk.dang:620) and generateAllClient (typescript-sdk.dang:687)
That keeps the ownership split #9 established — the SDK owns *.gen.ts, the user owns everything else — with one prune instead of two.
Then:
existingClientBase (typescript-sdk.dang:566) becomes dead — delete it.
withoutClientBindings' doc comment (typescript-sdk.dang:573) is the "pruning has to happen twice" explanation. It describes a divergence that no longer exists; it should shrink to what the helper does.
existingDir stays: clientBindings still reads the destination through it.
In generateAllClient, the reason the baseline read from the untouched ws while the prune ran on stagedWs was that reading back out of a pruned host-backed workspace came up empty. With no read-back left there is nothing to keep straight — but the fold still needs its prune on stagedWs, so verify rather than assume.
Guards
dagger check 'e-2-e*' — the three checks #35 added exist for this and should all still pass:
init:init-over-existing-check
client:generate-client-respects-existing-check (main.ts survives, stale-dep.gen.ts is pruned)
Blocked on the
v1.0.0-beta.11release.dagger/dagger#13956 (fixes dagger/dagger#13955 — the engine issue #35 said was worth filing) splits
Workspace.withNewDirectoryin two:withNewDirectorynow replaces whatever the path held, on every workspace kind — host-backed, value and git alike. The local/git divergence that cost Keep existing files when init and client codegen write a directory #35 two red CI rounds is gone.Workspace.withDirectorymerges the source onto what the path already holds, the same contractDirectory.withDirectoryhas.Both workarounds #35 had to write — the read-back-and-layer, and pruning the bindings twice — are that second field, so they can go away.
What to change
Once
dagger.jsonmoves toengineVersion: v1.0.0-beta.11:initModule(typescript-sdk.dang:234)becomes
ws.withDirectory("/" + modPath, templateSource).changes(ws), and that half of the comment goes with it. ThemodPathanchoring note above it still applies and should stay.generateClient(typescript-sdk.dang:620) andgenerateAllClient(typescript-sdk.dang:687)should collapse to pruning the stale bindings out of the workspace and merging the generated package on top:
That keeps the ownership split #9 established — the SDK owns
*.gen.ts, the user owns everything else — with one prune instead of two.Then:
existingClientBase(typescript-sdk.dang:566) becomes dead — delete it.withoutClientBindings' doc comment (typescript-sdk.dang:573) is the "pruning has to happen twice" explanation. It describes a divergence that no longer exists; it should shrink to what the helper does.existingDirstays:clientBindingsstill reads the destination through it.generateAllClient, the reason the baseline read from the untouchedwswhile the prune ran onstagedWswas that reading back out of a pruned host-backed workspace came up empty. With no read-back left there is nothing to keep straight — but the fold still needs its prune onstagedWs, so verify rather than assume.Guards
dagger check 'e-2-e*'— the three checks #35 added exist for this and should all still pass:init:init-over-existing-checkclient:generate-client-respects-existing-check(main.tssurvives,stale-dep.gen.tsis pruned)client:generate-client-on-synthetic-workspace-checkThe last one was there to catch the local/git split. It is worth keeping even though the engine no longer diverges.