plan 3: keep explicit whole-account bills excluded (Astra r2 #6)
A hand-entered "whole" basis is stored as written and never promoted by CONSOLE_COST_ACCOUNT_CARLOS_ONLY; only an absent basis is. Adds BasisWhole, hint C7, TestManualWholeBillStaysExcluded, fixes copy ids C1-C7 as final, and a pre-landing go build ./... plus make test step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+31
−26
docs/superpowers/plans/2026-11-09-billing-dashboard-3-carlos-only-cost.md+31 −26
diff --git a/docs/superpowers/plans/2026-11-09-billing-dashboard-3-carlos-only-cost.md b/docs/superpowers/plans/2026-11-09-billing-dashboard-3-carlos-only-cost.md| index fd14254f0..3b10ecd3d 100644 |
| --- a/docs/superpowers/plans/2026-11-09-billing-dashboard-3-carlos-only-cost.md |
| +++ b/docs/superpowers/plans/2026-11-09-billing-dashboard-3-carlos-only-cost.md |
| @@ -4,18 +4,18 @@ |
| **Goal:** Every stored AWS bill says what it covers, and the console exposes one figure, the month's CARLOS-only platform cost. A console that cannot vouch for that figure hides it instead of showing a mixed AWS account's total. |
| -**Architecture:** `economics.Bill` gains an additive `basis`. The hourly `billPass` stamps `account` when the console declares its AWS account CARLOS-only (Carloku), otherwise it leaves the basis empty, meaning the whole account. One method, `carlosPlatformCostUSD`, reads the stored bill and answers only for a CARLOS-only basis; Plan 2 converts it to euros. The Economics page and the manual-entry doors show and set the basis. Filtering by the `carlos:deployment` tag is deferred (see "Later"). |
| +**Architecture:** `economics.Bill` gains an additive `basis`. The hourly `billPass` stamps `account` when the console declares its AWS account CARLOS-only (Carloku), otherwise it leaves the basis unstated (no `basis` key), as every existing bill is. A hand-entered bill can also say `whole` explicitly. One method, `carlosPlatformCostUSD`, reads the stored bill and answers only for a CARLOS-only basis; Plan 2 converts it to euros. The Economics page and the manual-entry doors show and set the basis. Filtering by the `carlos:deployment` tag is deferred (see "Later"). |
| **Tech Stack:** Go, the existing Cost Explorer seam (`internal/console/cepull.go`), `html/template`. No new dependency, no infrastructure change. |
| **Spec:** `docs/superpowers/specs/2026-11-09-billing-dashboard-design.md` §4.5, plus the parts of §2 (anti-goal "A total AWS cost that includes things that aren't CARLOS") and §7 ("The platform cost matches the CARLOS-only AWS figure, and the page says which basis it used") that name it. Paul, 2026-11-09: "Make sure the AWS bill stuff only takes CARLOS related resources into account and not the full AWS bill on the account. I think in the Carloku case, everything on the bill is CARLOS related, so that should be fine." Plans 1 and 2 of this spec are written beside this one; Plan 2 calls this plan's seam. |
| -**Review history:** Astra plan round 1 (2026-11-09) found three items against this plan. #8 (record-write census) is fixed in Task 1. #9 and #10 were against the tag-mode slice, which the coordinator deferred; both are carried into "Later". The coordinator ruled to keep excluding the AWS `Tax` line. |
| +**Review history:** Astra plan round 1 (2026-11-09) found three items against this plan. #8 (record-write census) is fixed in Task 1. #9 and #10 were against the tag-mode slice, which the coordinator deferred; both are carried into "Later". The coordinator ruled to keep excluding the AWS `Tax` line. Astra plan round 2 finding 6 (an explicit whole-account bill was stored as `""` and then promoted) is fixed by storing `whole` as written; only an absent basis is promoted. |
| ## Global Constraints |
| - Baseline: branch `design-billing-dashboard`, `dd344d1fa37b43a4ce5a260cd402a68bb954a5ba`. Unqualified `file:line` citations refer to it. New names below are this plan's decisions. |
| -- Wire shapes are additive (`AGENTS.md:431`). Bills written before this plan carry no `basis` and must still parse, and a whole-account bill written after it must marshal byte-identically to one written before it (`omitempty`). |
| +- Wire shapes are additive (`AGENTS.md:431`). Bills written before this plan carry no `basis` and must still parse, and a bill with an unstated basis written after it must marshal byte-identically to one written before it (`omitempty`). |
| - Provider-neutral core (memory `provider-neutral-core`): `internal/economics` gains a plain string, no AWS import. Cost Explorer stays behind the existing `ceCosts` seam. A deployment without AWS records bills by hand and declares their basis. |
| - Pages never call Cost Explorer (spec §2 anti-goal "A slow page"). Only `billPass` does. |
| - No new bucket object and no new poll (memory `s3-requests-cost-money`). Steady-state request budget with nothing changing: S3 unchanged (`billPass` already reads two bill objects per hourly tick), Cost Explorer unchanged except one re-pull per stored month when the basis changes. `carlosPlatformCostUSD` makes one GET per call; Plan 2 owns its caching. |
| @@ -28,9 +28,9 @@ |
| ## Review Focus |
| 1. **The setting changes after bills exist.** A month already pulled, or already settled after day 3, would keep its old basis forever. Expected: one re-pull under the new basis, then the ordinary once-a-day and settle rules. Task 1 `TestBillPassRepullsOnBasisChange`. |
| -2. **A hand-entered bill on an undeclared account.** An old CLI sends no basis. Expected: it is not counted as CARLOS-only unless the account is declared CARLOS-only. Task 4 `TestEconomicsBillBasisDoors`. |
| +2. **A hand-entered bill marked whole-account.** An operator records a mixed-account bill as `whole`, and the account is later, or already, declared CARLOS-only. Expected: it stays excluded (`ok=false`); only an absent basis is promoted. Task 4 `TestManualWholeBillStaysExcluded`. An old CLI that sends no basis on an undeclared account is not counted either (`TestEconomicsBillBasisDoors`). |
| 3. **AWS tax on the bill.** Revenue on the Billing pages is before tax (spec §4.3). Expected: the platform cost leaves out the `Tax` service line. Task 2 `TestCarlosPlatformCostBasis`. |
| -4. **An unknown or hand-edited `basis` value in the bucket**, including a value a later version writes (`tagged`) read by this one. Expected: read as whole-account (fail closed), never as CARLOS-only. Task 2 `TestCarlosPlatformCostBasis`. |
| +4. **An unknown or hand-edited `basis` value in the bucket**, including a value a later version writes (`tagged`) read by this one. Expected: read as `whole` (fail closed), never as CARLOS-only. Task 2 `TestCarlosPlatformCostBasis`. |
| 5. **The host-side bill classifier meets the new key.** Expected: the current binary admits bills with and without `basis`. Task 1 `TestReviewedStorageBodiesBindIdentityAndScope` rows. |
| --- |
| @@ -38,22 +38,23 @@ |
| ## Decisions |
| - **Setting** (my call; spec §6 leaves the name to the builder). `CONSOLE_COST_ACCOUNT_CARLOS_ONLY=true` declares the whole AWS account CARLOS-only. A non-boolean value stops the console at boot (the `domainProof` shape, `cmd/console/main.go:1489`). Unset: bills are still pulled whole-account for the Economics page, and the CARLOS-only figure is hidden. No tag setting in this plan. |
| -- **Stored basis values** (`internal/economics`): `""` means the whole account, which may hold more than CARLOS (every existing bill). `"account"` means the whole account, declared CARLOS-only. |
| -- **Reading a bill** (`effectiveBillBasis`): a stored `account` stands, whatever the setting is now, because it was true when pulled. A stored `""` reads as `account` while the setting is on, since a whole-account figure from a CARLOS-only account is CARLOS-only. That is how Carloku's settled October bill counts without a re-pull. Any other value reads as `""`. |
| +- **Stored basis values** (`internal/economics`): absent (`""`, `BasisUnstated`) means nobody said: every existing bill, and every pull on a console without the setting. `"account"` (`BasisAccount`) means the whole account, declared CARLOS-only. `"whole"` (`BasisWhole`) means the whole account, stated to hold more than CARLOS; only manual entry writes it. |
| +- **Reading a bill** (`effectiveBillBasis`): a stored `account` stands, whatever the setting is now, because it was true when written. A stored `whole` stands too, and the setting never promotes it. Only an absent basis reads as `account` while the setting is on, since an unstated whole-account figure from a CARLOS-only account is CARLOS-only. That is how Carloku's settled October bill counts without a re-pull. Any other value (`tagged` from a later version, a hand edit) reads as `whole`, fail closed. |
| - **Tax.** `carlosPlatformCostUSD` subtracts the `Tax` service line (Cost Explorer's `SERVICE` value for tax). Ruled: keep. |
| - **Per-service "Counts as CARLOS" checkboxes** (`Scenario.BillServices`, `templates/economics.html:209-221`) stay a modelling knob on the Economics page and do not feed `carlosPlatformCostUSD`. A service-level pick cannot separate CARLOS from other EC2 in the same account. |
| -- **Manual entry.** The form, the API and the CLI take an optional basis, `account` or `whole`. When it is absent the console uses `account` if the account is declared CARLOS-only, otherwise `""`. |
| +- **Manual entry.** The form, the API and the CLI take an optional basis, `account` or `whole`, stored as written. When it is absent the console stores `account` if the account is declared CARLOS-only, otherwise leaves it unstated. |
| -## Copy table (through `copy-review` before Task 2) |
| +## Copy table (through `copy-review` before Task 2; ids C1-C7 are final, Plan 2 refers to them) |
| | # | Where | Draft | |
| |---|---|---| |
| | C1 | basis label, account | `AWS, whole account: CARLOS only` | |
| -| C2 | basis label, whole | `AWS, whole account: not only CARLOS` | |
| -| C3 | hint, whole | `This bill covers the whole AWS account, which may hold more than CARLOS. If the account runs only CARLOS, set CONSOLE_COST_ACCOUNT_CARLOS_ONLY=true on the console.` | |
| +| C2 | basis label, unstated or whole | `AWS, whole account: not only CARLOS` | |
| +| C3 | hint, unstated | `This bill covers the whole AWS account, which may hold more than CARLOS. If the account runs only CARLOS, set CONSOLE_COST_ACCOUNT_CARLOS_ONLY=true on the console.` | |
| | C4 | hint, no bill | `No AWS bill on file for %s yet.` | |
| | C5 | manual form | label `What this bill covers`; options `The whole account, which runs only CARLOS` / `The whole account, CARLOS and other things` | |
| | C6 | CLI `--basis` help | `what the total covers: account (the whole account, which runs only CARLOS) or whole (the whole account, CARLOS and other things)`; output line `basis: %s` | |
| +| C7 | hint, explicit whole | `This bill was entered as covering the whole AWS account, CARLOS and other things, so it does not count as CARLOS cost.` | |
| | x | not reviewed (diagnostics) | boot: `console: CONSOLE_COST_ACCOUNT_CARLOS_ONLY %q is not a boolean (use true or false)`; API 400: `basis must be account or whole` | |
| --- |
| @@ -68,12 +69,12 @@ |
| - Modify: `internal/console/server.go:761` (Config field only, no `NewServer` change), `:1336` (seam type); `cmd/console/main.go:507` (wire the setting); `internal/console/cepull.go:42,53` (seam takes `ceQuery`); `internal/console/economicspass.go:1072-1127` (`pullBillMonth`, `shouldSkipCEPull`); `internal/console/economicsbill_test.go` and `claim_invariant_probes_worker_test.go:157` (mechanical: closures take `ceQuery`); `internal/hostops/storage_classifier_test.go:36` (table rows only, no `hostops` source change) |
| **Interfaces:** |
| -- Produces, `internal/economics`: `const BasisWholeAccount = ""`, `const BasisAccount = "account"`, and `Bill.Basis string` with JSON tag `basis,omitempty`. `Schema` stays 1. |
| +- Produces, `internal/economics`: `const BasisUnstated = ""`, `const BasisAccount = "account"`, `const BasisWhole = "whole"`, and `Bill.Basis string` with JSON tag `basis,omitempty`. `Schema` stays 1. |
| - Produces, `internal/console`: `type CostScope struct { AccountCarlosOnly bool }`; `Config.CostScope CostScope`; `type ceQuery struct { Start, End time.Time }`; seam `ceCosts func(ctx context.Context, q ceQuery) (map[string]float64, error)`; `func (s *Server) resolveCECosts(ctx context.Context, q ceQuery) (map[string]float64, error)`; `func (s *Server) realCECosts(ctx context.Context, q ceQuery) (map[string]float64, error)`; `func (s *Server) billBasisFor(start, end time.Time) (q ceQuery, basis string)`; `func shouldSkipCEPull(existing *economics.Bill, closedMonth bool, now time.Time, basis string) bool`. |
| - Produces, `cmd/console`: `func costScopeFromEnv(getenv func(string) string) (console.CostScope, error)`; `main` calls it and `log.Fatal`s on error. |
| - [ ] **Step 1: Write the failing tests** |
| - - `TestBillBasisWireShape` (`internal/economics`): `{"schema":1,"month":"2026-10","total_usd":5,"services":{},"source":"costexplorer"}` unmarshals with `Basis == ""`. Marshalling a bill with `Basis: BasisWholeAccount` produces no `"basis"` key. An `account` bill round-trips. |
| + - `TestBillBasisWireShape` (`internal/economics`): `{"schema":1,"month":"2026-10","total_usd":5,"services":{},"source":"costexplorer"}` unmarshals with `Basis == ""`. Marshalling a bill with `Basis: BasisUnstated` produces no `"basis"` key. `account` and `whole` bills round-trip. |
| - `TestCostScopeFromEnv` (`cmd/console`): unset gives the zero scope, `"true"` gives `AccountCarlosOnly`, and `"maybe"` errors with the variable's name in the message. |
| - `TestBillPassStampsBasis` (`internal/console`, fixture `newConsoleFixture`, `now := 2026-08-11T03:00Z`): with `fx.srv.cfg.CostScope = CostScope{AccountCarlosOnly: true}`, both the `2026-08` and `2026-07` bills have `Basis == "account"`. With the zero scope both have `Basis == ""` and their raw JSON contains no `"basis"`. |
| - `TestBillPassRepullsOnBasisChange`: a zero-scope `billPass` makes 2 `ceCosts` calls. Set the account scope and run again the same UTC day: 2 more calls, and both bills are now `account`. A third run makes 0 more calls. Separately, a `2026-07` bill stored with `PulledAt 2026-08-05` (settled) and `Basis ""` is re-pulled exactly once after the switch. |
| @@ -82,7 +83,7 @@ |
| Run: `go test ./internal/economics ./cmd/console ./internal/console ./internal/hostops -run 'TestBillBasisWireShape|TestCostScopeFromEnv|TestBillPass(StampsBasis|RepullsOnBasisChange)|TestReviewedStorageBodiesBindIdentityAndScope' -count=1` |
| Expected: FAIL on undefined `Basis`, `CostScope` and `costScopeFromEnv`. The `basis` hostops row fails on an unknown field until `bill.go` changes. |
| - [ ] **Step 3: Implement** |
| - `billBasisFor` returns `(ceQuery{start, end}, BasisAccount)` when `AccountCarlosOnly`, otherwise `(ceQuery{start, end}, BasisWholeAccount)`. `pullBillMonth` computes the basis before the skip check and stamps it on the bill it writes. `shouldSkipCEPull` returns false when `existing.Basis != basis`, ahead of its settle and same-day rules. Manual-wins in `upsertBill` is unchanged, and `upsertBill` itself is not edited. `costScopeFromEnv` reads `CONSOLE_COST_ACCOUNT_CARLOS_ONLY` with `strconv.ParseBool` after `TrimSpace`. `NewServer` is not edited: `s.cfg` already carries the whole `Config`, and a single bool has nothing to validate. |
| + `billBasisFor` returns `(ceQuery{start, end}, BasisAccount)` when `AccountCarlosOnly`, otherwise `(ceQuery{start, end}, BasisUnstated)`. `pullBillMonth` computes the basis before the skip check and stamps it on the bill it writes. `shouldSkipCEPull` returns false when `existing.Basis != basis`, ahead of its settle and same-day rules. Manual-wins in `upsertBill` is unchanged, and `upsertBill` itself is not edited. `costScopeFromEnv` reads `CONSOLE_COST_ACCOUNT_CARLOS_ONLY` with `strconv.ParseBool` after `TrimSpace`. `NewServer` is not edited: `s.cfg` already carries the whole `Config`, and a single bool has nothing to validate. |
| - [ ] **Step 4: Run to verify they pass**, plus the existing bill tests: `go test ./internal/console -run 'TestBillPass|TestEconomics' -count=1`; expect PASS. |
| - [ ] **Step 5: Root-read census.** Run `make census-card`. CLAIMS line: `internal/economics/bill.go:Bill<TAB>one additive string field and two consts; no read added`. Then run `make census-propose NAME=<branch> CLAIMS=<file>`. If Plans 1-2 share this branch, add the line to that branch's single CLAIMS file instead. |
| - [ ] **Step 6: Record-write census (Astra #8).** Run `go test ./internal/provision -run TestPlan9B8RecordWriteCensus -count=1`. This plan is designed to leave every fingerprinted unit unchanged, so expect PASS. If it reports a `changed site`, for example because the implementation did touch `NewServer` or `Server.upsertBill`, or because Plans 1-2 on this branch did, update the inventory the way the existing overlays do (pattern: `internal/provision/analytics_live_census_test.go`): |
| @@ -103,25 +104,26 @@ |
| **Interfaces:** |
| - Consumes: Task 1's `economics.Basis*` and `Config.CostScope`; the existing `func (s *Server) getBill(ctx context.Context, month string) (*economics.Bill, error)` (`economicspass.go:1129`). |
| - Produces (Plan 2 calls these; the names are final): |
| - - `func (s *Server) carlosPlatformCostUSD(ctx context.Context, month string) (usd float64, basis string, ok bool)`. `month` is `"2006-01"`. `ok` is true only when the effective basis is `economics.BasisAccount`, and then `usd` is `TotalUSD - Services["Tax"]`. When `!ok`, `basis` is `economics.BasisWholeAccount` for a whole-account bill, or `costBasisMissing` when there is no readable bill (a read error is logged). Plan 2 owns caching and conversion: `platformCostEUR(month)` multiplies `usd` by its daily USD→EUR rate, passes `basis` through, and hides the figure when `!ok`. |
| + - `func (s *Server) carlosPlatformCostUSD(ctx context.Context, month string) (usd float64, basis string, ok bool)`. `month` is `"2006-01"`. `ok` is true only when the effective basis is `economics.BasisAccount`, and then `usd` is `TotalUSD - Services["Tax"]`. When `!ok`, `basis` is the effective basis, `economics.BasisUnstated` or `economics.BasisWhole`, or `costBasisMissing` when there is no readable bill (a read error is logged). Plan 2 owns caching and conversion: `platformCostEUR(month)` multiplies `usd` by its daily USD→EUR rate, passes `basis` through, and hides the figure when `!ok`. |
| - `const costBasisMissing = "missing"` (never stored). |
| - `func effectiveBillBasis(b economics.Bill, scope CostScope) string`. |
| - - `func costBasisLabel(basis, deployment string) string` returns C1 or C2. `deployment` is ignored here; it is kept because Plan 2 already calls this signature, and the tag follow-up will use it. |
| - - `func costBasisHint(scope CostScope, basis, month string) string` (the signature Plan 2 calls) returns C3 for `""`, C4 for `costBasisMissing`, and `""` for `account`. The Billing pages render it in place of hidden costs (spec §4.5, "hidden behind a one-line explanation"). |
| + - `func costBasisLabel(basis, deployment string) string` returns C1 for `account` and C2 otherwise. `deployment` is ignored here; it is kept because Plan 2 already calls this signature, and the tag follow-up will use it. |
| + - `func costBasisHint(scope CostScope, basis, month string) string` (the signature Plan 2 calls) returns C3 for `BasisUnstated`, C7 for `BasisWhole`, C4 for `costBasisMissing`, and `""` for `account`. The Billing pages render it in place of hidden costs (spec §4.5, "hidden behind a one-line explanation"). |
| - `const billTaxService = "Tax"`. |
| -- [ ] **Step 0 (once, before this task): copy review.** Run the `copy-review` skill over rows C1-C6 and wait for Paul's edits. Apply them verbatim. Tasks 2-4 use the approved strings. |
| +- [ ] **Step 0 (once, before this task): copy review.** Run the `copy-review` skill over rows C1-C7 and wait for Paul's edits. Apply them verbatim. Tasks 2-4 use the approved strings. |
| - [ ] **Step 1: Write the failing tests.** `TestCarlosPlatformCostBasis` is a table of stored bill × scope → `(usd, basis, ok)`: |
| - no object → `(0, "missing", false)`; an unparseable object → `(0, "missing", false)` |
| - `""` bill, zero scope → `(0, "", false)` |
| + - `"whole"` bill, account scope → `(0, "whole", false)` (an explicit whole-account bill is never promoted) |
| - `""` bill, account scope, `Total 100`, `Services {"AmazonEC2":90,"Tax":10}` → `(90, "account", true)` |
| - `"account"` bill, zero scope → `ok` true, basis `account` (the stored basis stands) |
| - - `"tagged"` bill and `"bogus"` bill, account scope → `(0, "", false)` (an unknown value is whole-account, and the setting does not promote it) |
| + - `"tagged"` bill and `"bogus"` bill, account scope → `(0, "whole", false)` (an unknown value reads as `whole`, which the setting does not promote) |
| - manual `""` bill, account scope → `ok` true, basis `account` |
| - `TestCostBasisLabelAndHint` asserts C1 to C4 exactly as approved. |
| + `TestCostBasisLabelAndHint` asserts C1 to C4 and C7 exactly as approved. |
| - [ ] **Step 2: Run** `go test ./internal/console -run 'TestCarlosPlatformCostBasis|TestCostBasisLabelAndHint' -count=1`; expect FAIL (undefined). |
| -- [ ] **Step 3: Implement** the Interfaces above. In `effectiveBillBasis`, only `""` is promoted to `account` by the setting, `account` passes through, and any other value returns `""`. |
| +- [ ] **Step 3: Implement** the Interfaces above. In `effectiveBillBasis`, only `""` is promoted to `account` by the setting; `account` and `whole` pass through; any other value returns `whole`. |
| - [ ] **Step 4: Run Step 2 again**; expect PASS. |
| - [ ] **Step 5: Commit** `console: one CARLOS-only platform cost figure for Billing` |
| @@ -152,19 +154,22 @@ |
| **Interfaces:** |
| - Consumes: Task 1's basis consts and `Config.CostScope`. |
| -- Produces: `func (s *Server) manualBillBasis(raw string) (string, error)` in `economicspass.go`. `""` gives the default (`account` if declared, else `""`), `account` gives `BasisAccount`, `whole` gives `BasisWholeAccount`, and anything else is an error. The API request gains `Basis string` with JSON tag `basis,omitempty`. CLI: `func validBillBasis(s string) error` accepts `""`, `account` and `whole`; `func (s *apiSession) economicsBill(ctx context.Context, month string, total float64, services map[string]float64, basis string) (economicsBillResult, error)`. |
| +- Produces: `func (s *Server) manualBillBasis(raw string) (string, error)` in `economicspass.go`. `""` gives the default (`account` if declared, else `BasisUnstated`), `account` gives `BasisAccount`, `whole` gives `BasisWhole`, and anything else is an error. The API request gains `Basis string` with JSON tag `basis,omitempty`. CLI: `func validBillBasis(s string) error` accepts `""`, `account` and `whole`; `func (s *apiSession) economicsBill(ctx context.Context, month string, total float64, services map[string]float64, basis string) (economicsBillResult, error)`. |
| - [ ] **Step 1: Write the failing tests.** |
| - - `TestEconomicsBillBasisDoors` (form and API, table): basis `account` stores `account`. No basis with the account scope stores `account`. No basis with the zero scope stores `""`. `whole` with the account scope stores `""`. `tagged` and `bogus` give the form a 400 and the API a 400 `basis must be account or whole`, and nothing is written. |
| + - `TestEconomicsBillBasisDoors` (form and API, table): basis `account` stores `account`. No basis with the account scope stores `account`. No basis with the zero scope stores no `basis` key. `whole` with the account scope stores `whole`. `tagged` and `bogus` give the form a 400 and the API a 400 `basis must be account or whole`, and nothing is written. |
| - Extend `TestAPISessionEconomicsBillWireShape`: with basis `"account"` the body carries `"basis":"account"`; with `""` the key is absent, so an older console sees the same body as before. |
| + - `TestManualWholeBillStaysExcluded` (Astra round 2 #6): with the account scope, POST `/api/economics/bill` for `2026-10` with basis `whole`, then `carlosPlatformCostUSD(ctx, "2026-10")` returns `ok=false` and basis `whole`. The same through the form door. |
| - `TestValidBillBasis`. |
| -- [ ] **Step 2: Run** `go test ./internal/console -run TestEconomicsBillBasisDoors -count=1` and `go test . -run 'TestAPISessionEconomicsBill|TestValidBillBasis' -count=1`; expect FAIL. |
| +- [ ] **Step 2: Run** `go test ./internal/console -run 'TestEconomicsBillBasisDoors|TestManualWholeBillStaysExcluded' -count=1` and `go test . -run 'TestAPISessionEconomicsBill|TestValidBillBasis' -count=1`; expect FAIL. |
| - [ ] **Step 3: Implement.** The form's select defaults to the option that matches the scope (C5). The CLI prints `basis: <label>` using the stored basis (C6). Add `--basis` to the `cli.md` example paragraph. `internal/docsite` checks headings only, and none change. |
| - [ ] **Step 4: Run Step 2 again**, plus `go test ./internal/docsite ./internal/provision -run 'TestDocsite|TestPlan9B8RecordWriteCensus' -count=1`; expect PASS. The handlers call `upsertBill` and hold no write site of their own; if the record-write census reports one, follow Task 1 Step 6. |
| - [ ] **Step 5: Root-read census.** Add CLAIMS lines `economics.go:economicsBill<TAB>request gains optional basis; no read added`, and the same for `runEconomicsBill` and `economicsBillResult`. Rerun `make census-propose` with the same NAME. |
| - [ ] **Step 6: Commit** `economics bill: say what a hand-entered bill covers` |
| -Before merge: run `make test` and `go build ./...`, then the whole-branch review and both census verdicts on #280. |
| +### Before landing (`AGENTS.md:245`) |
| + |
| +- [ ] Run `go build ./...` and `make test` (it includes `gofmt -l .`) over the whole tree once; expect both clean. Then the whole-branch review and both census verdicts on #280. |
| --- |
| @@ -187,5 +192,5 @@ The spec's default (§4.5) is a Cost Explorer pull filtered to `carlos:deploymen |
| - **Tag activation does not prove coverage (Astra #10).** An active cost allocation tag only says Cost Explorer can filter on it, not that every CARLOS resource carries it. Before tagged costs are shown as the platform cost, the follow-up must establish verified coverage. For example, it could require the untagged list below to be empty of CARLOS resources, or tag everything the console creates at creation time and check the inventory, and it must state what happens to a month without that proof. Keep the month-level rule as well: a month counts only if the tag was `Active` (`ListCostAllocationTags`, `LastUpdatedDate`) from its first day. Activation happens in the paying (management) account, applies from activation onward, and needs `ce:ListCostAllocationTags` on the console's role (`infra/modules/region-host/main.tf:410`, which puts `infra/` into the root-read census). |
| - **Inventory vocabulary (Astra #9).** `infraview.Resource.Kind` values are `machine`, `disk`, `ip`, `bucket`, `dns_zone`, `alarm`, `other` and so on (`internal/infraview/infraview.go`). The AWS strings `ec2:instance`, `ec2:volume` and `ec2:eip` are `NativeType`. Select by `Kind`, and test against real inventory shapes produced by `internal/awsinv`. Note that the inventory reads tags for EC2 resources and the tagging catch-all, but not for buckets, hosted zones or alarms (`internal/awsinv/rest.go`, `ec2.go`). |
| - **Tagging what the console creates** (tenant buckets, steering health checks) needs `s3:TagResource` and `route53:ChangeTagsForResource` on the console role and census review. The 2b-1 managed-fleet storage already creates buckets with tags (`CreateBucketConfiguration.Tags`). |
| -- **Shape that fits this plan.** The new stored basis value `tagged` (plus the tag value) is additive. This plan already reads unknown values as whole-account, so an older console never shows tagged figures as CARLOS-only. The setting should be added only when it is honoured end to end, and could default from `CARLOS_MANAGED_FLEET_DEPLOYMENT` once 2b-2 merges. |
| +- **Shape that fits this plan.** The new stored basis value `tagged` (plus the tag value) is additive. This plan already reads unknown values as `whole`, so an older console never shows tagged figures as CARLOS-only. The setting should be added only when it is honoured end to end, and could default from `CARLOS_MANAGED_FLEET_DEPLOYMENT` once 2b-2 merges. |
| - AWS credits sit inside `UnblendedCost` and lower the figure. If Paul wants gross cost, filter `RECORD_TYPE`. |