pricing: the last two plan gaps codex found
TestCensusPassRecordsUnitOwners calls activator.UnitName but the test file does not import activator, and the import check pointed at economicspass.go, a different file. Go imports are file-scoped, so following the plan literally would have left undefined: activator. Adds the census-only regression test that was asked for in round two and still missing: a census snapshot must feed its own source count without moving CoveredDays, which reaches the live economics view. Round three found no further execution blockers.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2 files changed,
+68
−0
docs/superpowers/plans/2026-09-08-invoice-grade-statements.md+41 −0docs/superpowers/plans/CODEX-FINDINGS-invoice-grade-statements-round3.md+27 −0
CI passed — run details
diff --git a/docs/superpowers/plans/2026-09-08-invoice-grade-statements.md b/docs/superpowers/plans/2026-09-08-invoice-grade-statements.md| index 495d19a84..31a3d713f 100644 |
| --- a/docs/superpowers/plans/2026-09-08-invoice-grade-statements.md |
| +++ b/docs/superpowers/plans/2026-09-08-invoice-grade-statements.md |
| @@ -293,6 +293,39 @@ func TestStatementsPassUnsweptStorageIsNotComplete(t *testing.T) { |
| t.Errorf("storage source days = %d, want 0 — a store went unswept", got) |
| } |
| } |
| + |
| +// A census snapshot is not a measurement. Census must feed its own source |
| +// count without touching CoveredDays, which foldStorageAndCensus documents |
| +// as metrics/edge/storage only (economicspass.go:516-517) and which reaches |
| +// the live economics view. |
| +func TestStatementsPassCensusDoesNotCountAsCoverage(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + ctx := context.Background() |
| + now := time.Date(2026, 8, 1, 23, 0, 0, 0, time.UTC) |
| + |
| + putStoreJSON(t, fx.rel, usage.CensusDayKey("2026-08-01"), usage.CensusDay{ |
| + V: 1, Date: "2026-08-01", |
| + Accounts: map[string]usage.CensusAccount{fixtureAcct: {Apps: 1, Routes: 1}}, |
| + }) |
| + |
| + if err := fx.srv.statementsPass(ctx, now); err != nil { |
| + t.Fatal(err) |
| + } |
| + raw, _, err := fx.rel.Get(ctx, usage.StatementKey(fixtureAcct, "2026-08")) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + var st usage.Statement |
| + if err := json.Unmarshal(raw, &st); err != nil { |
| + t.Fatal(err) |
| + } |
| + if st.CoveredDays != 0 { |
| + t.Errorf("CoveredDays = %d, want 0 — a census alone measures nothing", st.CoveredDays) |
| + } |
| + if got := st.SourceDays[usage.SourceCensus]; got != 1 { |
| + t.Errorf("census source days = %d, want 1", got) |
| + } |
| +} |
| ``` |
| - [ ] **Step 7: Run it to verify it fails** |
| @@ -540,6 +573,14 @@ func TestCensusPassRecordsUnitOwners(t *testing.T) { |
| Note `activator.UnitName(host)` is `"carlos-app@" + host + ".service"` (`internal/activator/backend_unit.go:67`) — the `.service` suffix is part of the key, and a literal without it will silently never match. |
| +**Add the import to the test file.** Go imports are file-scoped, and `internal/console/economicspass_test.go` does not import `activator` today — the check in Step 4 looks at `economicspass.go`, which is a different file. Add to the test file's import block: |
| + |
| +```go |
| + "github.com/carlosframework/platform/internal/activator" |
| +``` |
| + |
| +Every other package these tests use is already imported there. |
| + |
| Add a second test for the created-after-snapshot case the fallback protects: |
| ```go |
diff --git a/docs/superpowers/plans/CODEX-FINDINGS-invoice-grade-statements-round3.md b/docs/superpowers/plans/CODEX-FINDINGS-invoice-grade-statements-round3.md| new file mode 100644 |
| index 000000000..0d2bc550c |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CODEX-FINDINGS-invoice-grade-statements-round3.md |
| @@ -0,0 +1,27 @@ |
| +## 1. DISPOSITION TABLE |
| + |
| +Reviewed `165c510` against the real source signatures. This was a static compile review; the read-only environment prevented implementing and compiling the proposed changes. |
| + |
| +Round two actually lists **three** new findings; all three are included below. Plan references use current line numbers. |
| + |
| +| Outstanding item | Disposition | Revised text | |
| +|---|---|---| |
| +| #1: closure race | **ADDRESSED** | Task 3 Step 5b now forces a closing write between GET and PUT. `closeDuringPut.Put` exactly matches `release.Store.Put`; embedding supplies the remaining methods. The changed body produces a different ETag, forcing the intended retry. | |
| +| #5: invalid metrics types and `approxF` | **ADDRESSED** | All four rollup literals now use `HourAgg` and `Agg`. Comparisons use `math.Abs`, already imported. | |
| +| #6: undefined extracted locals | **ADDRESSED** | Task 3 Step 4 explicitly substitutes sweep, fold, fleet and `UpdatedAt` references. The remaining body has its dependencies in scope. | |
| +| #7: ownership test passes through ops fallback | **ADDRESSED** | Mandatory instructions require `acme` and an ops-zero assertion. Unit names include `.service`. The separate producer test checks that `censusPass` writes the expected owner; together the tests cover producer and consumer. Its missing import is reported below. | |
| +| #8: malformed census counted complete | **PARTIAL** | Lines 365–369 decode before counting, matching the fold. The requested malformed-census regression test is still absent. | |
| +| #9: anchors/interfaces | **ADDRESSED** | The remaining day-loop anchor now correctly names `:341`; `dayOwnerFunc` matches the advertised interface. | |
| +| Round-two new #1: fallback unit mismatch | **ADDRESSED** | The sampled unit now includes `.service`, matching the route’s derived name. | |
| +| Round-two new #2: census changes `CoveredDays` | **PARTIAL** | The census arm no longer sets `covered`. The requested census-only regression test is still absent. | |
| +| Round-two new #3: closure test omitted from commit | **ADDRESSED** | Task 3’s `git add` includes `internal/usage/passes_test.go`. | |
| + |
| +## 2. NEW findings only |
| + |
| +**[P2] Task 2 omits the test file’s required `activator` import.** |
| + |
| +[Plan line 530](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/pricing-plans-spec/docs/superpowers/plans/2026-09-08-invoice-grade-statements.md:530) calls `activator.UnitName` in `TestCensusPassRecordsUnitOwners`, but [economicspass_test.go](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/pricing-plans-spec/internal/console/economicspass_test.go:3) does not import that package. The import instruction at plan lines 648–650 checks only `economicspass.go`, where it already exists. Go imports are file-scoped, so following that instruction leaves `undefined: activator`. |
| + |
| +Explicitly add `"github.com/carlosframework/platform/internal/activator"` to `internal/console/economicspass_test.go`. |
| + |
| +All other required test imports are already present, including every import needed by `closeDuringPut`. The census test’s signatures, route fields and owner assertion are otherwise valid. **With that import instruction added, the prescribed Go is executable task by task on static review. I found no further execution blockers.** |
| \ No newline at end of file |