Skip to content

dagql: generalize and unify around Result (formerly known as Instance)#10620

Merged
sipsma merged 3 commits into
dagger:mainfrom
sipsma:instance-everywhere
Jul 7, 2025
Merged

dagql: generalize and unify around Result (formerly known as Instance)#10620
sipsma merged 3 commits into
dagger:mainfrom
sipsma:instance-everywhere

Conversation

@sipsma
Copy link
Copy Markdown
Contributor

@sipsma sipsma commented Jun 21, 2025

Another big carve-out from persistent cache work, this change:

  1. Generalizes (and renames) dagql.Instance to be able to wrap any type (whereas previously it could only wrap objects)
    • Instance is renamed to -> Result, which is a bit more clear IMO especially once it is used in the persistent cache PR for also wrapping "cache results"
    • Additionally, there are now two types: dagql.Result and dagql.ObjectResult (which is a dagql.Result plus some more object-specific methods)
    • I wanted to make these interfaces, but Go reflection that we use for figuring out API types is just not really usable with interfaces that have a type param, despite many attempts to find a path.
  2. Does some refactoring so that internally all field implementations return an Result, and various impacted parts of the codebase

The motivation is that the persistent cache was currently introducing even more wrapper types to support carrying around cache-related metadata (i.e. ID in db, etc.), which was rapidly devolving into insanity mixed in with all our existing types, wrappers, etc.

I decided to centralize everything there around the existing Instance types, which makes sense since Instance is already a wrapper for ID-metadata, which is very related to the cache metadata.

However, doing that required very substantial updates, most important support for wrapping any type, not just objects.

  • i.e. if a field returns a String, we still want to be able to cache it and reference it, which in this new world means it needs to be wrapped as an Instance.

@jedevc mentioned that he had wanted Instance to be able to wrap any type for telemetry-related purposes too, so hopefully this should support that too.

@sipsma sipsma force-pushed the instance-everywhere branch 2 times, most recently from 7ec4563 to f9afd69 Compare June 23, 2025 22:19
@sipsma sipsma force-pushed the instance-everywhere branch 5 times, most recently from 97e84a5 to a8eda31 Compare June 25, 2025 23:50
@sipsma sipsma force-pushed the instance-everywhere branch 4 times, most recently from b15d4b4 to d8fc82f Compare June 30, 2025 22:04
@sipsma sipsma marked this pull request as ready for review July 2, 2025 16:29
@sipsma sipsma force-pushed the instance-everywhere branch 3 times, most recently from fed3558 to afc776c Compare July 2, 2025 20:43
@sipsma sipsma requested review from jedevc and vito July 2, 2025 21:16
Comment thread dagql/builtins.go Outdated
Comment thread dagql/call/id.go
Comment thread dagql/dagql_test.go
Comment thread modules/gha/steps.go
Comment thread dagql/objects.go Outdated
Comment thread dagql/types.go
Comment thread dagql/objects.go
Comment thread core/interface.go Outdated
Comment thread core/schema/env.go Outdated
Comment thread core/schema/service.go Outdated
@jedevc
Copy link
Copy Markdown
Contributor

jedevc commented Jul 3, 2025

Maybe the PR should be renamed?

Comment thread core/codegen.go
Comment thread core/container.go
Comment thread core/interface.go
Comment thread core/mcp.go Outdated
Comment thread core/module.go
Comment thread core/schema/coremod.go Outdated
Comment thread core/telemetry.go Outdated
Comment thread dagql/types.go
@sipsma sipsma changed the title dagql: generalize and unify around Instance dagql: generalize and unify around Result (formerly known as Instance) Jul 3, 2025
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
@sipsma sipsma force-pushed the instance-everywhere branch 2 times, most recently from 9aa31b3 to 30c56b0 Compare July 7, 2025 21:24
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
@sipsma sipsma force-pushed the instance-everywhere branch from 30c56b0 to 1bc045c Compare July 7, 2025 21:56
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
@sipsma sipsma force-pushed the instance-everywhere branch from 1bc045c to f6e7e7f Compare July 7, 2025 22:20
@sipsma sipsma merged commit e035126 into dagger:main Jul 7, 2025
57 checks passed
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.

3 participants