Uh oh!
There was an error while loading. Please reload this page.
refactor(core): make TurnOrigin single-authority - #3096
Conversation
Move the shared TurnOrigin type and decoder into a leaf module and use it from stored-message and RuntimeEvent decoding. Generated-by: Codex
📝 WalkthroughSummaryThis PR makes The shared decoder supports all existing origin variants. It normalizes This change extends the existing contract through one leaf module. It does not create a parallel decoding path. The solution is the smallest coherent change because it removes duplicate schemas and helpers while preserving public type exports and existing behavior. The focused tests cover all origin variants, strict shape validation, and Automation normalization. The deleted local decoders and duplicate type definitions can remain deleted without reducing regression coverage. No UI changes are included. The current diff indicates no direct security, licensing, release, or governance change. The Review-relevant risksThe public The person performing the merge must review the final diff. A maintainer makes the final determination. WalkthroughThe PR centralizes ChangesTurnOrigin centralization
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk:⚪ Minimal · up to The change centralizes TurnOrigin decoding without evidence of a user-facing regression; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a82144f4-423c-43e5-85ab-91dcbef6ceb8
📒 Files selected for processing (5)
packages/core/src/__tests__/runtime-event.test.tspackages/core/src/runtime-event.tspackages/core/src/runtime-inputs.tspackages/core/src/session.tspackages/core/src/turn-origin.ts
Uh oh!
There was an error while loading. Please reload this page.
Astro-Han
left a comment
There was a problem hiding this comment.
Reviewed against #3083.
One type and one decoder now live in turn-origin.ts. session.ts and runtime-event.ts both call it, including the automation → legacy_automation normalization. Extra fields and unknown kinds are still rejected. The runtime-inputs.ts type re-export has to stay: packages/runtime/src/runtime-runner.ts imports TurnOrigin from @maka/core/runtime-inputs, and there is no root or turn-origin subpath.
The old session decoder returned the input object for the three non-automation kinds; the new one returns a fresh object. Callers load JSON, so that is not observable.
Non-blocking: the new shares one decoder across all TurnOrigin variants case in runtime-event.test.ts repeats the automation normalization already pinned by decodeStoredMessage / decodeRuntimeEvent. The scheduled_task / goal / agent_graph round-trips and the extra-field reject are the new coverage; those would sit more naturally in turn-origin.test.ts.
Approve.
AI-assisted review: Grok 4.6 drafted the first pass. A second pass on opencode-go/deepseek-v4-flash:max compared the old and new decoders variant by variant and confirmed no second decoder remains. I read the full diff, confirmed on the PR branch that decodeMessageOrigin and the four *_ORIGIN_SHAPE helpers are gone, and checked the runtime-inputs consumer. Unverified by me: I did not rerun @maka/core tests.
Astro-Han
commented
Aug 16, 2026
Fast path: one leaf module now owns the TurnOrigin type and decoder; session and runtime-event decoding already agreed, including I reviewed the final diff and am merging on that basis. Human contributor of record for this review: Astro-Han. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Make
TurnOrigina single-authority core contract. The shared type and decoder now live in a leaf module;session.tsandruntime-event.tsuse that decoder, whileruntime-inputs.tspreserves its existing type export. Releasedautomationorigins continue to normalize tolegacy_automation.Fixes#3083
Verification
npm --workspace @maka/core testpassed: 545 tests.npm --workspace @maka/core run typecheckpassed.npm run buildpassed.npm run typecheckpassed.npm run lintpassed.npm run format:checkpassed.npx knip --workspace apps/desktop --workspace packages/uipassed.AI use
Tool(s) and scope: Codex performed the implementation, test additions, verification, and code review. The commit includes the required
Generated-by: Codextrailer.Checklist
Does this PR entail a change in behavior?