Cost/session layering: ledger snapshot logic in the HTTP layer; import edges point both ways
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Start by reading core/sessionapi/usage.go:328 ledgerSnapshotFor, its satellites around :541-626, and the existing ledger query helpers in cost/ledger/query.go. Move the snapshot logic into cost/ledger as Writer.Snapshot, then check the usage.CostSum use in core/session/store.go:856-1222 and move that type beside event.Micros in core/cost/event; finally move the session.Recorder assertion at writer.go:335 into a test file. Done when those three imports no longer form the layering edges and the affected Go test packages pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What
Three layering problems around the session/cost boundary:
-
The ledger snapshot is built in the HTTP layer.
core/sessionapi/usage.go:328ledgerSnapshotFor(~150 lines) plus its satellites (degradedFrom,bucketSecondsFor,servedSpan,resolutionSpan,:541-626) are pure cost-domain logic —ledger.Fold, saturation flags, caveats→degraded mapping, retention disclosure — with nothing HTTP in them. MeanwhileFold/FilterAgent/series helpers already live incost/ledger/query.go. As a result the ledger can only serve a snapshot through the endpoint, not programmatically. -
session → cost/usageexists for one type. The store's summary block (core/session/store.go:856-1222) imports the 4k-line usage package for exactlyusage.CostSum(a ~45-line saturating-add type that depends on nothing). It belongs besideevent.Microsincore/cost/event, which session already imports. -
cost/ledger → sessionexists for a compile-time pin.writer.go:335's production import exists solely forvar _ session.Recorder = (*Writer)(nil)— an assertion that belongs in a_test.go.
Fix
Move ledgerSnapshotFor's body into cost/ledger (e.g. Writer.Snapshot(ctx, spec, group, agent)); move CostSum to cost/event; move the Recorder pin to a test file. Three one-file moves, and the session/cost boundary becomes one-directional.
Found in the 2026-10-29 structural audit of code organization.
- Lingua principale
- Go
- Stelle
- 21
- Fork
- 43
- Merge medio
- 13h 8m
- PR unite (30g)
- 267
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rossoctl/cortex
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
UI shows costs for all sessions even when drilled into a sessionForse già presa @esnible l’ha presa 16 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
rossoctl/cortex#1116 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 Più di una settimana Idoneità per principianti 18/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rossoctl/cortex
Issue simili
-
bug from-studio
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
esengine/DeepSeek-Reasonix#14868 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
project-zot/zot#4636 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
keyxmakerx/Chronicle#1911 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
eugenioenko/ttt#1293 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
needs/area needs/kind needs/priority
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
I maintainer di solito rispondono entro 1 giorno