Skip to content

Simplify runtime code by removing layers of abstraction - #109

Closed
shykes wants to merge 2 commits into
mainfrom
slimfast
Closed

shykes wants to merge 2 commits into
mainfrom
slimfast

Conversation

@shykes

@shykes shykes commented Feb 8, 2021 •

Copy link
Copy Markdown
Contributor
  • Remove intermediary types Component, Script, Op, mount: just use
    cc.Value directly
  • Remove Executable interface.
  • Execute llb code with a simple concrete type Pipeline
  • Analyze llb code with a simple utility Analyze
  • Move cc tests to the sub-package.
  • Runtime no longer performs cue spec validation or expansion. Instead, a standard library is made available automatically. User config may import ”dagger.cloud/dagger” and use available definitions such as dagger.#Exec, dagger.#FetchContainer etc.

@shykes

shykes commented Feb 8, 2021

Copy link
Copy Markdown
Contributor Author

I am investigating the best way to validate & merge spec. I will document my progress here along the way.

My first attempt was to merge each individual op with #Op spec, at ops() which pre-processes all executable values before running or analyzing them (see pipeline.go). Unfortunately this fails with disjunction errors. I think it’s because at that point, #dagger and #Op are both definitions, and thus merging them does not work as we would like.

For my next attempt, I will try to merge & validate once at the top-level of the env. This depends primarily on whether we can express everything we need in cue.

@shykes
shykes force-pushed the slimfast branch 2 times, most recently from 1b20779 to a2ea340 Compare February 9, 2021 20:58
@shykes

shykes commented Feb 9, 2021

Copy link
Copy Markdown
Contributor Author

Fixed linter errors, rebased against latest merged PRs.

@shykes

shykes commented Feb 9, 2021

Copy link
Copy Markdown
Contributor Author

NOTE: some integration tests fails because this branch currently does not check config against spec at runtime. However, if you pass a correct config, it computes correctly (for example examples/simple).

It would be interesting to see some benchmarks on this branch, it would give us an idea of the role of spec validation in the perf issue.

@shykes
shykes force-pushed the slimfast branch 3 times, most recently from 2af0620 to 36adf67 Compare February 11, 2021 22:30
@shykes shykes changed the title WORK IN PROGRESS: Simplify runtime code by removing layers of abstraction Simplify runtime code by removing layers of abstraction Feb 11, 2021
@shykes
shykes force-pushed the slimfast branch 4 times, most recently from 122c812 to 842d3ba Compare February 11, 2021 23:53
@shykes

shykes commented Feb 11, 2021

Copy link
Copy Markdown
Contributor Author

Ready for review.

@shykes
shykes force-pushed the slimfast branch 3 times, most recently from c1d9412 to 7e8d8ed Compare February 12, 2021 18:35
- Remove intermediary types `Component`, `Script`, `Op`, `mount`: just use
  `cc.Value` directly
- Remove `Executable` interface.
- Execute llb code with a simple concrete type `Pipeline`
- Analyze llb code with a simple utility `Analyze`

Signed-off-by: Solomon Hykes <[email protected]>
Also remove broken examples uncovered by Makefile change.

Signed-off-by: Solomon Hykes <[email protected]>
@shykes shykes closed this Feb 12, 2021
@aluzzardi
aluzzardi deleted the slimfast branch February 18, 2021 02:58
aluzzardi pushed a commit that referenced this pull request Sep 16, 2022
Handle panics as 500 errors
shykes added a commit that referenced this pull request Jun 12, 2026
Replace the parallel [sdks.*] top-level section with an as-sdk
sub-table on each module entry. An SDK install is now a regular
[modules.<name>] entry whose role-specific data — the modules and
clients it authors/manages locally — nests under [modules.<name>.as-sdk].

Why the pivot:

- Settings unify. There's one place SDK settings live now —
  [modules.<sdk>.settings] — identical to every other module's
  settings location. `dagger settings` works for SDKs through the
  existing moduleList query without any engine-schema branching. The
  bifurcation that would have forced a parallel sdkList field, parallel
  settings discovery, and parallel runtime wiring is gone.
- Install/develop distinction preserved. [modules.X] still means
  "installed here". The [[modules.X.as-sdk.modules]] entries are the
  develop side: an authored module gets an entry there AND (when
  default-path installed) its own [modules.<authored-name>] entry.
- Mental model right. An SDK is a module whose role in this workspace
  is to author other things. The as-sdk sub-table makes the role visible
  without introducing a parallel taxonomy.

Schema changes (core/workspace/config.go):
- Config.SDKs map removed.
- ModuleEntry gains AsSDK *ModuleAsSDK and Pin string.
- ModuleAsSDK carries Modules + Clients slices (the existing
  SDKManagedModule / SDKManagedClient types are reused).
- SerializeConfig writes the nested [[modules.<name>.as-sdk.modules]] /
  [[modules.<name>.as-sdk.clients]] arrays inline with each module.

Format-preserving editor (core/workspace/config_document.go):
- rewriteSDKSections is now rewriteModuleAsSDKSections, scoped to
  the nested as-sdk sub-blocks of each module. The "format inside the
  block is given up, everything outside is preserved" trade is
  unchanged. isModuleAsSDKHeading is the section-key matcher.

Migration (core/workspace/migrate.go):
- PlanMigration writes the legacy `sdk` field as
  Modules[<short>].AsSDK.Modules — same authoring path as before, new
  location.

Engine moduleInit (core/schema/workspace_module_init.go):
- Conflict detection scans [[modules.*.as-sdk.modules]] instead of
  [[sdks.*.modules]].
- The SDK install creates / mutates a regular ModuleEntry, with the
  authoring entry attached under AsSDK.

CLI module sdk wrapper (cmd/dagger/module_sdk.go):
- Lookup scans cfg.Modules[*].AsSDK.Modules for the cwd's path.

Tests updated for the new shape (round-trip, migration, and the
config_test invalid-key listing now includes "as-sdk" and "pin").

Net code delta is small (one parallel section collapses into a nested
sub-table) but the schema simplification removes the engine work that
"move SDK settings" would have required — task #109 disappears
entirely.
eunomie pushed a commit to eunomie/dagger that referenced this pull request Jun 16, 2026
Replace the parallel [sdks.*] top-level section with an as-sdk
sub-table on each module entry. An SDK install is now a regular
[modules.<name>] entry whose role-specific data — the modules and
clients it authors/manages locally — nests under [modules.<name>.as-sdk].

Why the pivot:

- Settings unify. There's one place SDK settings live now —
  [modules.<sdk>.settings] — identical to every other module's
  settings location. `dagger settings` works for SDKs through the
  existing moduleList query without any engine-schema branching. The
  bifurcation that would have forced a parallel sdkList field, parallel
  settings discovery, and parallel runtime wiring is gone.
- Install/develop distinction preserved. [modules.X] still means
  "installed here". The [[modules.X.as-sdk.modules]] entries are the
  develop side: an authored module gets an entry there AND (when
  default-path installed) its own [modules.<authored-name>] entry.
- Mental model right. An SDK is a module whose role in this workspace
  is to author other things. The as-sdk sub-table makes the role visible
  without introducing a parallel taxonomy.

Schema changes (core/workspace/config.go):
- Config.SDKs map removed.
- ModuleEntry gains AsSDK *ModuleAsSDK and Pin string.
- ModuleAsSDK carries Modules + Clients slices (the existing
  SDKManagedModule / SDKManagedClient types are reused).
- SerializeConfig writes the nested [[modules.<name>.as-sdk.modules]] /
  [[modules.<name>.as-sdk.clients]] arrays inline with each module.

Format-preserving editor (core/workspace/config_document.go):
- rewriteSDKSections is now rewriteModuleAsSDKSections, scoped to
  the nested as-sdk sub-blocks of each module. The "format inside the
  block is given up, everything outside is preserved" trade is
  unchanged. isModuleAsSDKHeading is the section-key matcher.

Migration (core/workspace/migrate.go):
- PlanMigration writes the legacy `sdk` field as
  Modules[<short>].AsSDK.Modules — same authoring path as before, new
  location.

Engine moduleInit (core/schema/workspace_module_init.go):
- Conflict detection scans [[modules.*.as-sdk.modules]] instead of
  [[sdks.*.modules]].
- The SDK install creates / mutates a regular ModuleEntry, with the
  authoring entry attached under AsSDK.

CLI module sdk wrapper (cmd/dagger/module_sdk.go):
- Lookup scans cfg.Modules[*].AsSDK.Modules for the cwd's path.

Tests updated for the new shape (round-trip, migration, and the
config_test invalid-key listing now includes "as-sdk" and "pin").

Net code delta is small (one parallel section collapses into a nested
sub-table) but the schema simplification removes the engine work that
"move SDK settings" would have required — task dagger#109 disappears
entirely.

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit to eunomie/dagger that referenced this pull request Jun 16, 2026
Replace the parallel [sdks.*] top-level section with an as-sdk
sub-table on each module entry. An SDK install is now a regular
[modules.<name>] entry whose role-specific data — the modules and
clients it authors/manages locally — nests under [modules.<name>.as-sdk].

Why the pivot:

- Settings unify. There's one place SDK settings live now —
  [modules.<sdk>.settings] — identical to every other module's
  settings location. `dagger settings` works for SDKs through the
  existing moduleList query without any engine-schema branching. The
  bifurcation that would have forced a parallel sdkList field, parallel
  settings discovery, and parallel runtime wiring is gone.
- Install/develop distinction preserved. [modules.X] still means
  "installed here". The [[modules.X.as-sdk.modules]] entries are the
  develop side: an authored module gets an entry there AND (when
  default-path installed) its own [modules.<authored-name>] entry.
- Mental model right. An SDK is a module whose role in this workspace
  is to author other things. The as-sdk sub-table makes the role visible
  without introducing a parallel taxonomy.

Schema changes (core/workspace/config.go):
- Config.SDKs map removed.
- ModuleEntry gains AsSDK *ModuleAsSDK and Pin string.
- ModuleAsSDK carries Modules + Clients slices (the existing
  SDKManagedModule / SDKManagedClient types are reused).
- SerializeConfig writes the nested [[modules.<name>.as-sdk.modules]] /
  [[modules.<name>.as-sdk.clients]] arrays inline with each module.

Format-preserving editor (core/workspace/config_document.go):
- rewriteSDKSections is now rewriteModuleAsSDKSections, scoped to
  the nested as-sdk sub-blocks of each module. The "format inside the
  block is given up, everything outside is preserved" trade is
  unchanged. isModuleAsSDKHeading is the section-key matcher.

Migration (core/workspace/migrate.go):
- PlanMigration writes the legacy `sdk` field as
  Modules[<short>].AsSDK.Modules — same authoring path as before, new
  location.

Engine moduleInit (core/schema/workspace_module_init.go):
- Conflict detection scans [[modules.*.as-sdk.modules]] instead of
  [[sdks.*.modules]].
- The SDK install creates / mutates a regular ModuleEntry, with the
  authoring entry attached under AsSDK.

CLI module sdk wrapper (cmd/dagger/module_sdk.go):
- Lookup scans cfg.Modules[*].AsSDK.Modules for the cwd's path.

Tests updated for the new shape (round-trip, migration, and the
config_test invalid-key listing now includes "as-sdk" and "pin").

Net code delta is small (one parallel section collapses into a nested
sub-table) but the schema simplification removes the engine work that
"move SDK settings" would have required — task dagger#109 disappears
entirely.

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit that referenced this pull request Jun 17, 2026
Replace the parallel [sdks.*] top-level section with an as-sdk
sub-table on each module entry. An SDK install is now a regular
[modules.<name>] entry whose role-specific data — the modules and
clients it authors/manages locally — nests under [modules.<name>.as-sdk].

Why the pivot:

- Settings unify. There's one place SDK settings live now —
  [modules.<sdk>.settings] — identical to every other module's
  settings location. `dagger settings` works for SDKs through the
  existing moduleList query without any engine-schema branching. The
  bifurcation that would have forced a parallel sdkList field, parallel
  settings discovery, and parallel runtime wiring is gone.
- Install/develop distinction preserved. [modules.X] still means
  "installed here". The [[modules.X.as-sdk.modules]] entries are the
  develop side: an authored module gets an entry there AND (when
  default-path installed) its own [modules.<authored-name>] entry.
- Mental model right. An SDK is a module whose role in this workspace
  is to author other things. The as-sdk sub-table makes the role visible
  without introducing a parallel taxonomy.

Schema changes (core/workspace/config.go):
- Config.SDKs map removed.
- ModuleEntry gains AsSDK *ModuleAsSDK and Pin string.
- ModuleAsSDK carries Modules + Clients slices (the existing
  SDKManagedModule / SDKManagedClient types are reused).
- SerializeConfig writes the nested [[modules.<name>.as-sdk.modules]] /
  [[modules.<name>.as-sdk.clients]] arrays inline with each module.

Format-preserving editor (core/workspace/config_document.go):
- rewriteSDKSections is now rewriteModuleAsSDKSections, scoped to
  the nested as-sdk sub-blocks of each module. The "format inside the
  block is given up, everything outside is preserved" trade is
  unchanged. isModuleAsSDKHeading is the section-key matcher.

Migration (core/workspace/migrate.go):
- PlanMigration writes the legacy `sdk` field as
  Modules[<short>].AsSDK.Modules — same authoring path as before, new
  location.

Engine moduleInit (core/schema/workspace_module_init.go):
- Conflict detection scans [[modules.*.as-sdk.modules]] instead of
  [[sdks.*.modules]].
- The SDK install creates / mutates a regular ModuleEntry, with the
  authoring entry attached under AsSDK.

CLI module sdk wrapper (cmd/dagger/module_sdk.go):
- Lookup scans cfg.Modules[*].AsSDK.Modules for the cwd's path.

Tests updated for the new shape (round-trip, migration, and the
config_test invalid-key listing now includes "as-sdk" and "pin").

Net code delta is small (one parallel section collapses into a nested
sub-table) but the schema simplification removes the engine work that
"move SDK settings" would have required — task #109 disappears
entirely.

Signed-off-by: Solomon Hykes <[email protected]>
eunomie pushed a commit that referenced this pull request Jun 18, 2026
Replace the parallel [sdks.*] top-level section with an as-sdk
sub-table on each module entry. An SDK install is now a regular
[modules.<name>] entry whose role-specific data — the modules and
clients it authors/manages locally — nests under [modules.<name>.as-sdk].

Why the pivot:

- Settings unify. There's one place SDK settings live now —
  [modules.<sdk>.settings] — identical to every other module's
  settings location. `dagger settings` works for SDKs through the
  existing moduleList query without any engine-schema branching. The
  bifurcation that would have forced a parallel sdkList field, parallel
  settings discovery, and parallel runtime wiring is gone.
- Install/develop distinction preserved. [modules.X] still means
  "installed here". The [[modules.X.as-sdk.modules]] entries are the
  develop side: an authored module gets an entry there AND (when
  default-path installed) its own [modules.<authored-name>] entry.
- Mental model right. An SDK is a module whose role in this workspace
  is to author other things. The as-sdk sub-table makes the role visible
  without introducing a parallel taxonomy.

Schema changes (core/workspace/config.go):
- Config.SDKs map removed.
- ModuleEntry gains AsSDK *ModuleAsSDK and Pin string.
- ModuleAsSDK carries Modules + Clients slices (the existing
  SDKManagedModule / SDKManagedClient types are reused).
- SerializeConfig writes the nested [[modules.<name>.as-sdk.modules]] /
  [[modules.<name>.as-sdk.clients]] arrays inline with each module.

Format-preserving editor (core/workspace/config_document.go):
- rewriteSDKSections is now rewriteModuleAsSDKSections, scoped to
  the nested as-sdk sub-blocks of each module. The "format inside the
  block is given up, everything outside is preserved" trade is
  unchanged. isModuleAsSDKHeading is the section-key matcher.

Migration (core/workspace/migrate.go):
- PlanMigration writes the legacy `sdk` field as
  Modules[<short>].AsSDK.Modules — same authoring path as before, new
  location.

Engine moduleInit (core/schema/workspace_module_init.go):
- Conflict detection scans [[modules.*.as-sdk.modules]] instead of
  [[sdks.*.modules]].
- The SDK install creates / mutates a regular ModuleEntry, with the
  authoring entry attached under AsSDK.

CLI module sdk wrapper (cmd/dagger/module_sdk.go):
- Lookup scans cfg.Modules[*].AsSDK.Modules for the cwd's path.

Tests updated for the new shape (round-trip, migration, and the
config_test invalid-key listing now includes "as-sdk" and "pin").

Net code delta is small (one parallel section collapses into a nested
sub-table) but the schema simplification removes the engine work that
"move SDK settings" would have required — task #109 disappears
entirely.

Signed-off-by: Solomon Hykes <[email protected]>
tiborvass pushed a commit that referenced this pull request Jun 19, 2026
Replace the parallel [sdks.*] top-level section with an as-sdk
sub-table on each module entry. An SDK install is now a regular
[modules.<name>] entry whose role-specific data — the modules and
clients it authors/manages locally — nests under [modules.<name>.as-sdk].

Why the pivot:

- Settings unify. There's one place SDK settings live now —
  [modules.<sdk>.settings] — identical to every other module's
  settings location. `dagger settings` works for SDKs through the
  existing moduleList query without any engine-schema branching. The
  bifurcation that would have forced a parallel sdkList field, parallel
  settings discovery, and parallel runtime wiring is gone.
- Install/develop distinction preserved. [modules.X] still means
  "installed here". The [[modules.X.as-sdk.modules]] entries are the
  develop side: an authored module gets an entry there AND (when
  default-path installed) its own [modules.<authored-name>] entry.
- Mental model right. An SDK is a module whose role in this workspace
  is to author other things. The as-sdk sub-table makes the role visible
  without introducing a parallel taxonomy.

Schema changes (core/workspace/config.go):
- Config.SDKs map removed.
- ModuleEntry gains AsSDK *ModuleAsSDK and Pin string.
- ModuleAsSDK carries Modules + Clients slices (the existing
  SDKManagedModule / SDKManagedClient types are reused).
- SerializeConfig writes the nested [[modules.<name>.as-sdk.modules]] /
  [[modules.<name>.as-sdk.clients]] arrays inline with each module.

Format-preserving editor (core/workspace/config_document.go):
- rewriteSDKSections is now rewriteModuleAsSDKSections, scoped to
  the nested as-sdk sub-blocks of each module. The "format inside the
  block is given up, everything outside is preserved" trade is
  unchanged. isModuleAsSDKHeading is the section-key matcher.

Migration (core/workspace/migrate.go):
- PlanMigration writes the legacy `sdk` field as
  Modules[<short>].AsSDK.Modules — same authoring path as before, new
  location.

Engine moduleInit (core/schema/workspace_module_init.go):
- Conflict detection scans [[modules.*.as-sdk.modules]] instead of
  [[sdks.*.modules]].
- The SDK install creates / mutates a regular ModuleEntry, with the
  authoring entry attached under AsSDK.

CLI module sdk wrapper (cmd/dagger/module_sdk.go):
- Lookup scans cfg.Modules[*].AsSDK.Modules for the cwd's path.

Tests updated for the new shape (round-trip, migration, and the
config_test invalid-key listing now includes "as-sdk" and "pin").

Net code delta is small (one parallel section collapses into a nested
sub-table) but the schema simplification removes the engine work that
"move SDK settings" would have required — task #109 disappears
entirely.

Signed-off-by: Solomon Hykes <[email protected]>
sipsma added a commit that referenced this pull request Nov 17, 2026
Move every dagger/go pin, the built-in Go SDK's included, to dagger/go
main's 79a92be, the merge of dagger/go#104, whose tree is that PR's last
head; and go-sdk to its main with daggerGo naming the same commit. That
go-sdk main also brings its #109: a module's local clients are addressed
by their path from the module.

Signed-off-by: Erik Sipsma <[email protected]>
sipsma added a commit that referenced this pull request Nov 17, 2026
Move every dagger/go pin, the built-in Go SDK's included, to dagger/go
main's 79a92be, the merge of dagger/go#104, whose tree is that PR's last
head; and go-sdk to its main with daggerGo naming the same commit. That
go-sdk main also brings its #109: a module's local clients are addressed
by their path from the module.

Signed-off-by: Erik Sipsma <[email protected]>
sipsma added a commit that referenced this pull request Nov 17, 2026
Move every dagger/go pin, the built-in Go SDK's included, to dagger/go
main's 79a92be, the merge of dagger/go#104, whose tree is that PR's last
head; and go-sdk to its main with daggerGo naming the same commit. That
go-sdk main also brings its #109: a module's local clients are addressed
by their path from the module.

Signed-off-by: Erik Sipsma <[email protected]>
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