fix(feedback): keep payload in feedback event

This commit is contained in:
Turtle
2026-07-29 21:33:53 +08:00
parent 0ccd3ed463
commit eb6fa86481
42 changed files with 248 additions and 130 deletions

View File

@@ -1,9 +1,9 @@
/**
* The `plan` projection unit (session-projection RFC's complete example): a
* double-event fold over the session log. `command/run` records named `plan`
* set the wanted target (`off` → false, anything else → true); `plan/mode`
* commits and clears it; `view` derives `{ active, pending }` where pending
* is true only while an outstanding selection differs from the logged state.
* with recorded input set the wanted target (`off` → false, anything else
* → true); `plan/mode` commits and clears it. `view` reports pending only
* while an outstanding selection differs from the logged state.
* Pending is thereby a pure replay quantity — a cold fold answers it without
* the service's in-memory intent. Composition without plan-mode has no `plan`
* key; unloading the fiber removes it (HMR safety).
@@ -88,6 +88,11 @@ describe('plan projection unit', () => {
commandId: CommandId('other-1'), name: 'compact', args: '', source: { kind: 'user' },
})
expect(bench.values().plan).toEqual({ active: true, pending: false })
// A command lifecycle with omitted input carries no plan selection.
bench.session.append('command/run', {
commandId: CommandId('plan-no-input'), name: 'plan', source: { kind: 'user' },
})
expect(bench.values().plan).toEqual({ active: true, pending: false })
runPlanCommand(bench.session, ' off', 1)
expect(bench.values().plan).toEqual({ active: true, pending: true })
commitPlanMode(bench.session, false, 1)