Skip to content

Commit 9a373ed

Browse files
feat(pack): the declared completion mode reaches the configuration digest
Two packages differing only in how their answer arrives are called the same way and answered differently, so a digest that ignored the mode would call them the same package. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent d989655 commit 9a373ed

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎pkg/pack/pack.go‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,14 @@ func ConfigurationDigest(runnable *resources.Runnable) (string, error) {
132132
}{
133133
Configurations: append([]string{}, runnable.WorkspaceConfigurationDependencies...),
134134
Execution: map[string]any{
135-
"timeout": runnable.Execution.Timeout,
136-
"cancellation": string(runnable.Execution.Cancellation),
137-
"recovery": string(runnable.Execution.Recovery),
135+
"timeout": runnable.Execution.Timeout,
136+
"cancellation": string(runnable.Execution.Cancellation),
137+
"recovery": string(runnable.Execution.Recovery),
138+
// How the answer arrives is part of what an invocation is bound to:
139+
// two packages differing only in it are called the same way and
140+
// answered differently, so a digest that ignored it would call them
141+
// the same package.
142+
"completion": string(runnable.Execution.GetCompletion()),
138143
"concurrency": runnable.Execution.Concurrency,
139144
"max-input-bytes": runnable.Execution.MaxInputBytes(),
140145
"max-output-bytes": runnable.Execution.MaxOutputBytes(),

‎pkg/pack/pack_test.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ func TestTheConfigurationDigestFollowsWhatAnInvocationIsBoundTo(t *testing.T) {
9999
if relaxed := digestFor(t, strings.Replace(declaration, "timeout: 30s", "timeout: 5m", 1)); relaxed == base {
100100
t.Error("a different execution bound did not move the configuration digest")
101101
}
102+
// Two packages differing only in how their answer arrives are called the
103+
// same way and answered differently, so the mode has to reach the digest.
104+
if submitted := digestFor(t, strings.Replace(declaration,
105+
"recovery: receipt", "recovery: receipt\n completion: submit", 1)); submitted == base {
106+
t.Error("declaring another completion mode did not move the configuration digest")
107+
}
102108
}
103109

104110
func TestTheSamePreparedTreeAlwaysPackagesToTheSameDigest(t *testing.T) {

0 commit comments

Comments
 (0)