From 5c0263a46575feb517548c7df2581eb2f89d38d7 Mon Sep 17 00:00:00 2001 From: Guillaume de Rouville Date: Fri, 7 Aug 2026 01:24:25 -0700 Subject: [PATCH] Drop the polyfill for native workspace APIs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same migration as go-sdk (dagger/dagger#13769): findConfigDirs, fork, moduleSource and generatedContextChangeset are engine APIs now. generateAll folds per-module changesets with changeset.withChangesets instead of merging polyfill forks — same result, the engine computes each module's changes against its staged workspace. Staging paths anchor at "/" because the native fork resolves relative paths from the cwd, where the polyfill's took workspace-root paths. The engineVersion bump and the dependency removal land together: the version gate scopes the engine's new changeset rooting to migrated modules. Signed-off-by: Guillaume de Rouville --- dagger.json | 11 ++--------- dagger.lock | 1 - mod-config.dang | 2 +- mod.dang | 6 +++--- python-sdk.dang | 33 ++++++++++++++++----------------- 5 files changed, 22 insertions(+), 31 deletions(-) diff --git a/dagger.json b/dagger.json index 8831c47..5bcfdef 100644 --- a/dagger.json +++ b/dagger.json @@ -1,14 +1,7 @@ { "name": "python-sdk", - "engineVersion": "v1.0.0-0", + "engineVersion": "v1.0.0-beta.10", "sdk": { "source": "dang" - }, - "dependencies": [ - { - "name": "polyfill", - "source": "github.com/dagger/polyfill@main", - "pin": "16627066d1852106320bdc0cfa0e5f901efe5970" - } - ] + } } diff --git a/dagger.lock b/dagger.lock index 043165c..2b55af5 100644 --- a/dagger.lock +++ b/dagger.lock @@ -1,3 +1,2 @@ [["version","1"]] ["","git.head",["https://github.com/dagger/sdk-sdk"],"8c164424b7a8a37b33a77367ef7547490d5b87b5","float"] -["","git.ref",["https://github.com/dagger/polyfill","main"],"ec3ea84a2351b4beb06ecece951f2e5ef66509ff","float"] \ No newline at end of file diff --git a/mod-config.dang b/mod-config.dang index 818ced5..0d30523 100644 --- a/mod-config.dang +++ b/mod-config.dang @@ -83,7 +83,7 @@ type ModConfig { } let edited = withImage.file(toolPath).contents - polyfill.workspace(ws).fork.withNewFile(pyprojectPath, edited).changes + ws.fork.withNewFile("/" + pyprojectPath, edited).changes } """ diff --git a/mod.dang b/mod.dang index eac112e..bf9d754 100644 --- a/mod.dang +++ b/mod.dang @@ -56,12 +56,12 @@ type Mod { """ pub generate: Changeset! { if (skipGenerate) { - polyfill.workspace(ws).fork.changes + ws.fork.changes } else { # Stage the local dependency closure so this module's codegen sees # up-to-date dependency bindings before generating it. - let stagedWs = ws.withChanges(polyfill.workspace(ws).moduleSource("/" + rootPath).core.generateLocalDependencies(ws)) - polyfill.workspace(stagedWs).moduleSource("/" + rootPath).generate.changes + let stagedWs = ws.withChanges(ws.moduleSource("/" + rootPath).generateLocalDependencies(ws)) + stagedWs.moduleSource("/" + rootPath).generatedContextChangeset } } } diff --git a/python-sdk.dang b/python-sdk.dang index caa1722..591098f 100644 --- a/python-sdk.dang +++ b/python-sdk.dang @@ -19,13 +19,13 @@ type PythonSdk { """ Return every managed Python SDK module visible from the client's cwd: the nearest enclosing module plus modules at or below the cwd. Discovery uses the - shared polyfill and intersects its results with the SDK list on the passed + engine's Workspace.findConfigDirs and intersects its results with the SDK list on the passed workspace. """ pub modules(ws: Workspace!): [Mod!]! { let managed = currentModule.asSDK(workspace: ws).modules.{{path}} let cwd = normalizePath(ws.cwd) - polyfill.workspace(ws) + ws .findConfigDirs(moduleConfigFilenames, exclude: ["**/.venv/**", "**/site-packages/**"]) .map { dir => workspacePath(cwd, dir) } .uniq @@ -161,8 +161,8 @@ type PythonSdk { } else { let templateSource = configuredTemplate(renderedTemplate(name, selectedTemplate), pythonVersion, useUv, baseImage) - polyfill.workspace(ws).fork - .withDirectory(modPath, templateSource) + ws.fork + .withNewDirectory("/" + modPath, templateSource) .changes } } @@ -218,18 +218,17 @@ type PythonSdk { Modules with the generate skip marker are skipped. """ pub generateAll(ws: Workspace!): Changeset! @generate { - let pws = polyfill.workspace(ws) - - modules(ws) - .filter { mod => mod.skipGenerate == false } - .reduce(pws.fork) { fork, mod => - # Stage this module's local dependency closure first (leaf-first, possibly - # across SDKs) so its codegen sees up-to-date dependency bindings. The dep - # codegen is ephemeral: it appears in both the fork's before and after, so - # it cancels in the merge, leaving only each module's own changes. - let stagedWs = ws.withChanges(pws.moduleSource("/" + mod.rootPath).core.generateLocalDependencies(ws)) - fork.merge(polyfill.workspace(stagedWs).moduleSource("/" + mod.rootPath).generate) - } - .changes + changeset.withChangesets( + modules(ws) + .filter { mod => mod.skipGenerate == false } + .map { mod => + # Stage this module's local dependency closure first (leaf-first, possibly + # across SDKs) so its codegen sees up-to-date dependency bindings. The dep + # codegen is ephemeral: taking the changeset against the staged workspace + # cancels it out, leaving only each module's own changes. + let stagedWs = ws.withChanges(ws.moduleSource("/" + mod.rootPath).generateLocalDependencies(ws)) + stagedWs.moduleSource("/" + mod.rootPath).generatedContextChangeset + }, + ) } }