Conversation
Source commit: trylitmus/litmus@472e2bf1b2ee3469407923dd498a51b08312638b
|
| Filename | Overview |
|---|---|
| contract/openapi.yaml | Adds $sessionend event type and optional LLM telemetry fields to the Event schema; all changes are backwards-compatible and well-documented. |
Entity Relationship Diagram
%%{init: {'theme': 'neutral'}}%%
erDiagram
Event {
string id PK
string session_id
EventType type
string project_id
string prompt_id
string prompt_version
string generation_id
string user_id
string model
string provider
integer input_tokens
integer output_tokens
integer total_tokens
integer duration_ms
integer ttft_ms
number cost
object metadata
string timestamp
}
EventType {
string value
}
IngestRequest {
array events
}
IngestResponse {
integer accepted
}
IngestRequest ||--|{ Event : "contains"
Event }o--|| EventType : "has"
Prompt To Fix All With AI
This is a comment left during a code review.
Path: contract/openapi.yaml
Line: 152-155
Comment:
**`total_tokens` is derivable but not constrained**
The schema accepts `input_tokens`, `output_tokens`, and `total_tokens` as independent optional integers. A client could submit values where `total_tokens != input_tokens + output_tokens` with no schema-level warning. Since this is an ingest API that stores what it receives, inconsistent token totals would silently pollute analytics. Consider adding a note in the description (or a server-side validation rule) that `total_tokens` is expected to equal `input_tokens + output_tokens` when all three are present.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "chore: sync OpenAPI contract from monore..." | Re-trigger Greptile
| total_tokens: | ||
| type: integer | ||
| minimum: 0 | ||
| description: Total tokens (input + output). |
There was a problem hiding this comment.
total_tokens is derivable but not constrained
The schema accepts input_tokens, output_tokens, and total_tokens as independent optional integers. A client could submit values where total_tokens != input_tokens + output_tokens with no schema-level warning. Since this is an ingest API that stores what it receives, inconsistent token totals would silently pollute analytics. Consider adding a note in the description (or a server-side validation rule) that total_tokens is expected to equal input_tokens + output_tokens when all three are present.
Prompt To Fix With AI
This is a comment left during a code review.
Path: contract/openapi.yaml
Line: 152-155
Comment:
**`total_tokens` is derivable but not constrained**
The schema accepts `input_tokens`, `output_tokens`, and `total_tokens` as independent optional integers. A client could submit values where `total_tokens != input_tokens + output_tokens` with no schema-level warning. Since this is an ingest API that stores what it receives, inconsistent token totals would silently pollute analytics. Consider adding a note in the description (or a server-side validation rule) that `total_tokens` is expected to equal `input_tokens + output_tokens` when all three are present.
How can I resolve this? If you propose a fix, please make it concise.
Automated sync of `contract/openapi.yaml` from the monorepo.
Source commit: trylitmus/litmus@472e2bf1b2ee3469407923dd498a51b08312638b
Review the diff, then merge. If the SDK has codegen (e.g. `pnpm generate`),
run it after merging to update generated types.