feat: ingest State Hub session tokens without booking them
Store mixed measured/estimated/superseded aggregates as session-token evidence. Map kinds onto the evidence-basis vocabulary, keep unknown months unknown, and refuse to post the snapshot as booked spend or resource-control usage.
This commit is contained in:
parent
22b21be552
commit
d343888a41
10 changed files with 578 additions and 1 deletions
60
tests/fixtures/session-tokens-2026-08.json
vendored
Normal file
60
tests/fixtures/session-tokens-2026-08.json
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"schema_version": "0.1",
|
||||
"record_type": "session_token_evidence",
|
||||
"record_id": "session-tokens:state-hub:2026-08",
|
||||
"revision_of": null,
|
||||
"source_system": "state-hub",
|
||||
"period_start": "2026-08-01",
|
||||
"period_end": "2026-08-31",
|
||||
"captured_at": "2026-08-15T12:00:00Z",
|
||||
"source_evidence": [
|
||||
"state-hub:/token-events/aggregate/?month=2026-08"
|
||||
],
|
||||
"totals": {
|
||||
"measured": {
|
||||
"tokens_in": 100,
|
||||
"tokens_out": 50,
|
||||
"event_count": 2,
|
||||
"confidence": "1.0"
|
||||
},
|
||||
"allocated": {
|
||||
"tokens_in": 20,
|
||||
"tokens_out": 10,
|
||||
"event_count": 1,
|
||||
"confidence": "0.70",
|
||||
"method": "state-hub-task-share"
|
||||
},
|
||||
"estimated": {
|
||||
"tokens_in": 1000,
|
||||
"tokens_out": 500,
|
||||
"event_count": 3,
|
||||
"confidence": "0.35"
|
||||
},
|
||||
"superseded": {
|
||||
"tokens_in": 800,
|
||||
"tokens_out": 200,
|
||||
"event_count": 1,
|
||||
"confidence": "0.0"
|
||||
}
|
||||
},
|
||||
"associations": [
|
||||
{
|
||||
"scope": "repo",
|
||||
"scope_id": "cce28433-34ce-4ab1-9ab4-4dac9222c802",
|
||||
"label": "fin-hub",
|
||||
"measurement_kind": "measured",
|
||||
"tokens_in": 100,
|
||||
"tokens_out": 50,
|
||||
"event_count": 2
|
||||
},
|
||||
{
|
||||
"scope": "workplan",
|
||||
"scope_id": "88de5e03-a53f-4b62-a0a7-1365756da2d7",
|
||||
"label": "FIN-WP-0007",
|
||||
"measurement_kind": "estimated",
|
||||
"tokens_in": 1000,
|
||||
"tokens_out": 500,
|
||||
"event_count": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue