console: test a mixed platform and fleet record set (#875)
Astra review of 15bae871 found no bugs and named this coverage gap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/console/policysize_test.go+21 −0
CI passed — run details
Intent
<task-notification> <task-id>bo2lr84ts</task-id> <tool-use-id>toolu_01AawJdejPDsQLr4e2tD94hM</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/72128d15-58b8-452f-9f7e-8e864e8854d2/tasks/bo2lr84ts.output</output-file> <status>failed</status> <summary>Background command "Run Astra review of the #875 commit" failed with exit code 1</summary> </task-notification>
<task-notification> <task-id>bsymjrato</task-id> <tool-use-id>toolu_01JVFqQW8TP3Vk8rfXHGTxQY</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/72128d15-58b8-452f-9f7e-8e864e8854d2/tasks/bsymjrato.output</output-file> <status>completed</status> <summary>Background command "Run Astra review with absolute path" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 5.57 g CO₂e (621,094 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on fleet-size-cap-875, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/internal/console/policysize_test.go b/internal/console/policysize_test.go| index adc8a6c6f..12a69a137 100644 |
| --- a/internal/console/policysize_test.go |
| +++ b/internal/console/policysize_test.go |
| @@ -539,3 +539,24 @@ func TestPolicyDoorSizesAFleetPlacedAppAgainstItsFleet(t *testing.T) { |
| t.Fatalf("xlarge placed on classic = %d %s, want 200", st, out) |
| } |
| } |
| + |
| +// One platform record among fleet-placed ones keeps the platform boxes it |
| +// may land on and every fleet of the account in the check. |
| +func TestSizeChecksMixedRecordsAgainstBothPlatformAndFleets(t *testing.T) { |
| + t.Parallel() |
| + fx, acct := sizeFx(t) |
| + putSizeReport(t, fx.rel, "annie", "", time.Now(), nil) |
| + putSizeEdges(t, fx.rel, "annie", 3847, 0, shopHost) |
| + sizeFleet(t, fx, "classic", fx.sqid, "box-1") |
| + sizeFleet(t, fx, "other", fx.sqid, "bo-1") |
| + recs := []provision.Record{ |
| + sizeRecord(t, fx.rel, fx.sqid, "shop", shopHost, ""), |
| + sizeRecord(t, fx.rel, fx.sqid, "shop", "shop-b.example.com", registry.PlacementTarget("classic")), |
| + } |
| + |
| + boxes, complete, err := fx.srv.sizeBoxes(context.Background(), acct, recs, nil, "") |
| + want := []sizeBox{{Box: "annie", TotalMiB: 3847}, {Box: "bo-1", fleet: "other"}, {Box: "box-1", fleet: "classic"}} |
| + if err != nil || !complete || !reflect.DeepEqual(noReports(boxes), want) { |
| + t.Fatalf("sizeBoxes = %+v, %v, %v, want %+v complete", boxes, complete, err, want) |
| + } |
| +} |