Repository navigation
Take member timeouts as durations and send seconds to the service - #37
Conversation
Does the PR have any schema changes?Generated by schema-tools v0.8.1. Found 1 breaking change: Types
Maintainer note: consult the runbook for dealing with any breaking changes. |
403300e to
07db435
Compare
A Job timeout was a duration string and a Stacks entry timeout was an integer number of seconds. The service reads only a number of seconds, so the timeout of a job had no effect. Both timeouts are now Go durations. The provider checks that a timeout is a duration in whole seconds from 5m to 24h, and converts it to a number of seconds in the declaration that it sends to the service. The values that the user wrote stay unchanged in the child resource and the outputs. A timeout that is unknown in a preview passes the check. The type of the timeout of a Stacks entry changes from integer to string. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The provider leaves a timeout that is already a number as it is, for programs written against an older SDK. Such a number skipped the range check, so a value that the service rejects passed a preview and failed the update. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
07db435 to
bba3a5d
Compare
|
@pulumi-eon /review
Please review. The hand-written change is in The type of a |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
The conversion and validation look correct. I traced secret, unknown and null timeouts through validateTimeout and timeoutsInSeconds: secret and dependency flags carry over, unknowns pass, and the component and child keep the duration the user wrote. make generate on this head produces no diff, so the schema and SDKs match a fresh generation, and the provider tests pass locally.
No blocking findings, but I am not approving: StacksEntry.timeout changing from integer to string is a breaking change to the public schema in all five SDKs, which a maintainer should sign off on. The description calls it out. It does not say why a number-or-string union (as schema_refs.go does elsewhere) was not used to keep existing programs compiling, so please add that.
Two test gaps are inline. One further point: provider/provider_test.go has no schema assertion for the changed timeout types, which AGENTS.md asks for when the schema changes (see the first inline comment).
Specialist passes: child sessions
| } | ||
| } | ||
|
|
||
| func TestMemberTimeoutValidation(t *testing.T) { |
There was a problem hiding this comment.
Nit — agents-md
The schema changes here (StacksEntry.timeout goes from integer to string), and AGENTS.md says: "When you change the schema, add or update the schema assertions in provider/provider_test.go." The new tests are behavioural and live in stacks_test.go, and no schema assertion covers timeout. Add one next to TestSchemaOfTheTriggersAndTheReleaseNumber that checks both StacksEntry and Job declare timeout as string.
There was a problem hiding this comment.
🤖 Claude Code (claude-fable-5-2), on flostadler's behalf
Fixed in 4167c1a. TestSchemaOfTheTimeouts in provider/provider_test.go asserts that timeout is a string on Job and on StacksEntry.
| newFakeService(t) | ||
| server := newServer(t) | ||
| const message = "timeout must be a duration from 5m to 24h in whole seconds, such as 30m" | ||
| for _, timeout := range []string{"soon", "90500ms", "4m59s", "24h1s", "-10m"} { |
There was a problem hiding this comment.
Nit — tests
The whole-second check on duration strings is not covered. Deleting || d%time.Second != 0 in validateTimeout leaves the suite green, because "90500ms" is 1m30.5s and the 5m minimum already rejects it. Add a sub-second value above the minimum, such as "10m0.5s", to this list.
| for _, timeout := range []string{"soon", "90500ms", "4m59s", "24h1s", "-10m"} { | |
| for _, timeout := range []string{"soon", "90500ms", "10m0.5s", "4m59s", "24h1s", "-10m"} { |
There was a problem hiding this comment.
🤖 Claude Code (claude-fable-5-2), on flostadler's behalf
Fixed in 4167c1a. 10m0.5s is in the list, so the whole-second check has a value that only it rejects.
| require.NoError(t, err) | ||
| } | ||
|
|
||
| func TestMemberTimeoutKeepsNumbersAndSecrets(t *testing.T) { |
There was a problem hiding this comment.
Nit — tests
This test only covers a secret timeout on a Job. In timeoutsInSeconds the carry-over of secret and dependency flags on a Stacks entry and on the enclosing stacks map is untested. Dropping .WithSecret(entry.Secret()) or .WithSecret(stacks.Secret()) leaves the suite green, and that is the path that would turn a secret into plaintext in a preview. Add direct timeoutsInSeconds(typeStacks, ...) cases for a secret entry and a secret stacks map. A computed stacks map and a computed entry would also be worth a case.
There was a problem hiding this comment.
🤖 Claude Code (claude-fable-5-2), on flostadler's behalf
Fixed in 4167c1a. The test now calls timeoutsInSeconds(typeStacks, ...) with a secret entry, a secret stacks map, an unknown stacks map and an unknown entry next to a known one.
There was a problem hiding this comment.
Thanks for the context. The only thing that held my earlier review back was the breaking StacksEntry.timeout type change. You have confirmed it is intentional: the job timeout does not work today, and the package is in alpha. That settles the concern, and it is the reason AGENTS.md asks the description to give for a break. The conversion, the validation and the regenerated schema and SDKs were already checked. This is an automated assessment, not a human review.
The three nits in my earlier review still apply (a schema assertion in provider/provider_test.go, a sub-second duration case, and secret carry-over cases for Stacks entries). None of them blocks the merge.
…t tests Three gaps: no schema assertion for the changed type of a Stacks entry's timeout, no value that only the whole-second check rejects, and no test that a Stacks entry or the stacks map keeps its secret flag and unknown values through the conversion. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Eon ran into a problemExecution was stopped Partial work may exist — see the session log. |
There was a problem hiding this comment.
Re-review of the changes since my last review. All three earlier nits are fixed, and I read the code at this head to confirm it. TestSchemaOfTheTimeouts asserts that timeout is a string on Job and on StacksEntry. 10m0.5s is in the rejected list, so the whole-second check now has a value that only it rejects. TestMemberTimeoutKeepsNumbersAndSecrets covers a secret entry, a secret stacks map, an unknown stacks map and an unknown entry beside a known one. The incremental diff touches tests only, so there is no behavior change. The provider tests pass locally. The maintainer sign-off on the breaking StacksEntry.timeout type change was settled in the earlier round. I have no new findings. This is an automated assessment, not a human review.
Specialist passes: run directly (the incremental diff is test-only; I checked correctness, security, AGENTS.md compliance and tests myself)
A
Jobtook itstimeoutas a duration string such as"30m". AStacksentry took it as a number of seconds. The service only applies atimeoutthat is a number of seconds, so the timeout of a job had no effect: a job always stopped after the 2 hour default.Both timeouts are now Go duration strings, and the provider converts them to seconds in the declaration that it sends to the service.
declaration.request(provider/declaration.go) converts thetimeoutof aJoband of every entry of aStacksresource. Every declaration goes through it: a registration, a run in Pulumi Cloud and a local run. The resource itself keeps the string the user wrote.examples/basicuse the duration form.Breaking change: the
timeoutof aStacksentry changes from an integer to a string.timeout: 1800becomestimeout: "30m".A union of number and string would keep existing programs compiling. It is not used, on purpose:
JobandStacksthen still read differently, Go would type the field as an untyped input, and .NET would get a union wrapper. The provider has no stable release yet, so one form for both is the better trade. A program that still sends a number keeps working at run time: the provider checks it and passes it on.Hand-written changes are in
provider/(components.go,construct.go,declaration.go,annotations.go,stacks_test.go),docs/_index.mdandexamples/basic/index.ts. The schema and the SDKs are regenerated.Test plan
provider/stacks_test.go: a job with30msends 1800, a Stacks entry with1hsends 3600, an entry without a timeout sends none, the valuessoon,90500ms,4m59s,24h1sand-10mare rejected,5m,24hand90mare accepted, an unknown timeout passes in a preview, a number stays a number, and a secret timeout stays secret.timeoutSecondsofGetDeliveryMember): a job withtimeout: 5mgot 300, a job without a timeout got the default 7200, and a Stacks entry withtimeout: 1hgot 3600. The run succeeded.🤖 Generated with Claude Code