plan: console Protection tab rev 4 (Astra R3: fleet reads scoped by owner before I/O; owner-change tests isolate the account)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+67
−18
docs/superpowers/plans/2026-10-30-console-protection-tab.md+26 −18docs/superpowers/plans/CODEX-FINDINGS-CONSOLE-PROTECTION-TAB-PLAN-R3.md+41 −0
CI passed — run details
diff --git a/docs/superpowers/plans/2026-10-30-console-protection-tab.md b/docs/superpowers/plans/2026-10-30-console-protection-tab.md| index 728f56fa9..ef3b1d43b 100644 |
| --- a/docs/superpowers/plans/2026-10-30-console-protection-tab.md |
| +++ b/docs/superpowers/plans/2026-10-30-console-protection-tab.md |
| @@ -10,7 +10,7 @@ |
| **Spec:** `docs/superpowers/specs/2026-10-30-console-protection-tab-design.md` (rev 2, approved by Paul 2026-10-30). Read it first; this plan argues from it. |
| -**Review history:** plan rev 1 Astra R1 NOT READY (4 P1, 2 P2: tier key conversion, owner-change reconciliation, counting-start tied to the window, group-cap off by one, size gate, Logs link population). Rev 2 fixes all six; findings at `docs/superpowers/plans/CODEX-FINDINGS-CONSOLE-PROTECTION-TAB-PLAN-R1.md`. Plan rev 2 Astra R2 NOT READY: coverage ("counting since", partial days) failed a second round, so under stopping rule 2 Paul chose on 2026-10-30 to **cut the coverage claim**; also the far asset path's checks (P1), the logs filter placement (P2) and the logs link's start time (P2), all fixed in rev 3. Findings at `CODEX-FINDINGS-CONSOLE-PROTECTION-TAB-PLAN-R2.md`. One round remains. Plan's call, refining spec §3.1 to meet its own ownership rule: the hourly protection counters live on the host-owner record beside the group tally, not on `usage.EdgeRow`, so an owner change mid-hour erases nothing and each owner's group total always equals their caught total. Paul's ruling (R2): no coverage claim at all. The page's only evidence is the app's own checked count: zero checked reads "No protection counts yet", never "nothing caught". No "counting since", no partial days, no stored modes. |
| +**Review history:** plan rev 1 Astra R1 NOT READY (4 P1, 2 P2: tier key conversion, owner-change reconciliation, counting-start tied to the window, group-cap off by one, size gate, Logs link population). Rev 2 fixes all six; findings at `docs/superpowers/plans/CODEX-FINDINGS-CONSOLE-PROTECTION-TAB-PLAN-R1.md`. Plan rev 2 Astra R2 NOT READY: coverage ("counting since", partial days) failed a second round, so under stopping rule 2 Paul chose on 2026-10-30 to **cut the coverage claim**; also the far asset path's checks (P1), the logs filter placement (P2) and the logs link's start time (P2), all fixed in rev 3. Findings at `CODEX-FINDINGS-CONSOLE-PROTECTION-TAB-PLAN-R2.md`. Plan rev 3 Astra R3 (the last round) NOT READY: 1 P1 (a foreign fleet's malformed day could fail other accounts' reads: the reader now scopes fleets by owner before any I/O) and 1 P2 (owner-change tests now keep host and app and change only the account, with valid account names), both fixed in rev 4. Findings at `CODEX-FINDINGS-CONSOLE-PROTECTION-TAB-PLAN-R3.md`. The review budget is spent; a fourth round only on Paul's go. Plan's call, refining spec §3.1 to meet its own ownership rule: the hourly protection counters live on the host-owner record beside the group tally, not on `usage.EdgeRow`, so an owner change mid-hour erases nothing and each owner's group total always equals their caught total. Paul's ruling (R2): no coverage claim at all. The page's only evidence is the app's own checked count: zero checked reads "No protection counts yet", never "nothing caught". No "counting since", no partial days, no stored modes. |
| ## Global Constraints |
| @@ -23,7 +23,8 @@ |
| - Windows are whole UTC days: 7 (default) or 30, including today (spec §3.2). |
| - No coverage claims (Paul, R2): nothing on the page or in the JSON says a window was fully counted, partly counted or when counting began. "Nothing caught" needs the app's checked count above zero. |
| - Counts follow records: every place that creates a guard state and may file its Match record also makes exactly one `RecordGuard` call, under the same "this box answered it" condition, whether or not a rule matched and whether or not records are on. |
| -- A fleet box's row counts only when its account is the fleet's owning account (`registry.Fleet.Account`). A fleet box writes what it likes under its own prefix; its rows may vouch only for its own account. |
| +- A fleet box's row counts only when its account is the fleet's owning account (`registry.Fleet.Account`). A fleet box writes what it likes under its own prefix (any bytes, unvalidated); its rows may vouch only for its own account, and an account-scoped read never lists or reads another account's fleet (R3 finding 1). |
| +- Test accounts are valid account names (3-16 lowercase letters, `launchctx/controlname`), e.g. `bab` and `bdk`; an owner-change fixture keeps host and app and changes only the account (R3 finding 2). |
| - Group tally: at most 32 keys per host-owner-day including `other`, so at most 31 named groups; a new group past that counts under `other`, an existing one keeps counting (spec §3.1). |
| - Copy: every user-facing string comes from the approved deck `docs/superpowers/plans/2026-10-30-console-protection-tab-copy.md`, verbatim. No em dashes. Never "exactly". No tenant names anywhere. |
| - Provider-neutral: only `release.Store`. |
| @@ -60,9 +61,9 @@ |
| - `func UpsertEdgeDay(ctx context.Context, s release.Store, box string, now time.Time, f EdgeFlush) error`: writes nothing when `len(f.Rows) == 0 && len(f.Guard) == 0`. |
| - `EdgeRow` and `SetOwner` are unchanged. |
| -- [ ] **Step 1: Write the failing tests** in `internal/usage/edge_test.go` (host `shop.example.com`, account `acct1`, app `shop` unless stated): |
| +- [ ] **Step 1: Write the failing tests** in `internal/usage/edge_test.go` (host `shop.example.com`, account `bab`, app `shop` unless stated): |
| - `TestAddFlushSumsGuardHours`: two flushes into hour `"09"`, each delta `Checked 10, Watch 2, Block 1, Groups {"probe/wordpress":2,"hard/secrets":1}`. Want `Guard[key].Hours["09"] == {20,4,2}` and `Groups {"probe/wordpress":4,"hard/secrets":2}`. |
| - - `TestGuardOwnerChangeMidHourKeepsBoth` (Review Focus 3): in hour `"09"`, a delta for `acct1/shop` with `Watch 3, Groups {"probe/wordpress":3}`, then a row whose `SetOwner` moves the host to `acct2/blog` and a delta for `acct2/blog` with `Watch 2, Groups {"probe/wordpress":2}`. Want two tallies: `acct1/shop` hour `"09"` watch 3 with groups summing to 3, `acct2/blog` watch 2 with groups summing to 2. |
| + - `TestGuardOwnerChangeMidHourKeepsBoth` (Review Focus 3): in hour `"09"`, a delta for `bab/shop` with `Watch 3, Groups {"probe/wordpress":3}`, then a row whose `SetOwner` moves the host to `bdk/shop` and a delta for `bdk/shop` with `Watch 2, Groups {"probe/wordpress":2}`. Want exactly the keys `GuardKey("shop.example.com","bab","shop")` and `GuardKey("shop.example.com","bdk","shop")`: `bab` hour `"09"` watch 3 with groups summing to 3, `bdk` watch 2 with groups summing to 2. |
| - `TestAddGroupCapsAtOther`: add 40 distinct groups `g00`..`g39` with 1 each, then `g00` again with 1. Want `len == 32`, 31 named keys, `other == 9`, `g00 == 2`, total 41. |
| - `TestUpsertEdgeDayEmptyFlushWritesNothing`: `EdgeFlush{}` against a store that fails the test on any `Put`. |
| - `TestEdgeDayOldShapeParses`: unmarshal a day JSON with no guard fields. Want nil `Guard`, rows intact. |
| @@ -104,7 +105,7 @@ git commit -m "usage: protection counters, group tally and modes on the edge day |
| - [ ] **Step 1: Write the failing tests** |
| - `internal/edge/usagemeter_test.go`, `TestRecordGuardCounts`: rules taken from the real catalogue (`edgeguard`), not built by hand: a watch on a `probe/wordpress` rule, a block on a `hard/secrets` rule, a check with no rule, and a match on a `probe/admin` (burst) rule. Want the delta `Checked 4, Watch 1, Block 1`, groups exactly `{"probe/wordpress":1,"hard/secrets":1}`. |
| - - `TestRecordGuardOwnerChangeWithinDrain` (Review Focus 3): one match for route `acct1/shop`, then the same host as `acct2/blog`, then a match for it, all before one `Drain`. Want two deltas, each with `Watch 1` and one group count. |
| + - `TestRecordGuardOwnerChangeWithinDrain` (Review Focus 3): one match for route `bab/shop`, then the same host as `bdk/shop`, then a match for it, all before one `Drain`. Want two deltas, each with `Watch 1` and one group count. |
| - `internal/edge/guard_usage_test.go`, through a real `Edge` serving the real catalogue (production wiring, as `guard_test.go` builds one), with a `UsageMeter` enabled: |
| - `TestGuardUsageCountsAProbe`: `GET /wp-login.php` on a routed host. Want delta `Checked 1, Watch 1`, groups `{"probe/wordpress":1}`. |
| - `TestGuardUsagePlainRequestCountsChecked`: `GET /`. Want `Checked 1`, no watch, no groups. |
| @@ -150,17 +151,22 @@ git commit -m "edge: count protection checks and matches into the usage meter" |
| - Consumes: Task 1's `usage.EdgeDay`. |
| - Produces: |
| - `type edgeDaySource struct { Day usage.EdgeDay; Fleet string; FleetAccount string }` (`Fleet == ""` for a root box). |
| - - `func (s *Server) readEdgeDays(ctx context.Context, st release.Store, dates []string) ([]edgeDaySource, error)`: lists root boxes (`usage.EdgeBoxesPrefix`) and, for every fleet from the registry (`ListFleets`, as `fleetMeterBoxes` opens it), the boxes under `fleets/<name>/usage/edge/`; reads each box's day for each date through `st`. A missing object is skipped; any other read or parse error fails the call. |
| + - `func (s *Server) readEdgeDays(ctx context.Context, st release.Store, dates []string, acct string) ([]edgeDaySource, []string, error)`: lists root boxes (`usage.EdgeBoxesPrefix`) and the boxes under `fleets/<name>/usage/edge/` for the fleets from the registry (`ListFleets`, as `fleetMeterBoxes` opens it), then reads each box's day for each date through `st`. A missing object is skipped. |
| + - `acct != ""` (an account's view): only fleets whose `Account` is `acct` are listed or read; every other fleet is dropped before any store call. Any read or parse error on a root box or on one of the account's own fleets fails the call. |
| + - `acct == ""` (the operator view): every fleet is read. A root box's error fails the call. A fleet's unreadable day does not: that fleet's sources are left out and its name is returned in the second result, so the page can say which fleets it could not read. |
| - `func rowCounts(src edgeDaySource, row usage.EdgeRow, acct, app string) bool`: true when the row is the app's (account defaulting to `release.OpsAccount` when empty, as `rateLimitCounts` does) and, for a fleet source, the row's account equals `FleetAccount`. |
| - `func tallyCounts(src edgeDaySource, t usage.GuardTally, acct, app string) bool`: the same rule for a guard tally. |
| - `usageDayDate` recognises `fleets/<fleet>/usage/edge/<box>/days/<date>.json`. |
| - - `rateLimitCounts` reads through `readEdgeDays` and `rowCounts`; its results for root boxes are unchanged. |
| - |
| -- [ ] **Step 1: Write the failing tests** in `internal/console/edgedays_test.go` against a memory store and a registry with fleet `f1` owned by `acct1`: |
| - - `TestReadEdgeDaysRootAndFleet`: one root box and one `f1` box each with a day for `2026-11-02`. Want two sources, the fleet one with `Fleet "f1"`, `FleetAccount "acct1"`. |
| - - `TestRowCountsRefusesForeignFleetRow` (Review Focus 2): a row and a guard tally in `f1`'s day claiming `acct2/shop`. Want `rowCounts(...) == false` and `tallyCounts(...) == false` for `acct2/shop`; the same claiming `acct1/shop` gives true. |
| - - `TestReadEdgeDaysParseErrorFails` (Review Focus 5): a root day holding `{not json`. Want an error, not a short result. |
| - - `TestRateLimitCountsIncludesFleetBoxes`: a fleet row for `acct1`'s host with `RateShed 4`. Want `Shed 4`. |
| + - `rateLimitCounts` reads through `readEdgeDays` with the instance's account, and `rowCounts`; its results for root boxes are unchanged. |
| + |
| +- [ ] **Step 1: Write the failing tests** in `internal/console/edgedays_test.go` against a memory store and a registry with fleet `f1` owned by `bab`: |
| + - `TestReadEdgeDaysRootAndFleet`: one root box and one `f1` box each with a day for `2026-11-02`. Want two sources, the fleet one with `Fleet "f1"`, `FleetAccount "bab"`. |
| + - `TestRowCountsRefusesForeignFleetRow` (Review Focus 2): a row and a guard tally in `f1`'s day claiming `bdk/shop`. Want `rowCounts(...) == false` and `tallyCounts(...) == false` for `bdk/shop`; the same claiming `bab/shop` gives true. |
| + - `TestReadEdgeDaysParseErrorFails` (Review Focus 5): a root day holding `{not json`. Want an error, not a short result; the same for a malformed day in the reading account's own fleet. |
| + - `TestReadEdgeDaysNeverTouchesForeignFleet` (R3 finding 1): fleet `f2` owned by `bdk` holds a malformed day. A read for `bab` succeeds, and a store wrapper records that no key under `fleets/f2/` was listed or read. |
| + - `TestReadEdgeDaysOperatorSkipsBadFleet`: the same store, `acct ""`. Want success with `f1`'s sources and `["f2"]` as the unreadable list. |
| + - `TestRateLimitCountsIgnoresForeignFleet`: the same malformed `f2` day; rate-limit counts for a `bab` instance return 200 with its own counts. |
| + - `TestRateLimitCountsIncludesFleetBoxes`: a fleet row for `bab`'s host with `RateShed 4`. Want `Shed 4`. |
| - In `usagedays_test.go`, `TestUsageDayDateFleetEdgeDay`: `fleets/f1/usage/edge/box-a/days/2026-11-02.json` gives `("2026-11-02", true)`; `fleets/f1/usage/edge/box-a/x/days/2026-11-02.json` gives `false`. |
| - [ ] **Step 2: Run them and see them fail** |
| @@ -201,12 +207,12 @@ git commit -m "console: one edge-day reader for root and fleet boxes; fleet rows |
| Rules: counts sum `Hours` of the accepted tallies (`tallyCounts`) over the window's dates, per day and in total; `Groups` sums their `Groups`. Nothing else is derived (no coverage, Paul's R2 ruling). |
| -- [ ] **Step 1: Write the failing tests** in `internal/console/protection_test.go`, building `edgeDaySource` values in memory, app `acct1/shop` on host `shop.example.com`: |
| +- [ ] **Step 1: Write the failing tests** in `internal/console/protection_test.go`, building `edgeDaySource` values in memory, app `bab/shop` on host `shop.example.com`: |
| - `TestProtectionDatesWholeDays`: `protectionDates(7, 2026-11-05T13:00Z)` is `2026-10-30` to `2026-11-05`, 7 entries; `protectionDates(9, …)` gives 7. |
| - `TestSumProtectionTotals`: two boxes, hours `"09"` and `"10"` on `2026-11-05`, tally hours checked 100/50, watch 6/2, block 0/1, groups `probe/wordpress: 5`, `hard/secrets: 4`. Want `Checked 150, Watch 8, Block 1`, `Groups {"probe/wordpress":5,"hard/secrets":4}`. |
| - `TestSumProtectionNothingCaught`: tallies with checked counts and zero watch and block. Want `Checked > 0, Watch 0, Block 0`. |
| - `TestSumProtectionNoTallies`: rows with traffic, no tallies. Want `Checked 0` and every day zero. |
| - - `TestSumProtectionOwnerChange` (Review Focus 3): host re-owned to `acct2/blog` in hour `"12"`, both owners' tallies present for that hour. Want `acct1/shop` to see only its tally (caught equals its group total), `acct2/blog` only its own. |
| + - `TestSumProtectionOwnerChange` (Review Focus 3): host re-owned to `bdk/shop` in hour `"12"`, both owners' tallies present for that hour. Want `bab/shop` to see only its tally (caught equals its group total), `bdk/shop` only its own. |
| - `TestSumProtectionAllSortsApps`: three apps with caught 5, 12, 0. Want rows ordered 12, 5, 0 and summary totals the sum. |
| - [ ] **Step 2: Run them and see them fail** |
| @@ -267,6 +273,7 @@ Draft rows (status `pending`; placeholders in braces are filled by the template) |
| | PT-C40 | templates/fleet_protection.html (title) | Protection | |
| | PT-C41 | templates/fleet_protection.html (headline) | In the last {days} days, {caught} requests across {apps} apps looked like attacks. | |
| | PT-C42 | templates/fleet_protection.html (table headings) | Account · App · Caught · Blocked · Share | |
| +| PT-C43 | templates/fleet_protection.html (unreadable fleets) | These fleets' counts could not be read and are left out: {fleets}. | |
| - [ ] **Step 1: Write the deck** with the rows above, one row per group name (PT-C20 to PT-C35, in the order listed), status `pending`, `checked by` = `gate` for literal strings and the owning test name for strings with placeholders. |
| - [ ] **Step 2: Write the gate test** (`TestProtectionCopyDeckIsApprovedAndApplied`): fails while any row is `pending`, and for every id in `protectionCopyBuilt` checks the `new` text appears in its file (`gate`) or the named test exists. |
| @@ -298,7 +305,7 @@ git commit -m "console: protection tab copy deck, reviewed by Paul" |
| - Routes `GET /a/{sqid}/apps/{app}/protection` (`handleAppProtection`, page via `s.appPage(w, r, "protection")`, same access as Analytics) and `GET /a/{sqid}/apps/{app}/protection/data` (`handleAppProtectionData`, JSON `protectionSummary` with `groups` keys unchanged). |
| - Query `range=7d|30d`; anything else is `7d` (a page never 400s over its query, as `handleAppAnalytics`). |
| - `func protectionGroupName(key string) string` in `protectiongroups.go`, from PT-C20..C36; unknown keys give PT-C36. |
| - - Reads through `s.usageDayReader(now)` with `instanceStoreTimeout`. |
| + - Reads with `readEdgeDays(ctx, s.usageDayReader(now), dates, acct.Sqid)` under `instanceStoreTimeout`, so only the account's own fleets are touched. |
| - Logs filter (plan R1 finding 6): the logs door and page accept `protection=1`, which keeps only records with `Fields["kind"]` `watch` or `block` whose `Fields["rule"]` names a catalogue rule that is not `edgeguard.ModeBurst` (lookup `func edgeguard.RuleByID(id string) (*edgeguard.Rule, bool)` over the embedded catalogue, added if none exists). It is a predicate on `applog.Filter` (new field `Keep func(Record) bool`, consulted by `Filter.Match`), so `ReadWindow` applies it inside `ReadChunks` before the per-box and merged `collectCap` trims and before pagination (R2 finding 3). The page form carries `protection=1` as a hidden input so submitting the form and live following keep it. |
| - Logs link: `{Nav}/apps/{app}/logs?stream=edge&protection=1&since=<start>`, where `<start>` is the window's first date at `00:00:00Z` in RFC 3339, or `now-168h` when that is later (logs keep 7 days). The same population the counts cover (R2, R1-6). The Logs page keeps a `since` value it does not list as a selected option already (`app_logs.html`). On the 30-day view, PT-C19 sits beside the link. |
| @@ -345,19 +352,20 @@ git commit -m "console: per-app Protection tab and its JSON door" |
| **Interfaces:** |
| - Consumes: `readEdgeDays`, `protectionDates`, `sumProtectionAll`. |
| -- Produces: `GET /fleet/protection` (`handleFleetProtection`, operator access exactly as `handleEconomics` checks it, page via `s.opPage(addr, raw, "protection")`) and `GET /fleet/protection/data` (JSON `{summary, apps}`). |
| +- Produces: `GET /fleet/protection` (`handleFleetProtection`, operator access exactly as `handleEconomics` checks it, page via `s.opPage(addr, raw, "protection")`) and `GET /fleet/protection/data` (JSON `{summary, apps, unreadable_fleets}`). Reads with `readEdgeDays(..., "")`; unreadable fleets are named on the page with PT-C43. |
| - *Plan's call (spec §4.1 leaves the spot to the builder):* its own page in the operator section, linked from the operator nav beside Economics, rather than a section inside Economics, which is about money. |
| - [ ] **Step 1: Write the failing tests** |
| - `TestFleetProtectionOperatorsOnly`: a non-operator gets what `/fleet/economics` gives them. |
| - `TestFleetProtectionListsApps`: three apps seeded, one on a fleet box owned by its account and one fleet row claiming a foreign account. Want PT-C41 with the two legitimate apps' total and the foreign row absent from the table. |
| - `TestFleetProtectionData`: the JSON door's `apps` sorted by caught, descending. |
| + - `TestFleetProtectionNamesUnreadableFleet`: a malformed fleet day. Want 200, the other apps listed, and PT-C43 naming the fleet. |
| - [ ] **Step 2: Run them and see them fail** |
| Run: `go test ./internal/console/ -run 'FleetProtection'` |
| Expected: FAIL. |
| -- [ ] **Step 3: Implement**, adding PT-C40..C42 to `protectionCopyBuilt`. |
| +- [ ] **Step 3: Implement**, adding PT-C40..C43 to `protectionCopyBuilt`. |
| - [ ] **Step 4: Run the tests and the copy gate and see them pass** |
| Run: `go test ./internal/console/ -run 'FleetProtection|TestProtectionCopyDeck'` |
diff --git a/docs/superpowers/plans/CODEX-FINDINGS-CONSOLE-PROTECTION-TAB-PLAN-R3.md b/docs/superpowers/plans/CODEX-FINDINGS-CONSOLE-PROTECTION-TAB-PLAN-R3.md| new file mode 100644 |
| index 000000000..7e4e65635 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CODEX-FINDINGS-CONSOLE-PROTECTION-TAB-PLAN-R3.md |
| @@ -0,0 +1,41 @@ |
| +**One new P1 and one new P2.** Reviewed HEAD `71aa5a81533c1cb2ebe7e571c2912bdcc14718fe`. Source inspection only; no files changed or tests run. |
| + |
| +“Fixed” below means addressed in the revised plan. |
| + |
| +| Earlier finding | Disposition | Evidence | |
| +|---|---|---| |
| +| R1-1: incorrect tier conversion | **Fixed** | Task 2 specifies `rule.Tier.String()` ([plan:100](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:100)). | |
| +| R1-2: ownership changes separate groups from totals | **Fixed** | Hourly counts and groups share the host-account-app tally ([plan:52](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:52)). | |
| +| R1-3: window-dependent coverage | **Fixed by cut** | Paul’s ruling removes the claim ([plan:13](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:13)). | |
| +| R1-4: group-cap overflow | **Fixed** | `AddGroup` reserves the `other` slot ([plan:56](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:56)). | |
| +| R1-5: size gate exceeds cache limit | **Fixed** | Task 8 requires under 768 KiB and verifies caching ([plan:382](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:382)). | |
| +| R1-6, carried through R2: Logs population and start time | **Fixed** | Watch/block union, burst exclusion and retention-clamped UTC start are specified ([plan:302](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:302)). | |
| +| R2-1: far asset checks omitted | **Fixed** | Both observer sites count, using the far handler’s existing handoff condition ([plan:126](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:126)). | |
| +| R2-2: another app’s mode certifies traffic | **Fixed by cut** | Aggregation derives counts only ([plan:202](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:202)). | |
| +| R2-3: filtering after collection limits | **Fixed** | `Filter.Match` receives the predicate before collection caps, with an over-cap test ([plan:302](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:302), [plan:316](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:316)). | |
| + |
| +The following findings are new. |
| + |
| +1. **P1 — Task 3: one fleet can break unrelated accounts’ reads.** |
| + |
| + **Invariant:** tenant-controlled fleet data must not determine whether another account’s reads succeed. |
| + |
| + `readEdgeDays` reads **every fleet**, failing the entire call on any malformed object; account filtering happens afterward. `rateLimitCounts` must adopt this reader ([plan:153](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:153), [plan:157](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:157)). |
| + |
| + A fleet credential can write anywhere under its own prefix ([storedoor.go:648](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/internal/edge/storedoor.go:648)). The PUT handler stores the supplied body without JSON validation ([storedoor.go:204](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/internal/edge/storedoor.go:204)). Writing `{` to its own edge-day object therefore breaks every account’s Protection read for that date. It also makes unrelated instance rate-limit GETs return 502 ([apiinstances_ratelimit.go:160](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/internal/console/apiinstances_ratelimit.go:160)). The later ownership predicates cannot prevent this. |
| + |
| + **Fix:** give the reader an account scope. For account-specific reads, exclude fleets whose registry owner differs **before listing or reading their objects**. Keep an explicit all-account mode for the operator page. Test that a malformed foreign fleet day is never accessed, while malformed relevant days still fail visibly. |
| + |
| +2. **P2 — Tasks 1, 2 and 4: ownership tests do not isolate account changes.** |
| + |
| + **Invariant:** account identity independently separates protection totals, even when host and app name stay unchanged. |
| + |
| + Every transfer fixture changes both account and app, from `acct1/shop` to `acct2/blog` ([plan:65](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:65), [plan:107](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:107), [plan:209](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/docs/superpowers/plans/2026-10-30-console-protection-tab.md:209)). A defective key containing only host and app would still produce two entries. |
| + |
| + Moreover, `acct1` and `acct2` are invalid account identifiers: the validator accepts only 3–16 lowercase letters ([names.go:10](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/launchctx/controlname/names.go:10)). Task 2’s required `release.RouteAccount` normalizes both to `OpsAccount` ([adopt.go:1363](/home/paulca/.cache/tmp/claude-1001/design-console-protection-tab/internal/release/adopt.go:1363)), so its meter test never exercises two account identities. |
| + |
| + **Fix:** use valid distinct accounts, such as `bab` and `bdk`, with the **same host and app name**. Assert the exact owner keys and each owner’s counts through accumulation, merge and aggregation. |
| + |
| +The sole P1 comes from reading foreign fleet objects before applying account scope. Refusing those sources before I/O removes it; cutting fleet aggregation would also remove it. Round 3 exhausts the review budget; no fourth round is initiated. |
| + |
| +**NOT READY.** |
| \ No newline at end of file |