-
[NA] [BE] New CIPX AI Spend data model (#7204)
发布于
2026-06-22 19:51:52 +00:00 Rewrite the AI Spend BE reader for the cipx v2 wire schema:
- Composition/breakdown queries fan out cipx.blocks[] per LLM-call span;
per-call cipx.call.usage tokens are allocated to blocks by chars-share
within each (side, cache_status) tier. Per-call residual rolls into the
unattributed lane. - Identity, repository, and leaderboard counts read from
cipx.session.* on traces (SNORT Item 1). - Trace reads gate on cipx.session.schema_version >= 2.
- tool_io blocks split to built_in_tools vs mcp_servers based on
tool_server presence (SNORT Item 4); category-to-lane projection lives
in one source-of-truth map with both the SQL CASE and a Java helper
rendered from it. - Output lanes come from the same blocks[] fan-out (side='output'),
replacing the spans.name-prefix inference. - /recommendations endpoint deleted (FE no longer calls it; its own
engine in useClaudeCodeRecommendations.ts is richer).
Tests: rewrite AiSpendResourceTest with cipx v2 fixtures (cipx.session
on traces, cipx.call.usage + cipx.blocks[] on LLM spans). Add
AiSpendQueryBuilderTest (lane projection, tool_io split, unattributed
fallback) and AiSpendMapperTest (tier pivoting, residual merge,
per-model split, other rollup). 57 tests pass.End-to-end verified against real cipx v2 data replayed from
org-managed-cc-test/cipx-e2e-test into a local Opik.下载附件
- Composition/breakdown queries fan out cipx.blocks[] per LLM-call span;