Merge origin/main into design-linked-deployments
Brings in 5c9fc1c2 (group verb: retry reads whose request got no response). One conflict, in the census chain manifest: main's group-read-transport-retry line kept, this branch's linked-deployments-slice1 line last. The re-proposal left the overlay and its seal unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 files changed,
+193
−7
docs/superpowers/notes/census-proposal-group-read-transport-retry.md+11 −0docs/superpowers/specs/2026-11-09-group-roll-verb-design.md+1 −0internal/grouprollaws/group.go+58 −7internal/grouprollaws/throttle_test.go+119 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-group-read-transport-retry.tsv+3 −0
CI passed — run details
diff --git a/docs/superpowers/notes/census-proposal-group-read-transport-retry.md b/docs/superpowers/notes/census-proposal-group-read-transport-retry.md| new file mode 100644 |
| index 000000000..e0246f0bd |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-group-read-transport-retry.md |
| @@ -0,0 +1,11 @@ |
| +# Census approval: group-read-transport-retry |
| + |
| +Ruling `census-ruling-group-read-transport-retry`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +Envelopes re-pinned: `internal/grouprollaws`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| + |
| +Seal: `9c74b9876a13a3a3802860fe44406898c8bcbfd3bd22e8172a59a02674c3b4af` → `9c74b9876a13a3a3802860fe44406898c8bcbfd3bd22e8172a59a02674c3b4af`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-group-read-transport-retry.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md b/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md| index 6e80d8697..05e64f076 100644 |
| --- a/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md |
| +++ b/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md |
| @@ -378,6 +378,7 @@ build to it. |
| | V15 | A box verb that exits non-zero is `remote` ("returned no complete result"), whatever it printed | The verb's last printable line is carried as `remote_said` ("The command on the member failed: <detail>"), non-printables made spaces, at most 512 characters; with nothing printable it stays `remote`. drain keeps its own report parsing | Dev W slot 2026-11-10: prepare's "pointer artifact does not match requested digest" reached the operator as "no complete result" | |
| | V16 | `plan` reports a missing provider observation as `record` (FileNotFoundError reached check()) | `plan` says `observation`, as preflight does | REPORT follow-up 3; flagship step 4 2026-11-11 | |
| | V17 | Every provider call is made once (`--cli-read-timeout`, retries 1) | Reads (the describes, caller identity, HeadBucket, S3 GET and list) are retried while AWS throttles them: four calls at most, about 1, 2 and 4 s apart, jittered; any other failure and the last throttle fail closed as before. Writes and box sessions are never retried. Bare `carlos system group`, its -h and an unknown verb print the group's help | Step-3 dev W4 2026-11-10: the group describe refused under ASG throttling (8a3d302) | |
| +| V18 | A request that gets no response is one failed call | A read whose request got no response at all (the SDK's RequestSendError: a reset or EOF on a reused connection, no call in CloudTrail) is retried as a throttle is (V17's budget); a timeout is not, and stays one bound. A failure to get credentials (AssumeRole, SSO), throttled or unanswered, is never retried, so no credential call repeats. Writes and sessions are never retried | G5 release 1, dev, 2026-11-11: the post-prepare group describe failed in 14 ms with no CloudTrail call; resume closed it (8a3d302) | |
| Not deviations, recorded so nobody "fixes" them in the port: the drain-rerun |
| backoff and the TakeHost `wake_timeout` follow-ups from the held build stay |
diff --git a/internal/grouprollaws/group.go b/internal/grouprollaws/group.go| index 159425c02..511b93a02 100644 |
| --- a/internal/grouprollaws/group.go |
| +++ b/internal/grouprollaws/group.go |
| @@ -19,6 +19,7 @@ import ( |
| "github.com/aws/aws-sdk-go-v2/aws" |
| "github.com/aws/aws-sdk-go-v2/aws/retry" |
| + v4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" |
| "github.com/aws/aws-sdk-go-v2/service/autoscaling" |
| astypes "github.com/aws/aws-sdk-go-v2/service/autoscaling/types" |
| "github.com/aws/aws-sdk-go-v2/service/ec2" |
| @@ -29,6 +30,7 @@ import ( |
| ssmtypes "github.com/aws/aws-sdk-go-v2/service/ssm/types" |
| "github.com/aws/aws-sdk-go-v2/service/sts" |
| "github.com/aws/smithy-go/middleware" |
| + smithyhttp "github.com/aws/smithy-go/transport/http" |
| "github.com/carlosframework/platform/internal/grouproll" |
| ) |
| @@ -72,6 +74,9 @@ func newAdapter(cfg aws.Config, c grouproll.Config) *Adapter { |
| } |
| cfg.HTTPClient = freeze(cfg.HTTPClient) |
| cfg.APIOptions = append(append([]func(*middleware.Stack) error{}, cfg.APIOptions...), boundBodyOption) |
| + if cfg.Credentials != nil { |
| + cfg.Credentials = taggedCredentials{cfg.Credentials} |
| + } |
| // Applied after the SDK's own endpoint resolution, so neither a profile |
| // nor the environment can redirect a client (spec §4). |
| return &Adapter{ |
| @@ -178,12 +183,12 @@ func call[T any](parent context.Context, fn func(context.Context) (T, error)) (T |
| return zero, grouproll.Uncertain{Key: "api"} |
| } |
| -// readCall is call for a read, retried while AWS throttles it: up to |
| -// throttleAttempts calls, each under call's own bound, with a jittered |
| -// backoff of about 1, 2 and 4 seconds between them (capped by the caller's |
| -// context). Only a throttling answer is retried; any other failure, and a |
| -// throttle on the last attempt, is call's answer as before, so the verb |
| -// still fails closed. Writes and box sessions never come through here: a |
| +// readCall is call for a read, retried while AWS throttles it or while |
| +// the request gets no answer at all: up to throttleAttempts calls, each |
| +// under call's own bound, with a jittered backoff of about 1, 2 and 4 |
| +// seconds between them (capped by the caller's context). Any other |
| +// failure, and either kind on the last attempt, is call's answer as |
| +// before, so the verb still fails closed. Writes and box sessions never come through here: a |
| // write's outcome after a failure is unknown, and retrying it is the |
| // engine's decision, not the adapter's. |
| func readCall[T any](parent context.Context, fn func(context.Context) (T, error)) (T, error) { |
| @@ -194,7 +199,8 @@ func readCall[T any](parent context.Context, fn func(context.Context) (T, error) |
| raw = e |
| return o, e |
| }) |
| - if err == nil || attempt >= throttleAttempts || parent.Err() != nil || !throttled(raw) { |
| + if err == nil || attempt >= throttleAttempts || parent.Err() != nil || signing(raw) || |
| + !(throttled(raw) || unanswered(raw)) { |
| return out, err |
| } |
| if werr := throttleWait(parent, attempt); werr != nil { |
| @@ -214,6 +220,51 @@ func throttled(err error) bool { |
| return err != nil && retry.IsErrorThrottles(retry.DefaultThrottles).IsErrorThrottle(err) == aws.TrueTernary |
| } |
| +// signing is a failure to get credentials for the request: an AssumeRole |
| +// or SSO token call that failed, which this SDK reports as "get identity" |
| +// (and older signers as v4.SigningError). Its nested error can be a |
| +// throttle or a RequestSendError, but retrying it would repeat the |
| +// credential issuance, not the read (Astra r1), so readCall never does. |
| +// newAdapter tags every provider failure as credentialError for this. |
| +func signing(err error) bool { |
| + var c *credentialError |
| + var s *v4.SigningError |
| + return errors.As(err, &c) || errors.As(err, &s) |
| +} |
| + |
| +// credentialError is a credential provider's failure, tagged. |
| +type credentialError struct{ err error } |
| + |
| +func (e *credentialError) Error() string { return e.err.Error() } |
| +func (e *credentialError) Unwrap() error { return e.err } |
| + |
| +// taggedCredentials tags its provider's failures as credentialError and is |
| +// otherwise the provider itself (the SDK's cache stays in front of it). |
| +type taggedCredentials struct{ p aws.CredentialsProvider } |
| + |
| +func (t taggedCredentials) Retrieve(ctx context.Context) (aws.Credentials, error) { |
| + c, err := t.p.Retrieve(ctx) |
| + if err != nil { |
| + return c, &credentialError{err} |
| + } |
| + return c, nil |
| +} |
| + |
| +// unanswered is a read that got no response: the SDK's RequestSendError, |
| +// the request could not be sent or its connection failed before an |
| +// answer (a reused keep-alive connection the far end had closed: reset or |
| +// EOF in milliseconds, with no call in CloudTrail; G5 release 1, dev, |
| +// 2026-11-11). A timeout is not retried here: it stays one call's bound, |
| +// as before, so a silent endpoint never costs four. |
| +func unanswered(err error) bool { |
| + var send *smithyhttp.RequestSendError |
| + if !errors.As(err, &send) { |
| + return false |
| + } |
| + var netErr net.Error |
| + return !errors.Is(err, context.DeadlineExceeded) && !(errors.As(err, &netErr) && netErr.Timeout()) |
| +} |
| + |
| // throttleWait sleeps before retry number attempt (1-based): 2^(attempt-1) |
| // seconds, jittered to between half and all of it. A test replaces it. |
| var throttleWait = func(ctx context.Context, attempt int) error { |
diff --git a/internal/grouprollaws/throttle_test.go b/internal/grouprollaws/throttle_test.go| index b2029f056..e94e1b76c 100644 |
| --- a/internal/grouprollaws/throttle_test.go |
| +++ b/internal/grouprollaws/throttle_test.go |
| @@ -2,9 +2,16 @@ package grouprollaws |
| import ( |
| "context" |
| + "net" |
| + "net/http" |
| "reflect" |
| "strings" |
| + "syscall" |
| "testing" |
| + |
| + "github.com/aws/aws-sdk-go-v2/aws" |
| + "github.com/aws/smithy-go" |
| + smithyhttp "github.com/aws/smithy-go/transport/http" |
| ) |
| const throttleXML = `<ErrorResponse><Error><Type>Sender</Type><Code>Throttling</Code><Message>Rate exceeded</Message></Error><RequestId>r</RequestId></ErrorResponse>` |
| @@ -96,3 +103,115 @@ func TestThrottleWaitBounds(t *testing.T) { |
| t.Fatalf("cancelled wait = %v", err) |
| } |
| } |
| + |
| +// dropFirst fails the first n requests as a reused connection the far end |
| +// had closed does (reset, no response), then hands them to next. |
| +type dropFirst struct { |
| + n int |
| + next *recorder |
| + sent int |
| +} |
| + |
| +func (d *dropFirst) Do(req *http.Request) (*http.Response, error) { |
| + d.sent++ |
| + if d.sent <= d.n { |
| + return nil, syscall.ECONNRESET |
| + } |
| + return d.next.Do(req) |
| +} |
| + |
| +// A read whose request got no response (the G5 release-1 dev describe: |
| +// 14 ms, no call in CloudTrail) is retried like a throttle; four in a row |
| +// fail closed with the api answer; a write is never retried. |
| +func TestReadsRetryUnanswered(t *testing.T) { |
| + ok := groupXML(2, 2, 3, [][2]string{{testIID, "InService"}}) |
| + waits := stubThrottleWait(t) |
| + d := &dropFirst{n: 1, next: newRecorder().on("DescribeAutoScalingGroups", ok)} |
| + if _, err := testAdapterWith(t, d).Describe(ctx); err != nil { |
| + t.Fatalf("reset once, then answered: %v", err) |
| + } |
| + if d.sent != 2 || len(*waits) != 1 { |
| + t.Fatalf("sent %d, waits %v", d.sent, *waits) |
| + } |
| + |
| + waits = stubThrottleWait(t) |
| + d = &dropFirst{n: 99, next: newRecorder()} |
| + _, err := testAdapterWith(t, d).Describe(ctx) |
| + if u := uncertainKey(t, err); u.Key != "api" || u.Timeout { |
| + t.Fatalf("reset throughout: %+v", u) |
| + } |
| + if d.sent != throttleAttempts || len(*waits) != throttleAttempts-1 { |
| + t.Fatalf("sent %d, waits %v", d.sent, *waits) |
| + } |
| + |
| + waits = stubThrottleWait(t) |
| + d = &dropFirst{n: 1, next: newRecorder().on("UpdateAutoScalingGroup", "<UpdateAutoScalingGroupResponse/>")} |
| + if _, err := testAdapterWith(t, d).SetMinimum(ctx, 1); err == nil || d.sent != 1 || len(*waits) != 0 { |
| + t.Fatalf("unanswered write: %v, sent %d, waits %v", err, d.sent, *waits) |
| + } |
| +} |
| + |
| +// failDo fails every request with err before any response. |
| +type failDo struct { |
| + err error |
| + sent int |
| +} |
| + |
| +func (f *failDo) Do(*http.Request) (*http.Response, error) { f.sent++; return nil, f.err } |
| + |
| +// netTimeout is a dial or read timeout as the transport reports it. |
| +type netTimeout struct{} |
| + |
| +func (netTimeout) Error() string { return "i/o timeout" } |
| +func (netTimeout) Timeout() bool { return true } |
| +func (netTimeout) Temporary() bool { return true } |
| + |
| +// A timeout is not "unanswered": it stays one call's bound, whether the |
| +// transport fails before a response (a dial or header timeout, a deadline: |
| +// RequestSendError around a timeout) or the body stalls after headers. |
| +func TestReadTimeoutNotRetried(t *testing.T) { |
| + for name, e := range map[string]error{ |
| + "dial timeout": &net.OpError{Op: "dial", Net: "tcp", Err: netTimeout{}}, |
| + "deadline": context.DeadlineExceeded, |
| + } { |
| + waits := stubThrottleWait(t) |
| + f := &failDo{err: e} |
| + _, err := testAdapterWith(t, f).Describe(ctx) |
| + if u := uncertainKey(t, err); !u.Timeout || f.sent != 1 || len(*waits) != 0 { |
| + t.Fatalf("%s: %+v, sent %d, waits %v", name, u, f.sent, *waits) |
| + } |
| + } |
| + waits := stubThrottleWait(t) |
| + rec := newRecorder().onStall("DescribeAutoScalingGroups") |
| + _, err := testAdapter(t, rec).Describe(ctx) |
| + if u := uncertainKey(t, err); !u.Timeout || len(rec.requests()) != 1 || len(*waits) != 0 { |
| + t.Fatalf("stall: %+v, %d requests, waits %v", u, len(rec.requests()), *waits) |
| + } |
| +} |
| + |
| +// A read whose credentials could not be issued (an AssumeRole that got no |
| +// answer, or was throttled) is not retried: that would repeat the |
| +// credential call, not the read (Astra r1). |
| +func TestReadCredentialFailureNotRetried(t *testing.T) { |
| + for name, e := range map[string]error{ |
| + "unanswered": &smithyhttp.RequestSendError{Err: syscall.ECONNRESET}, |
| + "throttled": &smithy.GenericAPIError{Code: "Throttling", Message: "Rate exceeded"}, |
| + } { |
| + waits := stubThrottleWait(t) |
| + calls := 0 |
| + rec := newRecorder().on("DescribeAutoScalingGroups", groupXML(2, 2, 3, [][2]string{{testIID, "InService"}})) |
| + cfg := aws.Config{ |
| + Region: "eu-west-1", |
| + HTTPClient: rec, |
| + RetryMaxAttempts: 1, |
| + Credentials: aws.CredentialsProviderFunc(func(context.Context) (aws.Credentials, error) { |
| + calls++ |
| + return aws.Credentials{}, e |
| + }), |
| + } |
| + _, err := newAdapter(cfg, testConfig()).Describe(ctx) |
| + if uncertainKey(t, err).Key != "api" || calls != 1 || len(rec.requests()) != 0 || len(*waits) != 0 { |
| + t.Fatalf("%s: %v, credential calls %d, requests %d, waits %v", name, err, calls, len(rec.requests()), *waits) |
| + } |
| + } |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index ae926311c..c67be335f 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -167,4 +167,5 @@ plan14-root-reads-group-bucket-region.tsv 733204d61bea49fe418d8ff0f1bfa20d77bdff |
| plan14-root-reads-w6-ingress-drain.tsv 43260792034a1a20791d14c4e4476e762b40d7bcca64257ef2e9899da6af5df0 |
| plan14-root-reads-group-capacity-damping.tsv 0c649af234a7b89a75479e59e705307e3293a59439b7b251dd4558bd46ef2100 |
| plan14-root-reads-group-verb-followups.tsv 9c74b9876a13a3a3802860fe44406898c8bcbfd3bd22e8172a59a02674c3b4af |
| +plan14-root-reads-group-read-transport-retry.tsv 9c74b9876a13a3a3802860fe44406898c8bcbfd3bd22e8172a59a02674c3b4af |
| plan14-root-reads-linked-deployments-slice1.tsv 40c8459580c3e62a53637e9989f1616e5735ce78796ec6ea1b22655a5eb4ad63 |
diff --git a/internal/provision/testdata/plan14-root-reads-group-read-transport-retry.tsv b/internal/provision/testdata/plan14-root-reads-group-read-transport-retry.tsv| new file mode 100644 |
| index 000000000..ea3baf866 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-group-read-transport-retry.tsv |
| @@ -0,0 +1,3 @@ |
| +# Census overlay group-read-transport-retry, written by census-propose (#369). census-ruling-group-read-transport-retry, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-group-read-transport-retry.md. |
| +# 0 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@coverage internal/grouprollaws 4072aeb1c55a9528afc83f2b16ce4c43f07912dc6dbdbbcc7e601160a8214657 |