carlos / platform Public

docs: managed fleets plan 2b-1 (console-side AWS) draft

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev cde7f69456989fbdc73e45e9976a12e304b8a95a parent 9622c65
1 file changed, +765 −0
  • docs/superpowers/plans/2026-11-08-managed-fleets-2b1-console-aws.md +765 −0
diff --git a/docs/superpowers/plans/2026-11-08-managed-fleets-2b1-console-aws.md b/docs/superpowers/plans/2026-11-08-managed-fleets-2b1-console-aws.md
new file mode 100644
index 000000000..93de419e9
--- /dev/null
+++ b/docs/superpowers/plans/2026-11-08-managed-fleets-2b1-console-aws.md
@@ -0,0 +1,765 @@
+# Managed fleets 2b-1: console-side AWS Implementation Plan
+
+> **For agentic workers:** Follow the controller's execution contract task-by-task; implementers do not spawn subagents. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Fix the parked console defects and supply tested AWS compute, fleet-storage and IAM implementations while managed launches remain disabled.
+
+**Architecture:** Keep durable operations, quota, enrolment and readiness in the provider-neutral console core. Add `internal/awsmanaged` implementations of the existing compute and fleetstore contracts, with SDK clients injected in tests. Restrict the existing store door so only the console can publish readiness; production adapter wiring and every box-side change wait for 2b-2.
+
+**Tech Stack:** Go, SQLite, AWS SDK v2 already pinned in go.mod, existing rootaws credential loading, Terraform/OpenTofu module sources, mocked SDK transport and local rendered-policy fixtures.
+
+**Spec:** `docs/superpowers/specs/2026-10-28-managed-fleets-design.md` §4 Phase 2 and addendum, §§5–6 and §8. Binding split/rulings: `/home/paulca/.cache/managed-fleets-2b-notes/decisions.md`. Recon: `/home/paulca/.cache/managed-fleets-2b-notes/recon.md`. Predecessor: `docs/superpowers/plans/2026-11-01-managed-fleets-2a-core.md`; parked findings: `docs/superpowers/notes/managed-fleets-2a-ledger.md`.
+
+Source baseline is main `9622c65a159480a687f066f7a24e28a31c68360d`.
+Existing signatures below were checked against that checkout, not copied from the older 2a plan.
+Every declaration labelled **new** is an implementation decision for this plan.
+This draft writes only this file; it runs no tests, makes no commits and dispatches no agents.
+
+## Global Constraints
+
+The following execution constraints are carried over verbatim from 2a:
+
+- Commit subjects under 80 characters; body after a blank line.
+- No tenant names; neutral examples (shop, example.com, production).
+- Implementers mark/list draft member-facing strings as COPY and do not run copy review; the controller completes copy review before merge.
+- Provider-neutral core: no AWS SDK import outside adapters; an import test enforces it.
+- Request budget (spec §6): no new steady-state per-box store polling; worker idle = zero calls.
+- A managed box runs no workloads until the console writes its ready.json after all six checks pass; 2a supplies the signal and fake proof, 2b must enforce the box-side joining marker before switch-on.
+- Verification budget: mutation checks only on refusal, security, termination and lifecycle paths, at most ~10 per
+ task, targeted -run; local runs once with -count=1 plus one -race; touched packages only (CI runs the full suite);
+ activator/socket tests need TMPDIR=/tmp/k.XXXX (short path).
+- Go: GOFLAGS=-buildvcs=false; leave GOCACHE default.
+- Census: changes to authority/record-write inventories need make census-card / census-propose with an independent
+ reviewer approval recorded on discussion #280 (see AGENTS.md); name which tasks touch census in each task.
+- These are execution instructions. Drafting this plan runs no tests and makes no implementation changes.
+- Existing fleets decode as BYO. Preserve wire compatibility, secrets-key fields, drain marks, ownership and revision semantics.
+- Any account member may use managed create/add/show. Membership in another account grants no inspection or mutation authority.
+- `enabled` defaults false. Missing providers also refuse new reservations. Production never substitutes a fake when a provider is missing.
+- Disabling admission does not abandon already reserved work or its cleanup. Frozen reservations survive config removal and ceiling reductions.
+- Each task's failing run and passing run are the TDD pair. Run the touched-package race check once after integration; do not repeat full suites locally between tasks.
+- Review only security, cache, termination, storage and authority tasks individually; other tasks receive the whole-branch review. Follow the existing three-round budget and stop at the first round without P1.
+
+The following constraints apply to this slice and supersede 2a's phase-specific exclusions:
+
+- Verification budget: **never run the whole internal/console package locally**. Use named `-run` selections; CI owns the full suite and cross-builds.
+- This machine's scratch rule supersedes the inherited socket-path suggestion: use an owned short directory on disk under `$TMPDIR` or `~/.cache`; never redirect Go caches to `/tmp`.
+- No live AWS, including read-only SDK tests, policy simulation against IAM, or infrastructure experiments. Mock credentials and SDK clients/transport explicitly; disable metadata access in tests.
+- Feature stays off (`enabled=false`) through 2b-1. The first switch-on belongs to Paul's approved 2b-2 dev drill; this plan grants no live authorization.
+- Terraform changes are validated locally (`tofu validate` and a rendered fixture with a mocked provider) and never applied. No real deployment configuration, security group or IAM resource is changed here.
+- One branch, `managed-fleets-2b1`; tasks committed in order; one reviewed squash merge at the end on Paul's go. Task 1 fixes observable retry/status behavior first; it is not merged separately.
+- Astra implements; the controller obtains Opus review for risky implementation tasks and the branch, as decisions.md requires. Drafting uses no reviewers or subagents, including no Anthropic models.
+- Implementers stop at local checks, commit, census proposal and report. The controller owns copy review, independent review, #280, push, CI and landing; this draft performs none of those actions.
+- A review stops at its first round without P1; apply P2 without reopening, list P3 for follow-up. Three rounds maximum; two rounds in the same fault family stop fixes and go to Paul with the gate/cut/single-invariant choices.
+- Carry 2a's closed rounds 1–3 and build/final-review dispositions in every brief. Splitting 2b does not reset an existing review count or reopen settled joining/publication decisions.
+- `CARLOS_HOST_CLAIM` remains an explicit refusal. Do not unwrap gated SQL or add a trusted transaction escape hatch.
+- Managed EC2 instances have no instance profile, SSH key or SSM access. Use only the configured dedicated managed-box security groups: no inbound rules; approved HTTPS egress to hub/store/S3/EC2 endpoints.
+- No cloud-init, enrolment client, box joining code, secrets-key writer, storage challenge, tunnel probe or production provider wiring in 2b-1.
+- Fleet buckets use versioning, SSE-S3, all public-access blocks, seven-day noncurrent retention and seven-day incomplete multipart cleanup. There is no current-object expiry or last-box deletion here.
+- AWS credential loading goes only through `internal/rootaws`. Never reuse an app-store policy as the fleet-data policy, or widen app-store inline policies to give fleet powers.
+- Preserve C08: a matching published object may already have authorized workloads; uncertainty holds quota and never revokes, overwrites, deletes or terminates that box.
+
+## Review Focus
+
+1. Reusing a ClientToken with changed parameters must not become proof that no instance exists. Task 3 `TestAWSComputeClientTokenConflict`, composed with Task 2 `TestManagedRejectedAfterAmbiguity`, owns the quota invariant.
+2. A later DescribeInstances page can contain the instance or fail. Task 3 `TestAWSComputeDescribeComplete` requires complete pagination or an error with no usable partial result; no partial absence can trigger relaunch or cleanup.
+3. An existing IAM user may have the expected name but the wrong path, account, boundary or policies. Task 4 `TestAWSFleetExistingUserDrift` refuses it before any key creation or deletion; Task 5 pins the boundary condition in rendered IAM.
+4. Two lost rotations followed by a third mint must retain the delivered key. Task 4 `TestAWSFleetCredentialsDoubleLostRotation` verifies the exact kept ID, orphan reaping before mint, pagination and crash recovery.
+5. Fleet credentials must not reach a sibling fleet or deployment bucket through another Allow, version operation or copy source. Tasks 4–5 `TestAWSFleetDataPolicyIsolation` and `TestManagedFleetRenderedPolicyIsolation` evaluate the exact inline policy and boundary together.
+
+---
+
+## File map and inherited findings
+
+| Task | Files / responsibility |
+|---|---|
+| 1 | Console admission, preparation, enrolment; bounded registry snapshot reads |
+| 2 | Console worker/recovery/readiness; ambiguous launch and publication authority |
+| 3 | New `internal/awsmanaged/{compute,clients,diagnostics}.go`; compute adapter |
+| 4 | New `internal/awsmanaged/{storage,credentials,policy}.go`; fleet bucket/user/key lifecycle |
+| 5 | `infra/modules/region-host/managed_fleets.tf`, module variables/boundary/tests; opt-in console authority |
+| 6 | `internal/edge/storedoor.go` and tests; exact ready-object mutation denial |
+| 7 | Task-owned integration/budget tests, census and controller landing gates |
+
+The ledger's parked findings are preserved here with their exact wording:
+
+> Final: parked — N1 a new request ID joining the caller's own open op writes an uncharged alias row (unbounded while
+> the op is open) — Ruling: before 2b switch-on, charge or cap aliases per op — cost if wrong: an authenticated member
+> can grow one table during their own open op.
+
+> Final: parked — N3 a pass that fails after preparation already succeeded (e.g. shutdown) rewrites the transient error
+> and later passes never clear it — Ruling: fix before 2b switch-on with the same clear-on-prepared rule — cost if
+> wrong: a done op can read "failed" after an unlucky restart.
+
+> Final: parked — N4 an uncertain box later read as absent is published on hours-old check results — Ruling: before 2b
+> switch-on, re-run the six checks when publication happens long after ready time — cost if wrong: a box that degraded
+> while uncertain gets ready.json; heartbeats still watch it.
+
+> Final: parked — test gap: no test that a NEW request ID still gets 429 once the budget is used (the code path is
+> reviewed correct) — Ruling: add with the N1 fix.
+
+The ledger names “Before-2b minors: T6 Minors 1, 2, 4; T4 Minor 3; T7 Minor 4.”
+Their source findings were rechecked against the code: T4 M3 is registry I/O inside the sole SQL connection's transaction;
+T6 M1 is rejection after an ambiguous launch; T6 M2 is provider I/O under lockFleet;
+T6 M4 is hourly retry scheduling before the readiness deadline; T7 M4 is transient enrolment failures returned as 403.
+Tasks 1–2 close these findings. N2 remains accepted; the other accepted minors remain follow-ups.
+2a's placement-before-readiness family occurred in rounds 1 and 2; Paul chose the upfront joining gate.
+Round 3 fixed delivered-key preservation; build ruling C08 superseded uncertain-publication cleanup.
+The 2a final review and scoped fix review closed with no new Critical/Important findings; this draft opens no review round.
+
+### Task 1: Bound admission work and make retry/status behavior reliable
+
+**Files:**
+- Modify: `internal/console/{managedstore,managedhistory,managedenrol,managedworker,store}.go`.
+- Modify tests: `internal/console/{managedstore,managedhistory,managedenrol,managedfinalfix,managedworker,managed_e2e}_test.go` as needed for the context-aware registry seam.
+- Create: `internal/console/managedpreflight_test.go`.
+- Modify: `internal/registry/fleets.go`; test `internal/registry/{fleets,remote}_test.go`.
+
+**Interfaces:**
+- Existing `(*Store).ReserveManaged(ctx context.Context, r managedRequest, snap managedConfigSnapshot, deployment string, now time.Time, enrolHash func(string) (string, error)) (op managedOp, boxes []managedBox, existing bool, err error)` (`managedstore.go:185`).
+- Existing `(*Store).AllocatePreparedManaged(ctx context.Context, id string, snap managedConfigSnapshot, deployment string, now time.Time, enrolHash func(string) (string, error)) (boxes []managedBox, err error)` (`managedstore.go:455`).
+- Existing `(*Server).prepareManagedFleet(ctx context.Context, op managedOp, boxes []managedBox) (result error)` (`managedhistory.go:154`).
+- Existing `(*Server).enrolManagedBox(ctx context.Context, in managedEnrolRequest, now time.Time) (managedEnrolReply, error)` (`managedenrol.go:69`).
+- New `const managedAliasLimit = 64`; includes the original request alias, scoped to an operation.
+- New `type managedRegistrySnapshot struct { Fleet registry.Fleet; Labels []string }`.
+- New `(*Store).managedRegistrySnapshot(ctx context.Context, fleet, account string) (managedRegistrySnapshot, error)`.
+- New `(*registry.Registry).GetFleetContext(ctx context.Context, name string) (*registry.Fleet, error)` and `ListFleetBoxesContext(ctx context.Context, fleet string) ([]registry.FleetBox, error)`.
+- Existing registry methods keep their signatures and delegate with a background context; context-aware variants pass ctx to SQL and remote.call.
+- Change Store.managedRegistry and managedRegistryPath to consume those context-aware methods; update its concrete test fixtures.
+- New internal sentinel `errManagedEnrolRetryable`; the HTTP handler maps it to 503 with `Retry-After: 5`, `Cache-Control: no-store`.
+
+**Census/review:** Registry method bodies/envelopes are root-read scope. Console admission and enrolment changes also need authority/write inventory checks and a security review; no raw SQL claim bypass.
+
+- [ ] **Step 1: Write the failing regression tests.**
+
+```text
+TestManagedAliasCap: original + 63 distinct joins => 64 aliases and one operation;
+ 65th distinct ID => 429, no alias or box insert; original/previous aliases replay at cap;
+ concurrent joins at 63 => exactly one extra row; changed payload => 409;
+ foreign owner never receives op ID; replay works after closure/reopen/config disable.
+TestManagedNewRequestBudget: exhaust create budget; NEW ID for a new operation => 429;
+ repeat for add/write budget; same accepted ID still returns the original operation;
+ denied new operation => zero name claims, aliases, reservations and provider calls.
+TestManagedPreparedErrorCleared: prepared=1 plus managed_preparation_failed => clear error;
+ later worker pass and completed show have no stale failure; unrelated errors survive;
+ canceled pass after successful preparation cannot leave that transient error forever.
+TestManagedRegistryOutsideTransaction: park GetFleetContext/ListFleetBoxesContext;
+ unrelated SELECT completes before releasing the registry fake; snapshot expires at 30s;
+ canceled remote call returns; no helper goroutine remains blocked; no partial reservation.
+TestManagedRegistrySnapshotAllocation: labels box-8 plus retained box-9 => next box-10;
+ registry failure/foreign owner/BYO => no reserve; quota remains one SQL transaction;
+ repeat for deferred AllocatePreparedManaged and concurrent account quota admission.
+TestFleetContext: local methods retain all fleet/box fields; remote methods honor cancellation;
+ legacy wrappers return the same results; canceled read does not mutate registry state.
+TestManagedEnrolRetryStatus: valid unused token + transient preclaim failure => 503/5;
+ token remains unused, no active token and no credentials; repaired backend => one 200;
+ unknown/expired/used => identical 403; postclaim failure and lost response remain terminal;
+ 429/IP-before-global and HostClaim refusal retain existing behavior.
+```
+
+- [ ] **Step 2: Run the targeted failing tests.**
+
+Run `GOFLAGS=-buildvcs=false go test ./internal/console ./internal/registry -run 'TestManaged(AliasCap|NewRequestBudget|PreparedErrorCleared|RegistryOutsideTransaction|RegistrySnapshotAllocation|EnrolRetryStatus)|TestFleetContext' -count=1`.
+Expected: the new assertions fail on the old behavior; failures are not missing environmental services.
+Use channels and canceled contexts to prove blocking behavior; the test must not sleep for 30 seconds.
+
+- [ ] **Step 3: Cap new aliases atomically and preserve replay precedence.**
+
+Enforce the cap in managedAlias's existing BEGIN IMMEDIATE transaction, immediately before inserting a new ID.
+Resolve already-stored account/request IDs before the cap, quota, config, plan and rate-limit checks.
+Retain all accepted aliases after closure; do not prune away the promise that a lost request can replay.
+An existing database already over 64 keeps its rows but admits no new aliases for that operation.
+Use an indexed op_id count; add `managed_request_aliases_op` idempotently in migrateManaged.
+Choose the cap option from N1; matching joins need not consume the daily new-operation budget.
+Mark the cap refusal as COPY; existing identical-retry messages and response codes remain unchanged.
+
+- [ ] **Step 4: Move bounded registry reads outside SQL transactions.**
+
+Resolve known aliases before registry access, then obtain a detached snapshot with a shared 30-second context.
+For deferred allocation, read the operation identity first, fetch its snapshot, then re-read the operation inside BEGIN IMMEDIATE.
+Inside the transaction re-resolve requests/open state, preparation, ownership recorded in SQL, retained labels and both quotas.
+Combine snapshot labels with all retained managed labels; do not infer the next number solely from the snapshot.
+The server's existing managed admission lock covers snapshot plus allocation; add the same lock around the worker's deferred-allocation call in managedworker.go.
+Managed BYO growth remains refused.
+Keep one serving console/managed worker per database as in 2a; do not claim a new distributed registry transaction.
+The context-aware registry variants preserve freshFleetsConn and every existing field; cancel the real remote call, not a goroutine around an uncancellable call.
+
+- [ ] **Step 5: Clear prepared errors and classify preclaim enrolment failures.**
+
+On the already-prepared return, conditionally clear only `managed_preparation_failed` for the matching open operation.
+Constrain the deferred failure write so a prepared record is not newly marked with that transient error.
+FinishManagedOp also clears that specific preparation error when its matching storage is prepared, so a retained old error cannot survive closure.
+Return the retryable sentinel for unavailable storage/registry/history work before the token CAS, including SQL read errors.
+Invalid identity, nonempty data, consumed/expired tokens and permanent history refusals remain generic 403.
+After an uncertain or successful claim, never promise retryability; retain consumed-token cleanup and replay refusal.
+Keep the response body generic (COPY); never include provider errors, the token or registry paths.
+2b-2's client retries 503/429 within the original expiry and treats 403 as terminal; no client is added here.
+
+- [ ] **Step 6: Repeat Step 2 to PASS and commit.**
+
+Also select the existing `TestManagedRetryExhaustedBudget`, `TestManagedEnrolReplayAndRace` and quota witnesses once.
+Commit subject: `fix: bound managed admission and preserve retry status`.
+
+### Task 2: Preserve lifecycle authority across ambiguity and slow calls
+
+**Files:**
+- Modify: `internal/console/{managedworker,managedready,managedstore}.go`.
+- Modify: `internal/compute/{provisioner,fake}.go` and `fake_test.go`.
+- Create: `internal/console/managedrecovery_test.go`; extend `managedready_test.go`, `managedbudget_test.go`.
+
+**Interfaces:**
+- Existing `(*Server).stepManagedBox(ctx context.Context, b managedBox, now time.Time) error` (`managedworker.go:259`).
+- Existing `(*Store).AdvanceManagedBox(ctx context.Context, before, after managedBox) (bool, error)` (`managedstore.go:374`); preserve its exact storedLaunch CAS.
+- Existing `(*Server).observeManagedReadiness(ctx context.Context, b managedBox, now time.Time) (map[string]managedCheck, string, error)` (`managedready.go:63`).
+- Existing `(*Server).verifyManagedPublication(ctx context.Context, b managedBox, now time.Time) error` (`managedworker.go:576`).
+- Change internal `(*Server).launchManagedBox(ctx context.Context, b managedBox, now time.Time, firstDispatch bool) error`.
+- New compute sentinel `ErrLaunchConflict`; token mismatch is ambiguity, never ErrLaunchRejected.
+- New `(*Server).refreshManagedPublication(ctx context.Context, b managedBox, now time.Time) (managedBox, bool, error)`; bool means all six current checks authorize a new PUT.
+- New `const managedPublicationFreshFor = time.Minute`; LastHeartbeatAt remains the persisted observation-attempt time.
+- Add `ReadinessCheckedAt time.Time` with JSON `readiness_checked_at` to managedBox; it dates completed checks, while ReadyAt remains immutable. Missing legacy values require refresh.
+
+**Census/review:** Termination, token revocation and ready publication need independent risk review plus authority/write inventory updates. Compute may enter root scope through the console store imports; census-card decides actual membership.
+
+- [ ] **Step 1: Write failing lifecycle tests.**
+
+```text
+TestManagedRejectedAfterAmbiguity: first Launch accepts but response is lost; Find empty;
+ second Launch rejected => no quota release; restart retains uncertain cleanup;
+ later exact identity appears => original CloudID recovered, no arbitrary replacement;
+ same-token parameter conflict and a legacy launching envelope behave the same way.
+TestManagedFreshRejectedLaunch: reserved -> durable launching -> first dispatch rejected
+ with definitive no-side-effect error => terminated; crash after commit is NOT firstDispatch.
+TestManagedProviderOutsideFleetLock: block Find/Launch/Lookup/Terminate;
+ same-fleet member operation acquires lock; provider cancellation ends the pass;
+ stale result after enrolment/state advance loses CAS and cannot overwrite newer authority.
+TestManagedDeadlineBeforeBackoff: NextCleanupAt=+1h in launching/booting/enrolled;
+ at launch+20m => failure/cleanup scheduled; no hour delay or renewed deadline;
+ publishing uncertainty/ready never enter this deadline cleanup arm.
+TestManagedDelayedPublicationFreshness: absent object after >=60s => six fresh checks;
+ stale heartbeat, new stable release or failed storage/router => no PUT;
+ all current passes => create-only PUT with ORIGINAL ready_at and op; restart same;
+ matching existing object => ready even if fresh checks would fail; no termination;
+ mismatch/unreadable object => no PUT/revoke/terminate; postdeadline hourly schedule;
+ absent + fresh checks not passing at deadline => proven-unpublished cleanup.
+TestManagedPublicationRefreshBudget: absent delayed publication reads heartbeat once/60s;
+ one stable pointer per due pass, owner only after other five pass; zero LIST;
+ matching-object recovery and settled boxes => zero readiness reads;
+ crash after attempt stamp/before observation => old passes cannot authorize a PUT.
+```
+
+- [ ] **Step 2: Run `GOFLAGS=-buildvcs=false go test ./internal/console ./internal/compute -run 'TestManaged(RejectedAfterAmbiguity|FreshRejectedLaunch|ProviderOutsideFleetLock|DeadlineBeforeBackoff|DelayedPublicationFreshness|PublicationRefreshBudget)|TestFakeClientToken' -count=1`; expect FAIL.**
+
+- [ ] **Step 3: Separate first dispatch proof from later rejection.**
+
+Only the live reserved-to-launching transition may pass firstDispatch=true to its immediate call.
+Every recovery call, including a restart between the commit and network dispatch, passes false.
+ErrLaunchRejected describes that one request; after any possible prior dispatch it cannot prove the reservation absent.
+Change the fake's changed-spec error to ErrLaunchConflict, and map AWS's corresponding error the same way in Task 3.
+Unknown errors retain quota; exact-ID absence still needs persisted termination-attempt identity.
+Keep never-launched reserved expiry at 30 minutes and launched readiness expiry at 20 minutes.
+Evaluate these deadlines before NextCleanupAt for their applicable states; retain hourly cleanup/publication schedules.
+
+- [ ] **Step 4: Release lockFleet around compute-provider and readiness observation I/O.**
+
+Retain the existing serialized worker pass; take the fleet lock only to reload, validate and commit transitions or change registry authority.
+Persist launch/termination intent before releasing the lock and making the provider call with its 30-second context.
+Reacquire, reload and compare the saved envelope before applying results; a lost CAS discards the result and wakes another pass.
+Never hold an SQL transaction while calling a provider, registry RPC or release store.
+Retain token revocation ordering under the fleet lock before termination intent; retain conditional drain clear under that lock.
+Readiness observes outside the lock, then verifies the reservation is still eligible before entering publishing.
+One serialized publisher owns ready-object I/O; member paths cannot fail/replace a publishing reservation during the call.
+Do not make the worker parallel merely to remove the lock; no new provider polling loop or lease protocol.
+
+- [ ] **Step 5: Refresh checks before delayed absent-object publication.**
+
+GET and classify the object first: matching, mismatched/unreadable, or definitely absent.
+Matching objects complete ready immediately; their authority has already been granted and is never reconsidered by fresh checks.
+For absent objects with stale or missing ReadinessCheckedAt, refresh only when the LastHeartbeatAt attempt budget is due.
+Persist the attempt timestamp before observing all six checks; after observation persist checks/version/ReadinessCheckedAt together by CAS.
+Initial checkManagedReadiness records ReadinessCheckedAt too. A failed/incomplete observation never dates old successful checks as fresh.
+After a crash between attempt and result, wait for the next allowed attempt and do not PUT; the persisted old passes remain stale.
+Use a fresh managedReadinessPass for the current worker pass; never reuse the stable pointer from an earlier pass.
+If observation fails or any check is not pass, do not PUT; before deadline wait, after deadline use the proven-absent failure path.
+If fresh checks pass and the original ReadyAt was before launch+20m, issue the original create-only object and verify by GET.
+Never reset ReadyAt or the launch deadline; immediate near-deadline publication keeps 2a's same-step behavior.
+Preserve C08 on every post-PUT result, including a response lost after the box consumed the object.
+
+- [ ] **Step 6: Repeat Step 2 to PASS, run the existing C08/deadline witnesses once and commit.**
+
+Select `TestManagedPublishDeadline`, `TestManagedPublicationNearDeadline`, `TestManagedAcceptedTerminateAbsent` and `TestManagedPublicationUncertaintyResolves`.
+Commit subject: `fix: preserve managed lifecycle authority across retries`.
+
+### Task 3: Implement the AWS compute adapter
+
+**Files:**
+- Create: `internal/awsmanaged/{clients,compute,diagnostics}.go`.
+- Create tests: `internal/awsmanaged/{compute,diagnostics}_test.go`.
+- Retain the boundary witness in `internal/compute/imports_test.go`; no SDK import in console managed*.go.
+
+**Interfaces:**
+- Consumes `compute.Identity`, `LaunchSpec`, `Instance`, `State`, `ErrLaunchRejected`, `ErrIdentityMismatch` and Task 2's ErrLaunchConflict.
+- Implements the existing six-method `compute.Provisioner` from `internal/compute/provisioner.go:41`:
+
+```go
+Launch(ctx context.Context, s compute.LaunchSpec) (compute.Instance, error)
+Find(ctx context.Context, region string, id compute.Identity) ([]compute.Instance, error)
+Lookup(ctx context.Context, region, cloudID string) (compute.Instance, error)
+Terminate(ctx context.Context, region, cloudID string, want compute.Identity) error
+ListDeployment(ctx context.Context, region, deployment string) ([]compute.Instance, error)
+ConsoleOutput(ctx context.Context, region, cloudID string) (string, error)
+```
+
+- New `type ComputeConfig struct { Deployment, AccountID string; Regions []string }` and `type Compute struct` implementing that interface.
+- New `NewCompute(ctx context.Context, cfg ComputeConfig) (*Compute, error)`; load each explicit region through rootaws, with no implicit-region fallback.
+- New `type HTTPClient interface { Do(*http.Request) (*http.Response, error) }` and `NewComputeWith(ctx context.Context, cfg ComputeConfig, transport HTTPClient) (*Compute, error)` for explicit transport injection through rootaws load options.
+- New unexported `newCompute(cfg ComputeConfig, clients map[string]ec2API) (*Compute, error)` for mocks; deep-copy configuration.
+- New ec2API contains RunInstances, DescribeInstances, DescribeImages, TerminateInstances and GetConsoleOutput only.
+- Each SDK method has `(context.Context, *ec2.XInput, ...func(*ec2.Options)) (*ec2.XOutput, error)`; GetConsoleOutput's result type is `*ec2.GetConsoleOutputOutput`.
+- New `sanitizeConsoleOutput(encoded string) (string, error)`; it returns only recognized fixed breadcrumb codes, never arbitrary decoded lines.
+
+**Census/review:** Launch, discovery and termination are production paths and require a risk review. New adapter code remains console-only unless dependency census proves otherwise; no rootaws changes are needed.
+
+- [ ] **Step 1: Write mocked EC2 contract tests.**
+
+```text
+TestAWSComputeLaunch: one instance, exact ClientToken and four identity tags on instance/volume;
+ pinned arm64 available EBS AMI and its actual root device; root=RootGB encrypted gp3,
+ delete-on-termination=true; IMDSv2 required, hop limit=1; profile/key pair absent;
+ configured subnet/SG IDs and exact base64 UserData; no stable pointer/config fetch.
+TestAWSComputeFrozenRequest: retry/recreate adapter after config source changes => identical
+ RunInstances request for the frozen spec; no wall clock, random tag or live stable digest.
+TestAWSComputeClientTokenConflict: same token + changed UserData/root/SG => ErrLaunchConflict;
+ errors.Is(ErrLaunchRejected)==false; previous physical instance remains discoverable.
+TestAWSComputeDescribeComplete: instance on page 2; next page error; repeated NextToken;
+ Find/ListDeployment return complete set or nil,error, never a usable prefix;
+ exact Lookup has no tag filter; malformed/duplicate/conflicting IDs => ambiguity.
+TestAWSComputeAbsence: empty filtered Find != proof of termination; exact-ID NotFound
+ is classified separately; throttle/5xx/access denied/timeouts/malformed output never os.ErrNotExist;
+ stopped/stopping/shutting-down remain nonterminal; terminated remains discoverable.
+TestAWSComputeTerminateIdentity: mismatch/missing/duplicate tag for EACH identity component,
+ wrong region/deployment or invalid ID => zero TerminateInstances calls;
+ exact lookup match => exactly one ID terminated; acceptance is not a termination observation.
+TestAWSComputeConsoleOutput: bounded base64 decode; recognized breadcrumb codes only;
+ sentinels for enrol/tunnel/access/private secrets, shell trace, unknown lines absent from output/errors.
+```
+
+- [ ] **Step 2: Run `GOFLAGS=-buildvcs=false go test ./internal/awsmanaged ./internal/compute -run 'TestAWSCompute|TestManagedCoreImports' -count=1`; expect FAIL.**
+
+- [ ] **Step 3: Build deterministic launch requests through rootaws clients.**
+
+Use `internal/rootaws/config.go:38`'s `LoadDefaultConfig(ctx context.Context, opts ...func(*awsconfig.LoadOptions) error) (aws.Config, error)`.
+The existing SDK pins are EC2 v1.324.0, IAM v1.58.2 and S3 v1.105.0; no dependency upgrade is required.
+Reject empty/invalid identities, client tokens, regions, image/subnet/SG IDs, size or disk before RunInstances.
+Validate ARM instance types against the admitted frozen shape; describe the exact AMI, require arm64/available/EBS and a single valid root mapping.
+Use its immutable root-device metadata; refuse root disk smaller than the source volume or unsupported extra block mappings.
+Request MinCount=MaxCount=1, encrypted gp3, no spot request, no launch template and no instance profile.
+Use one new primary ENI in the frozen subnet with frozen SGs and delete-on-termination; enable public IPv4 for this egress-only self-hosted slice.
+Do not create networks or alter SG rules; subnet routing and endpoint reachability are 2b-2 drill preconditions.
+Tag keys are exactly `carlos:deployment`, `carlos:fleet`, `carlos:label`, `carlos:operation`; values come from frozen Identity.
+Validate UserData length <=16,384 decoded bytes and encode once; treat it as opaque frozen bytes, not a script to construct here.
+This adapter is deliberately unwired: the current managedLaunchRequest emits JSON, and 2b-2 must replace it with frozen cloud-init before production use.
+Use MaxAttempts=1 for RunInstances and TerminateInstances so hidden SDK retries do not obscure the worker's attempt evidence.
+Return only safe typed classifications; never wrap an AWS response containing UserData or arbitrary service text into member diagnostics.
+
+- [ ] **Step 4: Implement complete discovery and conservative absence.**
+
+Find filters all four identity tags in the explicit region; ListDeployment filters only the deployment tag.
+Consume every page under the caller's deadline; detect repeated tokens, malformed reservations and conflicting duplicate IDs as errors.
+Lookup addresses exactly one cloud ID with no identity-tag filters; validate the response region/client binding and ID.
+An AWS exact `InvalidInstanceID.NotFound` is the only not-found service code mapped to os.ErrNotExist; an empty success is ambiguity.
+The adapter does not assert that a recent launch is gone: only the worker's recorded exact-ID termination attempt permits absence to release quota.
+For Launch, the initial no-side-effect rejection allowlist is InvalidAMIID.Malformed, InvalidSubnetID.NotFound, InvalidGroup.NotFound, InvalidParameterValue, Unsupported, UnauthorizedOperation, InsufficientInstanceCapacity and InstanceLimitExceeded.
+Classify these as ErrLaunchRejected; the worker still requires firstDispatch proof to release quota. Unknown codes are ambiguous.
+IdempotentParameterMismatch always becomes ErrLaunchConflict, even if the SDK reports it as a 4xx.
+Terminate performs a fresh exact lookup and compares all four tags with want before sending one ID; missing tags are a mismatch, never a wildcard.
+IAM in Task 5 prevents this role from retagging existing instances; do not claim this eliminates out-of-band administrator races.
+
+- [ ] **Step 5: Bound console output and keep diagnostics private.**
+
+Describe the exact instance first and require the configured deployment tag before GetConsoleOutput.
+Limit the encoded input to 128 KiB and decoded input to 64 KiB; malformed encoding returns a safe error.
+Recognize only full lines `CARLOS_BOOT:<code>` where code is one of `seed_verified`, `enrol_pending`, `enrol_failed`, `stable_verified`, `joining`, `bootstrap_failed`.
+Return at most 32 recognized codes, joined by newlines; unknown lines and arbitrary suffixes are dropped.
+No member/API call site is added; 2b-2 will persist approved diagnostic projections with its breadcrumb producer.
+
+- [ ] **Step 6: Repeat Step 2 to PASS and commit.**
+
+Use fake SDK clients and one mock transport serialization witness; no environment credentials or endpoint can reach AWS.
+Commit subject: `feat: add managed fleet AWS compute adapter`.
+
+### Task 4: Provision fleet buckets, bounded IAM users and rotating keys
+
+**Files:**
+- Create: `internal/awsmanaged/{storage,credentials,policy}.go` and corresponding `_test.go` files.
+- Extend: `internal/awsmanaged/clients.go` with S3/IAM client seams.
+- Create: `internal/awsmanaged/testdata/fleet-data-policy.json` as an independently reviewed expected policy fixture.
+- No changes to `internal/objstore` policies or provisioning contracts.
+
+**Interfaces:**
+- Existing `fleetstore.Credentials { ID string; Secret []byte }`, JSON `id`/`secret`, and `FleetStorage { Bucket, Region string }` (`fleetstore/provisioner.go:5`).
+- Implements existing `EnsureFleetStorage(ctx context.Context, fleet, region string) (fleetstore.FleetStorage, error)`, `FleetCredentials(ctx context.Context, fleet string) (fleetstore.Credentials, error)`, `RotateFleetCredentials(ctx context.Context, fleet, keep string) (fleetstore.Credentials, error)`.
+- New `type StorageConfig struct { Deployment, AccountID, IAMRegion, BucketPrefix, UserPath, BoundaryARN string; Regions []string }` and `type Storage struct`.
+- New `NewStorage(ctx context.Context, cfg StorageConfig) (*Storage, error)` and unexported `newStorage(cfg StorageConfig, buckets map[string]s3API, users iamAPI) (*Storage, error)`.
+- New `NewStorageWith(ctx context.Context, cfg StorageConfig, transport HTTPClient) (*Storage, error)` applies the injected transport to both S3 and IAM through rootaws; no unmocked secondary client.
+- New `fleetResourceNames(cfg StorageConfig, fleet string) (bucket, user string, err error)`; deterministic deployment+fleet names.
+- New `fleetDataPolicy(bucketARN string) (string, error)`; JSON document for one bucket only.
+- New `(*Storage).verifyFleetUser(ctx context.Context, fleet string) (string, error)` returns verified IAM user name, never a key.
+- s3API/iamAPI use pinned SDK method signatures, as in Task 3; their complete operation lists are specified below.
+
+**Census/review:** Production storage, IAM, credentials and policy need independent security review. The boundary grants and actual data consumers are reviewed together with Task 5; no live isolation claim comes from these mocks.
+
+- [ ] **Step 1: Write failing bucket, policy and credential tests.**
+
+```text
+TestAWSFleetBucketContract: deterministic name, versioning Enabled, AES256, four public blocks;
+ lifecycle NoncurrentDays=7, AbortIncompleteMultipartUpload.DaysAfterInitiation=7;
+ no current expiration; region mismatch/foreign owner/mismatched tags => no mutation;
+ us-east-1 omits LocationConstraint; other regions set it; same-fleet retry converges.
+TestAWSFleetBucketPartialFailure: fail after each creation/configuration/readback call;
+ retry verifies ownership before repair; untagged pre-existing bucket fails closed;
+ failed readback cannot return prepared storage or mint credentials.
+TestAWSFleetExistingUserDrift: existing name with wrong ARN/account/path/boundary,
+ extra inline policy/managed attachment/group membership => refuse without key mutation;
+ missing desired inline policy may be installed only after identity/boundary validation;
+ unknown/list-page errors => refusal, not an empty policy/key inventory.
+TestAWSFleetCredentialsDoubleLostRotation: delivered K1; mint K2 but lose secret/seal;
+ next rotation keeps K1, reaps K2, mints K3; lose again then keep K1 and reap K3;
+ <=2 keys after each mint, K1 never deleted; KEEP on page 2 survives; missing keep => no deletion/mint.
+TestAWSFleetKeyFailures: failed deletion => no mint; lost mint response => later list/reap;
+ inactive kept key => refuse; same-fleet concurrent rotations serialized; other fleet untouched;
+ FleetCredentials never returns secret; no sealed key recovery by an AWS Get operation.
+TestAWSFleetDataPolicyIsolation: own lease/replica/files/restore requests allowed;
+ sibling bucket and deployment bucket denied for read/write/list/version/copy source;
+ own private-key Get/Put allowed, delete/version-delete denied; IAM/EC2/bucket-admin denied;
+ list/version operations use bucket ARNs, object actions use exact allowed object ARNs.
+```
+
+- [ ] **Step 2: Run `GOFLAGS=-buildvcs=false go test ./internal/awsmanaged -run 'TestAWSFleet' -count=1`; expect FAIL.**
+
+- [ ] **Step 3: Establish deterministic resources and convergent bucket settings.**
+
+Hash `Deployment + "/" + fleet` with SHA-256, use the first 24 lowercase hex characters as the resource suffix.
+Bucket is BucketPrefix+suffix; IAM user is `managed-fleet-`+suffix under the exact configured UserPath.
+Require a safe nonempty deployment, valid fleet name, 12-digit account, valid bounded bucket name and non-root IAM path.
+Refuse prefixes matching configured protected deployment/data buckets in the module and disallow overlaps with the app-store namespace.
+On CreateBucket success, stamp `carlos:deployment` and `carlos:fleet`; subsequent retries require exact tags and expected account/region before any configuration writes.
+Use ExpectedBucketOwner on supported calls; BucketAlreadyExists, access denied and unowned collisions are refusal, never adoption.
+BucketAlreadyOwnedByYou alone is insufficient: inspect region and tags. A crash before initial tagging leaves an explicit operator-reconciliation case; never relabel an unknown bucket.
+Configure versioning, AES256 encryption, public blocking and the two seven-day rules, then read back each before returning FleetStorage.
+EnsureFleetStorage returns success only after Step 4's user and inline policy checks also succeed; a bucket alone is not prepared fleet storage.
+Missing/incorrect settings on a verified owned bucket may be repaired; unknown lifecycle rules or foreign tags cause refusal rather than destructive replacement.
+Never disable versioning, expire current objects, empty/delete a bucket or grant bucket-policy administration in this slice.
+S3 operations: CreateBucket, GetBucketLocation, Get/PutBucketTagging, Get/PutBucketVersioning, Get/PutBucketEncryption, Get/PutPublicAccessBlock, Get/PutBucketLifecycleConfiguration.
+Only preparation invokes these operations; FleetCredentials and enrolment do not reconfigure S3.
+
+- [ ] **Step 4: Verify IAM identity and install a separate fleet-data policy.**
+
+CreateUser includes the exact BoundaryARN and UserPath; an empty boundary refuses construction.
+On EntityAlreadyExists, GetUser must match account, deterministic name, full ARN/path and boundary exactly.
+Recheck those properties before key operations too; no Put/DeleteUserPermissionsBoundary or automatic boundary repair.
+List all inline policies, attached policies and groups; reject unexpected authority. Read and compare the URL-decoded `carlos-fleet-data` inline policy structurally.
+Install a missing desired policy only on an otherwise valid user; refuse an existing different document instead of silently adopting drift.
+Read back the desired policy before returning success; IAM eventual consistency is retryable and never permission to mint first.
+IAM operations: CreateUser, GetUser, PutUserPolicy, GetUserPolicy, ListUserPolicies, ListAttachedUserPolicies, ListGroupsForUser, ListAccessKeys, DeleteAccessKey, CreateAccessKey.
+Do not wrap objstore.EnsureUser: it hardwires an app-store policy and accepts existing users without this boundary verification.
+
+The fleet-data policy has the following action/resource contract:
+
+| Consumer | Actions | Resource scope |
+|---|---|---|
+| Bucket region / data discovery | GetBucketLocation; ListBucket, ListBucketVersions | Exact bucket; list prefixes restricted to the data/probe/key paths below |
+| Lease, replica and files | GetObject, PutObject, DeleteObject | `instances/*` in the exact bucket |
+| Restore and move staging | GetObject, PutObject, DeleteObject, GetObjectVersion | `instances/*`, `moves/*`, `move-snapshots/*` in the exact bucket |
+| Multipart data uploads | AbortMultipartUpload, ListMultipartUploadParts | Same data object prefixes; ListBucketMultipartUploads only on the exact bucket |
+| First-box key and later recovery | GetObject, PutObject | Exact `system/fleet-secrets-key.json`; writer/format deferred to 2b-2 |
+| Storage challenge | GetObject, PutObject, DeleteObject | `_carlos/probes/*`; challenge implementation deferred to 2b-2 |
+
+Use the `s3:` prefix for these actions. There is no DeleteObjectVersion grant: claim-free lease release deletes a bare lock key; destructive versioned claim paths remain refused.
+Read-version/list-version grants cover versioned restore; any later need for permanent version deletion must identify its production consumer and receive a separate policy review.
+No wildcard action Allow, object tagging, bucket administration, IAM, EC2, deployment-bucket or other-fleet resource enters the document.
+Add an explicit `s3:*` Deny with NotResource equal to this bucket and its objects, so another resource-policy Allow cannot grant cross-bucket access.
+Fixture requests include cross-bucket CopyObject sources as well as destinations; a valid destination does not authorize reading a foreign source.
+Inspect `internal/lease/{lease,endpoint,versioned}.go` consumers; VersionedStore's existence alone does not justify granting every method's destructive permission.
+
+- [ ] **Step 5: Implement rotation that preserves the delivered key.**
+
+Credentials.ID is the AWS access-key ID; Secret is the UTF-8 secret-access-key bytes, with JSON base64 supplied by the existing []byte encoding.
+Bucket/region remain FleetStorage metadata; do not hide JSON credentials or bucket selectors inside Secret.
+FleetCredentials lists fully and returns the newest active ID (CreateDate then ID tie-break), with empty Secret; it is advisory and never selects keep for rotation.
+Under an adapter fleet mutex, verify the user, list every key page, and confirm a nonempty keep exists and is active before deleting anything.
+Reap every ID except keep, confirm deletions with a complete list, then mint exactly one key; stop on ambiguity at any step.
+With empty keep, all existing keys are undelivered orphans by the core contract; reap them before the first usable mint.
+Use MaxAttempts=1 on CreateAccessKey; a lost response is recovered by listing and reaping the orphan on the next explicit rotation.
+Return the new secret only from that mint; never persist it in the adapter or put it in errors/logs.
+The console still seals before delivery and persists delivered_key_id before replying; losing a seal never changes the keep argument.
+Two serving consoles with different databases remain unsupported; an in-process mutex is not presented as distributed rotation exclusion.
+
+- [ ] **Step 6: Repeat Step 2 to PASS and commit.**
+
+Also run existing `TestFleetCredentialsDoubleLostRotation` and `TestManagedFleetCredentialsLostSealWrite` by name once.
+Commit subject: `feat: provision managed fleet buckets and bounded credentials`.
+
+### Task 5: Add opt-in console IAM with rendered policy witnesses
+
+**Files:**
+- Create: `infra/modules/region-host/managed_fleets.tf`, `tests/managed_fleets.tftest.hcl`.
+- Modify: `infra/modules/region-host/{main,variables,outputs}.tf`.
+- Create: `internal/awsmanaged/infra_policy_test.go`, `testdata/managed-console-policy.json`, `testdata/managed-boundary-policy.json`.
+- Test the existing store boundary/app policy without changing `internal/objstore` policy generation.
+
+**Interfaces:**
+- New `managed_fleets_enabled` bool default false; `managed_fleets_deployment` string default empty.
+- New `managed_fleets_regions` map(object({ image=string, subnets=set(string), security_groups=set(string), instance_types=set(string) })) default empty.
+- New `managed_fleet_bucket_prefix` string default empty and `managed_fleet_user_path` string default `/carlos-managed-fleet/`.
+- New `aws_iam_role_policy.host_managed_fleets`, attached only to existing aws_iam_role.host when enabled.
+- Reuse the existing `aws_iam_policy.store_user_boundary` ARN/mechanism; create it when app storage OR managed provisioning needs it.
+- Add opt-in fleet-prefix statements to that boundary without altering its existing app-store statements; no new per-fleet role/profile.
+- New outputs `managed_fleet_user_boundary_arn`, `managed_fleet_user_path`, `managed_fleet_bucket_prefix`; null while off.
+- New test helper `effectiveFleetAccess(inline, boundary []byte, action, resource string, context map[string][]string) (bool, error)` in `_test.go` only.
+
+**Census/review:** Every non-Markdown infra file is root census scope. IAM grants require independent security review of the complete policy union; rendered fixtures are evidence of intent, not an AWS live-policy verdict.
+
+- [ ] **Step 1: Write failing offline module/policy assertions.**
+
+```text
+off_by_default: zero host_managed_fleets resources; existing store policy/boundary unchanged;
+ store disabled + managed disabled => no new boundary; outputs null.
+enabled_shape: one host policy, existing boundary mechanism, approved concrete region/image/subnet/SG/type;
+ RunInstances requires deployment/fleet/label/operation tags; CreateTags only at RunInstances;
+ Terminate/GetConsoleOutput require deployment resource tag; no CreateRole/PassRole/profile/SSM.
+existing_user_boundary: CreateUser and PutUserPolicy require exact iam:PermissionsBoundary;
+ IAM resource is account + managed path; no boundary editing/AttachUserPolicy/UpdateUser.
+bad_config: empty/wildcard identity/network, root or overlapping IAM path, region mismatch,
+ protected or overlapping bucket prefixes => plan failure before resources.
+TestManagedFleetRenderedPolicyIsolation: exact inline AND rendered boundary allows own data;
+ foreign fleet/deployment bucket, foreign account/path, wrong/missing boundary denied;
+ app-store credential with unchanged app inline gains no fleet or version capability;
+ deliberately broadened sibling Allow cannot override inline cross-bucket explicit Deny.
+```
+
+- [ ] **Step 2: Run local failing checks against mocked fixtures.**
+
+Use `tofu -chdir=infra/modules/region-host validate` and `tofu -chdir=infra/modules/region-host test -filter=tests/managed_fleets.tftest.hcl`.
+The test uses mock_provider aws and `command = plan` in every run, with fixed caller identity, region, AMI and resource ARNs; no apply run or live data source.
+Use a backend-disabled scratch module copy if initialization is needed; provider cache stays on disk, credentials are dummy, metadata disabled.
+Run `GOFLAGS=-buildvcs=false go test ./internal/awsmanaged -run TestManagedFleetRenderedPolicyIsolation -count=1`; expect FAIL.
+
+- [ ] **Step 3: Render resource-specific EC2 permissions.**
+
+RunInstances statements separately cover configured image, subnet and SG ARNs and the necessary new instance, volume and network-interface resources in each allowed region/account.
+Image ARN uses the EC2 image ARN form; never substitute an account-owned instance ARN shape for a public AMI.
+Require the deployment request tag and nonempty fleet/label/operation tags on created instances/volumes; restrict tag keys to the four identity keys.
+Constrain instance type, IMDSv2/hop limit and absent instance profile in the statement for the resource types supporting those keys.
+CreateTags permits only launch-time tags with `ec2:CreateAction=RunInstances`; do not grant DeleteTags or post-launch retagging.
+TerminateInstances and GetConsoleOutput use exact configured deployment resource-tag conditions and configured-region resources.
+DescribeInstances/DescribeImages use Resource `*` where required, restricted to configured requested regions in this new grant.
+The existing host inventory policy already grants broad DescribeInstances: report that effective read scope honestly; adding a narrow Allow does not reduce it.
+Do not add compute permissions to group runtime roles or create an SG, subnet, VPC, instance profile or SSM access path.
+Validate action/resource/condition compatibility against the primary EC2 reference, and make fixtures fail when a condition is placed on the wrong resource type.
+AWS reference: [https://docs.aws.amazon.com/service-authorization/latest/reference/list_ec2.html](https://docs.aws.amazon.com/service-authorization/latest/reference/list_ec2.html).
+
+- [ ] **Step 4: Render bounded IAM/S3 grants and boundary intersection.**
+
+Grant Task 4's exact IAM operations only under the configured account's managed-fleet user path.
+Keep CreateUser and PutUserPolicy conditioned on the existing exact boundary ARN; scoped DeleteUser/DeleteUserPolicy are allowed for the later approved cleanup path, without adding a runtime deletion method now.
+No CreateRole, PassRole, AttachUserPolicy, group mutation, login profile, boundary mutation or IAM policy-version edit grant.
+Read-only policy/group membership APIs are necessary to reject existing-resource drift and stay on the same user resource scope.
+Scope CreateBucket/configure/readback actions to the exact managed prefix; use the IAM action names corresponding to the SDK operations, including s3:PutLifecycleConfiguration.
+The exact S3 grant is CreateBucket, GetBucketLocation, Get/PutBucketTagging, Get/PutBucketVersioning, Get/PutEncryptionConfiguration, Get/PutBucketPublicAccessBlock and Get/PutLifecycleConfiguration, all prefixed `s3:`.
+Protect deployment/data buckets with explicit Denies on the new bucket creation/configuration actions, even if an operator chooses an overlapping prefix.
+Do not add a console-role DeleteObject Deny on deployment/data buckets: existing lease release depends on it.
+Add only Task 4's fleet-data actions to the existing boundary under the distinct managed prefix; retain app-store effective access unchanged.
+Require disjoint app/managed IAM paths and bucket prefixes when both features are enabled; no wildcard or empty prefix accepted.
+The boundary limits delegated authority; each user's exact inline policy narrows it to that fleet and explicitly denies cross-bucket access.
+AWS boundary reference: [https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html).
+
+- [ ] **Step 5: Pin the actual rendered documents and denied cases.**
+
+The HCL tests compare jsondecode of actual resource.policy values with the checked-in JSON fixtures for fixed mock inputs.
+Task 4's Go renderer likewise compares with fleet-data-policy.json; testing a hand-copied policy alone is insufficient.
+The test-only evaluator implements only the operators present in these fixtures and errors on every unsupported construct; it is not a general IAM simulator.
+Evaluate explicit Deny before Allow, then intersect boundary and inline; enumerate bucket and object ARNs separately and both CopyObject permissions.
+Assert the complete host policy union contains no new write bypass through an older wildcard grant; distinguish pre-existing inventory reads from new mutation authority.
+Mark variable descriptions, errors and output descriptions COPY for the controller's review.
+Shipping later requires a platform release tag and deployment repository ref bump, followed by an inspected plan and Paul's scoped apply approval.
+
+- [ ] **Step 6: Repeat Step 2 to PASS, check formatting and commit.**
+
+Run `tofu fmt -check` on the touched module files. Never run apply or cloud-backed IAM simulation.
+Commit subject: `feat: scope opt-in console IAM for managed fleets`.
+
+### Task 6: Reserve ready-object writes for the console
+
+**Files:**
+- Modify: `internal/edge/storedoor.go`; extend `internal/edge/storedoor_test.go`.
+- No host/agent changes; this is the console publication authority boundary on the existing HTTP store door.
+
+**Interfaces:**
+- Existing `aclWrite(sqid, fleet, key string) bool` (`storedoor.go:792`) gates both PUT and DELETE.
+- Existing `aclRead(sqid, fleet, key string) bool` (`storedoor.go:678`) retains its own-fleet read grant.
+- New unexported `managedReadyObjectKey(fleet, key string) bool`; exact canonical shape only, no registry reads.
+
+**Census/review:** Edge code is root-binary scope. This is a security denial change requiring root-read and applicable authority census approval.
+
+- [ ] **Step 1: Write the failing ACL and wire tests.**
+
+```text
+TestStoreDoorManagedReadyACL: own/sibling label ready.json PUT/DELETE => false;
+ own/sibling GET => true; foreign fleet read/write => false; empty fleet => no writes;
+ own heartbeat/binding writes remain true; near-name ready.jsonx is not the authority key.
+TestStoreDoorManagedReadyWire: authenticated PUT and DELETE to own/sibling ready keys
+ return standard denial and perform zero backend mutation; GET retains exact object;
+ percent-encoded separators/dots, duplicate slashes, traversal and alternate method paths
+ cannot reach a backend ready-object write after canonicalization;
+ normal status/binding round trips pass; foreign/invalid refusal remains byte-identical.
+TestStoreDoorManagedReadyConsole: direct trusted console release.Store create-only publication
+ still succeeds; the box reads it but cannot forge, replace or delete it.
+```
+
+- [ ] **Step 2: Run `GOFLAGS=-buildvcs=false go test ./internal/edge -run 'TestStoreDoorManagedReady' -count=1`; expect FAIL.**
+
+- [ ] **Step 3: Deny the exact object before the own-fleet prefix Allow.**
+
+Match exactly five canonical segments: `fleets`, authenticated fleet, `boxes`, nonempty label, `ready.json`.
+Deny every label, including siblings; aclWrite has no authenticated-label argument and needs none for this restriction.
+Keep the existing canonicalizer and reject malformed paths through it; do not add a second parser with different normalization rules.
+Do not blanket-deny the boxes subtree or remove GET, heartbeat, binding, bootstrap or signed pointer access.
+Console writes use its direct release store; do not add an HTTP bypass token or a box-writable assertion of readiness.
+Task 4's fleet credential cannot reach the deployment bucket directly, closing the separate IAM route to the same object.
+
+- [ ] **Step 4: Repeat Step 2 to PASS and run adjacent ACL witnesses once.**
+
+Select `TestStoreDoorACLMatrix`, `TestStoreDoorCASRoundTrip`, `TestStoreDoorDeleteIsScopedAndIdempotent`, `TestStoreDoorRefusalsAreByteIdentical`.
+Do not run the full edge suite between tasks.
+
+- [ ] **Step 5: Commit with subject `fix: deny fleet-box writes to readiness authority`.**
+
+### Task 7: Prove the slice and prepare the reviewed branch for landing
+
+**Files:**
+- Create: `internal/awsmanaged/integration_test.go` (external package `awsmanaged_test`).
+- Extend: `internal/console/{managedbudget,managed_e2e,managedrecovery}_test.go` using only provider-neutral interfaces.
+- Implementation artifacts only: census proposal/claims, review brief from `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`, follow-up list and COPY inventory.
+- No production assignment to Config.ManagedCompute/ManagedStorage and no enabled configuration change.
+
+**Interfaces:**
+- Consume Tasks 3–4 public With constructors with a mock HTTP transport and explicit dummy credentials; all network destinations, including IAM, are intercepted.
+- Consume real console HTTP handlers, SQLite persistence and RunManagedFleetsPass in existing console tests with fakes.
+- Keep AWS adapter imports out of managed*.go, including tests; adapter/worker composition uses exported compute/fleetstore contracts.
+- Retain the existing TestManagedCoreImports direct-import boundary and compile-time Provisioner implementation assertions.
+
+**Census/review:** Consolidate one branch proposal over actual root dependencies/infra bytes and all changed authority/write entries. The controller obtains the independent opposite-family verdict for every unit/envelope and records it on #280 at the reviewed tip.
+
+- [ ] **Step 1: Write the missing composition and budget assertions.**
+
+```text
+TestAWSManagedAdapterRecovery: real constructors + mocked SDK transport;
+ lost RunInstances reply -> complete discovery -> same physical ID; frozen request unchanged;
+ bucket prepare/credential rotation survive adapter reconstruction; no recoverable secret API.
+TestManaged2B1RecoveryMatrix: real console DB reopen after ambiguous launch/termination/publication;
+ no duplicate batch, no premature quota release; matching publication wins over stale checks;
+ cap/replay and prepared error clearing observable through existing API show.
+TestManaged2B1Budget: 1/10/100 ready boxes, 100 idle passes => SQL/store/provider calls=0;
+ 100 open follow polls => store/provider=0; enrolled checks <=1 heartbeat/box/60s;
+ delayed publication counts separately; no ListDeployment or ConsoleOutput background polling.
+TestManaged2B1Disabled: no real providers in production Config; off/nil refuses new reservations;
+ existing frozen operations remain recoverable through injected fakes; HostClaim refuses;
+ BYO read/create behavior and unrelated app-store effective policy unchanged.
+TestAWSManagedSecretSurfaces: key/token/private-key sentinels absent from errors, diagnostics,
+ launch request logs, persisted progress and show; enrolled credential JSON remains id/secret.
+```
+
+- [ ] **Step 2: Run `GOFLAGS=-buildvcs=false go test ./internal/awsmanaged ./internal/console ./internal/compute -run 'TestAWSManaged|TestManaged2B1|TestManagedCoreImports' -count=1`; expect FAIL for the uncovered composition assertions.**
+
+- [ ] **Step 3: Close only integration gaps within the owning tasks, then repeat Step 2 to PASS.**
+
+The adapter tests establish SDK request/classification behavior; the console tests establish durable lifecycle behavior.
+Report this composed proof accurately: it is not a real box, real IAM enforcement or public-serving acceptance.
+Use at most ~10 mutation checks per risky task, selected from identity omission, partial-page acceptance, keep deletion, stale publication and ready ACL bypass.
+No mutation tests for descriptions, struct mirrors or ordinary rendering.
+Do not upgrade dependencies, wire production, fix accepted unrelated minors or start a new review family to fill the final gate.
+
+- [ ] **Step 4: Run one final targeted race/build/format gate.**
+
+Run `GOFLAGS=-buildvcs=false go test -race ./internal/awsmanaged ./internal/compute ./internal/fleetstore ./internal/console ./internal/registry ./internal/edge -run 'TestAWS|TestManaged|TestFleetContext|TestFleetCredentialsDoubleLostRotation|TestFleetStorageFake|TestFake|TestStoreDoorManagedReady' -count=1` once after integration.
+Run `GOFLAGS=-buildvcs=false go build -o <owned-disk-scratch>/console ./cmd/console`; run targeted go vet for touched packages.
+Check gofmt over touched Go files and repeat Terraform validation only if later changes affected it.
+Full build/test/vet/format and darwin/windows/linux-arm64 gates are required on amadan CI before landing; never run the whole internal/console package locally.
+Stop and report actual failures; do not call a known failing gate green or repeat a full suite to chase timing.
+
+- [ ] **Step 5: Complete census, review and copy gates within the existing budget.**
+
+Run `make census-card`, write per-unit CLAIMS in owned disk scratch, then `make census-propose NAME=managed-fleets-2b1 CLAIMS=<owned-file>`.
+Include registry context methods, edge ACL, actual dependency envelopes, infra permissions and console authority/write inventory changes.
+Use the template's READY / READY AFTER FIXES / NOT READY verdicts; carry inherited rounds and fault families explicitly.
+Review the P2-produced diff's census and any new security/root/termination/storage behavior without restarting the round count.
+The controller finishes COPY review and applies approved strings verbatim before final tip review/CI; re-propose census if bytes in scope changed.
+Commit subject: `test: prove managed fleet AWS recovery and isolation contracts`.
+
+- [ ] **Step 6: Report to the controller; land once, only after Paul's go.**
+
+Implementers hand over local evidence, limitations, COPY inventory, census proposal and outstanding follow-ups; no push or merge from a task agent.
+Controller pushes managed-fleets-2b1 to the amadan.net remote and describes the concrete change, tests and reviews with `amadan branch describe carlos/platform managed-fleets-2b1 -body -`.
+Require green `amadan ci status carlos/platform -branch managed-fleets-2b1` at the exact full tip, required independent review and Paul's explicit go.
+Then use `amadan branch merge carlos/platform managed-fleets-2b1 -squash -expect <full-tip> -message <subject-and-body>`.
+Validate subject length <80 and real blank-line body separation before the merge; read main's CI after it.
+Update the GitHub mirror only from landed amadan main if needed; remove owned scratch/processes.
+Finish line: one merged console-side slice, production still off, no live resources changed, 2b-2 handoff explicit.
+
+## Self-review
+
+| Spec / binding decision / inherited finding | Coverage and limit |
+|---|---|
+| Decisions split: recon tasks 1–5 only | Tasks 1–6 implement them; Task 7 verifies/lands the slice |
+| N1 and new-ID 429 test gap | Task 1 cap=64, durable replay and fresh-operation throttle witnesses |
+| N3 clear-on-prepared | Task 1 conditional clearing; unrelated errors preserved |
+| T4 M3 sole SQL connection held during registry calls | Task 1 bounded context snapshot before BEGIN IMMEDIATE |
+| T7 M4 retryable enrolment | Task 1 preclaim 503/5, terminal postclaim/403; client deferred |
+| T6 M1 rejection after ambiguous launch | Task 2 firstDispatch proof plus ErrLaunchConflict; quota held on recovery |
+| T6 M2 provider calls under fleet lock | Task 2 intent/observe/CAS with network outside fleet lock |
+| T6 M4 deadline hidden behind hourly schedule | Task 2 deadline before applicable backoff |
+| N4 delayed absent publication | Task 2 six fresh checks at >=60s; original ReadyAt preserved |
+| C08 consumed/uncertain publication safety | Tasks 2/7; matching object wins, mismatch/error never terminates |
+| §4 durable identity/idempotency/partial failure; §8.3 | Existing core plus Tasks 2/3/7 restart and ambiguity composition |
+| §4 provisioning exact-tag termination; decision 5 | Task 3 exact-ID lookup, four-field compare; no wildcard identity |
+| Decision 4 exact-ID absence after attempt | Tasks 2/3 distinguish AWS NotFound from worker authority to release quota |
+| §5 provider-neutral core and rootaws | Tasks 3/4 adapters, Task 7 import/constructor witnesses |
+| Decision 1 no profile/SSM, dedicated egress-only SG | Task 3 request and Task 5 grants; real network verification 2b-2 |
+| Decision 2 versioning/SSE/public blocking/7-day rules | Task 4 bucket contract/readback; no 30-day deletion job |
+| Addendum P1 per-fleet IAM user, boundary, enrol-only delivery | Tasks 4/5; existing console seal/delivered-ID mechanism retained |
+| Existing-resource IAM/boundary drift | Tasks 4/5 user/path/account/boundary/policy checks and denied fixture |
+| Addendum P2 fleet-private key in own bucket | Task 4 exact reserved policy path; mint/write/public registration 2b-2 |
+| §8.4 sibling/deployment credential isolation | Tasks 4/5 offline effective-policy/copy/version cases; live proof 2b-2 |
+| ready.json console-only authority | Task 6 PUT/DELETE denial plus Task 4 direct-S3 isolation |
+| Decision 6 console authority opt-in/default off | Task 5 region/image/subnet/SG/tag/path/prefix scopes; no role creation |
+| Existing broad inventory Allow | Task 5 reports actual union; no false claim of narrower effective Describe |
+| Decision 7 HOST_CLAIM remains unsupported | Tasks 1/7 refusal regression; no gated SQL escape |
+| §6 idle/open/steady request budgets | Tasks 2/7 exact counters; no orphan/list/console-output timer |
+| §8.5 secret surfaces | Tasks 3/4/7 bounded diagnostic codes, sealed delivery, no raw provider text |
+| §8.8 documentation and copy | No new CLI verb; new errors/descriptions COPY; existing docs must not imply switch-on |
+| §8.1–2 real boxes/apps/custom domain | 2b-2 first-box drill, 2c complete many-box acceptance |
+| §8.6 reboot/removal/survivors/retention | Existing 1c; box proof 2b-2, many boxes/removal 2c/2d |
+| §8.7 billing | Phase 3, no billing change here |
+| Decision 8 / stopping rules | Controller implementation reviews only; inherited history and <=3 rounds carried |
+
+Dependency check: Tasks 1–2 stabilize the core before adapters are composed with it.
+Task 4 defines the data-policy action set; Task 5 renders its delegated ceiling and checks the intersection.
+Task 6 closes the HTTP route to readiness authority; Task 7 checks it alongside the independent direct-S3 policy route.
+All five Review Focus items have named owning tests, and every proposed helper has an owning task and signature.
+Existing interfaces were checked at 9622c65a; the earlier 2a omission of Lookup is not carried forward.
+Test blocks specify observable assertions, not implementation bodies. No proposed test was run while drafting.
+Plan-only self-review is complete; it is not an independent risk/census review or permission to switch on.
+
+## Deferred to 2b-2
+
+- Frozen executable cloud-init and first-contact client: trusted seed, current signed stable binary, digest-before-exec, parameter allowlists, IMDS gate and cloud-init secret scrubbing.
+- Genuine empty-data inspection before framework initialization; enrol reply's additive bucket/region/op/trust fields and 503/429 retry contract within the original expiry.
+- Durable managed joining state before every reconcile/start/wake path, including unlabelled/static/sidecar/root execution; bootstrap/status/probes remain available.
+- ready.json reads only while joining, on serial change or the 60-second missed-wakeup backstop; strict fleet/label/op validation, durable clearance, zero reads after admission.
+- First-box fleet secrets-key mint, narrow initial-registration authority through the existing public-key path, create-only private object at `system/fleet-secrets-key.json`, replay/fingerprint/conflict checks.
+- This box's write/read challenge using delivered fleet credentials and authenticated router round trip to the exact channel, with independent readiness results.
+- Production provider construction/wiring, frozen bootstrap inputs, approved useful diagnostic copy and integrated one-box acceptance; retain unsupported HOST_CLAIM refusal.
+- Concrete dev drill card: current account/region/image/subnet/dedicated SG, exact IAM/S3/EC2 changes, cost cap, TTL, traffic effects, cleanup and verification, then Paul's scoped approval.
+- Verify egress under the approved network policy, including image/package/time/DNS dependencies; do not silently add inbound rules, SSM, profiles or broader outbound access.
+- Release/tag and deployment module ref bump; inspected local plan followed by separately approved apply. Run the first real box, cross-bucket denial and serving proof only inside that approval.
+- Subsequent phases stay separate: 2c later-box key consumption/many-box acceptance; 2d removal, 30-day retention/revival and hourly regional orphan sweep; phase 3 billing and VPC peering.
+- Carry N2 and the other accepted 2a minors as follow-ups, together with the closed review history; neither this file nor the 2b split restarts that history.