Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changes/unreleased/Fixed-20240809-125822.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Fixed
body: Fix "failed to collect IDs from parent fields" error when module objects contain
fields with nil values.
time: 2024-08-09T12:58:22.740097751-07:00
custom:
Author: jedevc/sipsma
PR: "8132"
32 changes: 32 additions & 0 deletions core/integration/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6368,6 +6368,38 @@ func (m *Test) Fn() string {
require.NoError(t, err)
}

func (ModuleSuite) TestReturnNilField(ctx context.Context, t *testctx.T) {
c := connect(ctx, t)

_, err := goGitBase(t, c).
WithMountedFile(testCLIBinPath, daggerCliFile(t, c)).
WithWorkdir("/work").
With(daggerExec("init", "--name=test", "--sdk=go")).
With(sdkSource("go", `package main

type Test struct {
A *Thing
B *Thing
}

type Thing struct{}

func New() *Test {
return &Test{
A: &Thing{},
}
}

func (m *Test) Hello() string {
return "Hello"
}

`)).
With(daggerCall("hello")).
Sync(ctx)
require.NoError(t, err)
}

func (ModuleSuite) TestModuleSchemaVersion(ctx context.Context, t *testctx.T) {
t.Run("standalone", func(ctx context.Context, t *testctx.T) {
c := connect(ctx, t)
Expand Down
2 changes: 2 additions & 0 deletions core/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ func (t *ModuleObjectType) ConvertToSDKInput(ctx context.Context, value dagql.Ty
func (t *ModuleObjectType) CollectCoreIDs(ctx context.Context, value dagql.Typed, ids map[digest.Digest]*call.ID) error {
var obj *ModuleObject
switch value := value.(type) {
case nil:
return nil
case *ModuleObject:
obj = value
case dagql.Instance[*ModuleObject]:
Expand Down