Wave 1: total message model — parse totally, destroy nothing #51
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/claude-code-query!51
Loading…
Reference in a new issue
No description provided.
Delete branch "wave-1-core-model"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements ADR 0001 decision 6 (docs/adr/0001-session-is-a-stream-not-turns.md) and proposal §2.1/§4 Wave 1.
What's here
Session.streamscaladocs now state the real contract — shared long-lived queue, out-of-turn emission, mid-turn merge, single-consumer constraint.UnknownMessage(messageType, json)—parseMessageis total;rate_limit_eventand the system subtypes survive as raw JSON instead of vanishing incase _ => None.MessageId(vendoruuid) onAssistantMessage/ResultMessage— the live↔transcript join key.ResultMessagemodels the full wire envelope:origin: Option[ResultOrigin](key-absent ≠ null — the in-turn/out-of-turn discriminator),stopReason,terminalReason,permissionDenials(raw JSON, shape unsampled),apiErrorStatus,timings, andusage: Option[TokenUsage]with real token counts (Map.emptyis dead).AssistantMessage.parentToolUseId— the subagent/sidechain join key — plusmodel.ResultOriginopen enum (TaskNotification/Other(kind)).ControlRequest/ControlRequestBody/ControlResponse) — types only; wiring lands with the Wave 2 Session redesign.TokenUsagemoved tocore.model(shared by stream and log parsers via onefromJsondecoder; counts widened toLong), no alias left behind.Recorded deviations from the proposal snippet
idisOption[MessageId](notMessageId): a required id would destroy wire messages lackinguuid(observed: only 5/22 probe messages carry it), violating decision 6 itself.ResultMessagefields appended afterresultrather than interleaved, so existing constructions keep compiling — how the proposal priced this wave.parseMessage: Json => Message(module parsers wrap inSome); known type with missing required fields degrades toUnknownMessageinstead of vanishing.origin: null(never observed) →Some(Other("null"))— a present key is never conflated with absent.Verification
./mill __.compilewarning-free; unit tests 424 → 451+ passing (newJsonParserTotalityTestmatrix, property generators extended over the new fields incl. populatedpermission_denials,UnknownMessage,ControlResponse); full./mill __.itest730/730 against the real CLI. Reviewed by four dimension reviewers with adversarial verification; all confirmed findings fixed in the last four commits.🤖 Generated with Claude Code
Superseded by the consolidated PR #53 (single review over the full ADR 0001 implementation); the branch and its per-wave review history remain.
Pull request closed