feat(cost): project OpenCost namespace allocations - #283
Conversation
Normalize one bounded, already-authorized namespace allocation response into deterministic USD cost facts. Fail closed on ambiguous identity, query, window, decimal, or whole-response state without adding transport or mutation. GSTACK-Checkpoint: 2026-07-18/e13-opencost-namespace-costs#1 Signed-off-by: Gnani Rahul Nutakki <gnani.nutakki@gmail.com>
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAdds an offline OpenCost namespace allocation projector with an exact USD protocol, strict response validation, deterministic ChangesOpenCost namespace cost facts
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant ProjectNamespaceCosts
participant OpenCostAllocationResponse
participant fleet_GraphFact
Caller->>ProjectNamespaceCosts: provide trusted query and authorized response
ProjectNamespaceCosts->>OpenCostAllocationResponse: decode and validate allocation envelope
OpenCostAllocationResponse-->>ProjectNamespaceCosts: validated namespace rows and USD components
ProjectNamespaceCosts->>fleet_GraphFact: construct deterministic cost facts
fleet_GraphFact-->>Caller: validated facts or atomic error
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
FactCost/LensTelemetryfacts attached to exact cluster and Kubernetes namespace identityCloses #282. Progresses #31 without claiming F13.1 or E13 complete.
Contract and non-goals
The trusted caller supplies one already-authorized
/allocationresponse for an explicit UTC window,aggregate=namespace,step=window, and disabled filter, accumulation, idle, sharing, proportional-asset, and aggregated-metadata options. OpenCost's allocation JSON does not prove currency, so this first protocol requires an explicit USD assertion and rejects every other unit.This PR adds no HTTP client, discovery, credentials, persistence, billing, metering, recommendations, optimization, mutation, Hub/team rollup, currency conversion, freshness objective, GPU utilization/efficiency, DCGM, or MIG claim. The current CLI and Hub do not fetch or display these facts.
Security, reliability, and cost
Verification
go test -race -count=1 -cover ./internal/connector/opencost— pass, 93.2%make ci— pass; zero lint findings and no reachable vulnerabilitiesmake e2e-isolation— pass; PostgreSQL 18.4 forced RLS plus two 50,000-execution workspace fuzzersmake release-check— pass; two reproducible four-platform snapshots, SPDX SBOMs, Homebrew output, and amd64/arm64 distroless OCI layoutmake e2e-kind— pass in 236.706s on pinned Kubernetes 1.36.1; clean teardownCommit integrity
c7c1c3b24c15fafab41d49876d3c9badc84762eadf28654b87ecfa1e491901ba8a3d718ba0825a49GSTACK-Checkpoint: 2026-07-18/e13-opencost-namespace-costs#1Documentation
Summary by CodeRabbit
New Features
Bug Fixes
Documentation