From 876d4a695d7f1d017e5f791ad89855ce3a999330 Mon Sep 17 00:00:00 2001 From: Guillaume de Rouville Date: Wed, 12 Aug 2026 19:30:21 -0700 Subject: [PATCH] Remove the polyfill dependency The SDK test harness only needed the polyfill wrapper to turn a Workspace module source into its context directory and source-root path. Use Workspace.moduleSource directly and replace the wrapper aliases with ModuleSource.contextDirectory and sourceRootSubpath. The behavior is unchanged; the engine bump and dependency removal land together. Signed-off-by: Guillaume de Rouville --- .dagger/modules/mod-test-e2e/dagger.json | 6 +----- .dagger/modules/mod-test-e2e/main.dang | 12 ++++++------ dagger-module.toml | 6 +----- harness.dang | 20 ++++++++++---------- mod-test/README.md | 4 ++-- 5 files changed, 20 insertions(+), 28 deletions(-) diff --git a/.dagger/modules/mod-test-e2e/dagger.json b/.dagger/modules/mod-test-e2e/dagger.json index cb6bb57..fb5a6cc 100644 --- a/.dagger/modules/mod-test-e2e/dagger.json +++ b/.dagger/modules/mod-test-e2e/dagger.json @@ -1,6 +1,6 @@ { "name": "mod-test-e2e", - "engineVersion": "v0.20.8", + "engineVersion": "v1.0.0-beta.10", "sdk": { "source": "dang" }, @@ -8,10 +8,6 @@ { "name": "mod-test", "source": "../../../mod-test" - }, - { - "name": "polyfill", - "source": "github.com/dagger/polyfill@main" } ] } diff --git a/.dagger/modules/mod-test-e2e/main.dang b/.dagger/modules/mod-test-e2e/main.dang index 0c767f7..62fc8a7 100644 --- a/.dagger/modules/mod-test-e2e/main.dang +++ b/.dagger/modules/mod-test-e2e/main.dang @@ -8,8 +8,8 @@ type ModTestE2e { mod-test should call a target module through the Dagger CLI and assert JSON strings. """ pub jsonStringCheck(ws: Workspace!): Void @check { - let module = polyfill.workspace(ws).moduleSource(echoModulePath) - let target = modTest.target(module.workspaceView, module.sourceRootPath) + let module = ws.moduleSource(echoModulePath) + let target = modTest.target(module.contextDirectory, module.sourceRootSubpath) target.assertJsonString(["echo", "--value", "hello"], "hello") } @@ -17,8 +17,8 @@ type ModTestE2e { mod-test should assert JSON string-list output. """ pub jsonStringListCheck(ws: Workspace!): Void @check { - let module = polyfill.workspace(ws).moduleSource(echoModulePath) - let target = modTest.target(module.workspaceView, module.sourceRootPath) + let module = ws.moduleSource(echoModulePath) + let target = modTest.target(module.contextDirectory, module.sourceRootSubpath) target.assertJsonListContains(["values", "--first", "one", "--second", "two"], "two") target.assertJsonListEmpty(["empty"]) @@ -28,8 +28,8 @@ type ModTestE2e { mod-test should assert failing target calls. """ pub failureCheck(ws: Workspace!): Void @check { - let module = polyfill.workspace(ws).moduleSource(echoModulePath) - let target = modTest.target(module.workspaceView, module.sourceRootPath) + let module = ws.moduleSource(echoModulePath) + let target = modTest.target(module.contextDirectory, module.sourceRootSubpath) target.assertFailure(["fail"], "target fail should exit non-zero") } diff --git a/dagger-module.toml b/dagger-module.toml index ab7a40c..e9e2701 100644 --- a/dagger-module.toml +++ b/dagger-module.toml @@ -1,13 +1,9 @@ name = "sdk-sdk" -engineVersion = "v1.0.0-0" +engineVersion = "v1.0.0-beta.10" [runtime] source = "dang" -[[dependencies]] - name = "polyfill" - source = "github.com/dagger/polyfill@main" - [[dependencies]] name = "mod-test" source = "./mod-test" diff --git a/harness.dang b/harness.dang index 130470d..6adea1e 100644 --- a/harness.dang +++ b/harness.dang @@ -20,11 +20,11 @@ type SdkHarness { } """ - Return the SDK module under test prepared by the workspace polyfill. + Return the SDK module under test from the native workspace API. """ pub sdkTarget(ws: Workspace!): SdkTarget! { let module = sdkModule(ws) - target(module.workspaceView, module.sourceRootPath) + target(module.contextDirectory, module.sourceRootSubpath) } """ @@ -35,14 +35,14 @@ type SdkHarness { """ pub contractView(ws: Workspace!): Directory! { let module = sdkModule(ws) - let view = module.workspaceView + let view = module.contextDirectory - if (module.sourceRootPath == ".") { + if (module.sourceRootSubpath == ".") { view - } else if (view.exists(module.sourceRootPath + "/dagger.json")) { - view.withFile("dagger.json", view.file(module.sourceRootPath + "/dagger.json")) + } else if (view.exists(module.sourceRootSubpath + "/dagger.json")) { + view.withFile("dagger.json", view.file(module.sourceRootSubpath + "/dagger.json")) } else { - view.withFile("dagger-module.toml", view.file(module.sourceRootPath + "/dagger-module.toml")) + view.withFile("dagger-module.toml", view.file(module.sourceRootSubpath + "/dagger-module.toml")) } } @@ -50,20 +50,20 @@ type SdkHarness { Return the workspace-relative source root path of the SDK module under test. """ pub sourceRootPath(ws: Workspace!): String! { - sdkModule(ws).sourceRootPath + sdkModule(ws).sourceRootSubpath } """ Return the SDK module at the workspace root. """ - let sdkModule(ws: Workspace!): PolyfillModuleSource! { + let sdkModule(ws: Workspace!): ModuleSource! { let configs = ws.directory("/", include: ["dagger.json", "dagger-module.toml"]) if (configs.exists("dagger.json") == false and configs.exists("dagger-module.toml") == false) { raise noSdkModuleMessage } - polyfill.workspace(ws).moduleSource(".") + ws.moduleSource("/") } let noSdkModuleMessage: String! = "no SDK module detected at the workspace root. Run from an SDK module workspace, or pass one with -W " diff --git a/mod-test/README.md b/mod-test/README.md index 8907f2c..67925a9 100644 --- a/mod-test/README.md +++ b/mod-test/README.md @@ -19,8 +19,8 @@ Example: ```dang pub smoke(ws: Workspace!): Void @check { - let module = polyfill.workspace(ws).moduleSource(".dagger/modules/fixture") - let target = modTest.target(module.workspaceView, module.sourceRootPath) + let module = ws.moduleSource(".dagger/modules/fixture") + let target = modTest.target(module.contextDirectory, module.sourceRootSubpath) target.assertJsonString(["echo", "--value", "hello"], "hello") target.assertFailure(["fail"], "fail should return a non-zero status")