feat(cesar): turn-state reducer + sequential effect driver (Phase 0c … - #268
Merged
Conversation
…spike) Phase 0c of the cesar-turn-runtime program: proves the tribunal-mandated shape — KERN `machine` generates the pure throwing transition layer; a TOTAL reducer (attemptTurnStep converts illegal transitions to no-ops) emits declarative effect intents; a promise-tail driver applies events strictly in order. NOT wired into brain.kern yet — Phase 3 migrates the real flags onto this skeleton after the Phase-0 gate re-review. Guarantees pinned by tests (12): - a captured ask can NEVER be barreled past by an auto-continue, and an ask parked during commit is re-surfaced at `committed` (never-lose) - illegal/duplicate events no-op instead of crashing (3-engine review: the first draft called throwing transitions unguarded) - fail is legal from `asking` — an engine error mid-ask surfaces the real reason instead of throwing - awaiting dispatch() means THAT event was applied, including for non-tail-owning callers (review: early-resolve bug in the queue+pump draft); a throwing effect becomes engine-errored, never a wedged tail - terminal states absorb zombie chunks from abandoned generators Self-coverage gate shaped the code: no switch statements, no closure try (attemptTurnStep is a module-level fn), no void expression stmts. Resolves the spec's OPEN question: `machine` CAN express the pure transition layer — no KERN-GAP needed. ⚔️ Forged by [Agon](https://github.com/KERNlang/agon) Co-Authored-By: agon (KERN) <292465531+KERN-Agon@users.noreply.github.com>
…d clean kern-guard's undefined-reference rule does not register the machine primitive's DERIVED codegen names (per-transition fns + <Machine>StateError), so the reducer's references to them failed CI despite compiling and testing green (KERN-GAP: review/undefined-reference should learn machine-derived bindings). Split the file: turn-state.kern keeps the declarative layer (machine + TurnEvent/TurnEffect unions + TurnSnapshot), the new turn-reducer.kern holds initialTurnSnapshot/attemptTurnStep/reduceTurn/ TurnDriver and imports the machine's generated fns explicitly — every reference is now a guard-visible declaration, and the machine's generated surface is documented at the import site. No behavior change; 12/12 spike tests unchanged, full gate green. ⚔️ Forged by [Agon](https://github.com/KERNlang/agon) Co-Authored-By: agon (KERN) <292465531+KERN-Agon@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…spike)
Phase 0c of the cesar-turn-runtime program: proves the tribunal-mandated shape — KERN
machinegenerates the pure throwing transition layer; a TOTAL reducer (attemptTurnStep converts illegal transitions to no-ops) emits declarative effect intents; a promise-tail driver applies events strictly in order. NOT wired into brain.kern yet — Phase 3 migrates the real flags onto this skeleton after the Phase-0 gate re-review.Guarantees pinned by tests (12):
committed(never-lose)asking— an engine error mid-ask surfaces the real reason instead of throwingSelf-coverage gate shaped the code: no switch statements, no closure try (attemptTurnStep is a module-level fn), no void expression stmts.
Resolves the spec's OPEN question:
machineCAN express the pure transition layer — no KERN-GAP needed.⚔️ Forged by Agon