Repository navigation
command: add searchable actions with persistent runtime keybindings - #4907
Conversation
Actions give each operation a stable namespaced id, label, section, context and one invoke callable that keys, widget clicks, Lua and invokeAction all share. An action may have no key, several chords, or a hold. The registry lives in CommandManager and gives each chord ordinary dispatch rows that it rebinds in place or parks, so text capture, modifier specificity and start/end pairing behave as for createCommand, and existing CommandIds keep firing. KeymapStore persists per-creation overrides to a versioned text file under IR_PREFS_DIR or the user data dir, written by atomic rename. It keeps unknown ids across round trips and never overwrites a file it could not parse. Scripted runs touch it only under IR_PREFS_DIR. The Actions window searches by name or key, runs, assigns, adds, removes and resets chords, and resolves conflicts by replace or cancel. bindAction gives a control a badge that follows its resolved chord. lua_widgets registers an action from Lua and binds a button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Perf gateHead host slug: perf comparison: 0dd14fe → 108f715-cibaseline: host calibration
thresholds: regress ≥ 10%, improve ≥ 5% voxel cull effectiveness
frame timing (ms)
GPU frame timing (ms; separate from stage samples)
GPU stage timing (avg ms per sampled invocation)
top CPU systems by avg ms (head)
|
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
258.205 → 247.160 (-4.3%) |
| RENDER | ComputeLightVolume |
34.149 → 32.305 (-5.4%) ↓ |
| RENDER | CanvasToFramebuffer |
17.800 → 17.025 (-4.4%) |
| RENDER | BakeSunShadowMap |
10.418 → 9.575 (-8.1%) ↓ |
| RENDER | ComputeSunShadow |
8.107 → 7.959 (-1.8%) |
| UPDATE | PropagateTransform |
4.805 → 4.687 (-2.5%) |
| UPDATE | FogRevealEval |
4.286 → 4.229 (-1.3%) |
| RENDER | ComputeVoxelAO |
4.093 → 4.044 (-1.2%) |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1032.022 → 1028.212 (-0.4%) |
| RENDER | ComputeLightVolume |
29.065 → 29.555 (+1.7%) |
| RENDER | ComputeSunShadow |
22.141 → 21.858 (-1.3%) |
| RENDER | CanvasToFramebuffer |
16.550 → 16.298 (-1.5%) |
| RENDER | ComputeVoxelAO |
9.643 → 9.512 (-1.4%) |
| RENDER | BakeSunShadowMap |
9.093 → 8.784 (-3.4%) |
| RENDER | LightingToTrixel |
8.765 → 8.395 (-4.2%) |
| UPDATE | PropagateTransform |
4.763 → 4.798 (+0.7%) |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
289.372 → 303.432 (+4.9%) |
| RENDER | ComputeSunShadow |
55.321 → 56.651 (+2.4%) |
| RENDER | LightingToTrixel |
36.045 → 39.654 (+10.0%) ⚠ |
| RENDER | ComputeLightVolume |
32.823 → 33.764 (+2.9%) |
| RENDER | BakeSunShadowMap |
22.611 → 23.705 (+4.8%) |
| RENDER | CanvasToFramebuffer |
17.555 → 18.020 (+2.6%) |
| RENDER | FogToTrixel |
7.071 → 7.429 (+5.1%) |
| UPDATE | PropagateTransform |
6.047 → 6.406 (+5.9%) |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1464.334 → 1463.141 (-0.1%) |
| RENDER | ComputeLightVolume |
29.522 → 29.716 (+0.7%) |
| RENDER | ComputeSunShadow |
18.700 → 18.740 (+0.2%) |
| RENDER | CanvasToFramebuffer |
16.419 → 16.482 (+0.4%) |
| RENDER | BakeSunShadowMap |
8.826 → 8.993 (+1.9%) |
| RENDER | ComputeVoxelAO |
7.817 → 7.858 (+0.5%) |
| RENDER | LightingToTrixel |
6.778 → 6.938 (+2.4%) |
| UPDATE | PropagateTransform |
6.172 → 6.272 (+1.6%) |
jakildev
left a comment
There was a problem hiding this comment.
Review — command: add searchable actions with persistent runtime keybindings
Verdict: needs-fix
The registry, keymap, Lua, and widget surfaces are coherently split, and the tests cover the main rebind/persistence flow well. Two multi-chord state transitions can still make one physical input produce the wrong action lifetime, so this should come back after those cases are pinned and fixed.
Needs-fix
engine/command/src/action_registry.cpp:562— replacing a chord with another chord already present on the same action can leave duplicate rows. For example,[K, J, L]withreplaceChord(K, L)becomes[L, J, L];std::uniqueonly removes adjacent duplicates, and the same action is excluded fromfindConflicts. The Actions window exposes this directly through ASSIGN, after which pressingLinvokes the operation twice and the duplicate is persisted. Detect an already-bound target or erase duplicates across the full vector, and add a regression with a non-adjacent existing target.engine/command/src/action_registry.cpp:299— a hold with multiple chords has one action-wideholding_bit but one latch-release row per chord. IfKstarts the hold, thenJis pressed and released whileKremains down, theJpress is ignored but its release callsendHold, prematurely ending the hold started byK. Track which chord(s) admitted the hold (or otherwise define/ref-count multi-chord hold ownership), and cover the overlapping press/release sequence.
Praise
- Reusing parked command rows preserves
CommandIdstability and existing capture/specificity behavior without adding a per-frame registry lookup. - The persistence tests explicitly cover reordered registration, missing extensions, protected malformed/newer files, and failed writes.
Validation
- CI at review time: all completed checks passed, including
fleet-testsandperf-gate;linux-buildwas still in progress. - Local
fleet-build --target IrredenEngineTest: passed (fleet-jobs: 20261105T052935Z-build-81536d succeeded exit=0). - Local
fleet-run IrredenEngineTest --gtest_filter='ActionRegistry*:HeldAction*:KeymapStore*': 30/30 passed; neither reported edge case is present in that set.
Test plan the author should run before merge
- Add and run focused action-registry regressions for replacement onto a non-adjacent existing chord and overlapping presses of two chords on one hold action.
- Re-run
fleet-run IrredenEngineTest --gtest_filter='ActionRegistry*:HeldAction*'and the fullIrredenEngineTestsuite.
🤖 Reviewed by Codex gpt-5.6-sol (review-pr skill)
Opus recheck not required (reviewed at opus class).
replaceChord onto a chord the action already holds now drops the replaced chord instead of leaving a non-adjacent duplicate ([K,J,L] K->L is [J,L], not [L,J,L]), so one press no longer fires the operation twice. A hold now records the chord slots whose press it admitted. A second chord pressed mid-hold joins it, the hold ends on the last admitted release, and a release from a slot the hold never admitted (a press swallowed by capture) no longer ends a hold another chord started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed feedback (head
Validation:
Stacked child #4908 picks this up via the native stack. — worker (pool-1) |
jakildev
left a comment
There was a problem hiding this comment.
Re-review — command: add searchable actions with persistent runtime keybindings
Verdict: approve
Prior-review resolution
- ✅
engine/command/src/action_registry.cpp::replaceChord— replacing onto a non-adjacent chord already bound to the same action now erases the replaced chord, preserves one target binding, and persists the deduplicated list; verified at62f650d58byActionRegistryTest.ReplaceOntoAnotherBoundChordKeepsOneCopy. - ✅
engine/command/src/action_registry.cpp::onPress/onRelease— a hold now records the chord slots whose presses it admitted, remains live until the last admitted release, and ignores releases from slots whose presses capture suppressed; verified at62f650d58by both release orders inHeldActionTest.SecondChordPressedMidHoldJoinsItand byHeldActionTest.ReleaseOfAChordTheHoldNeverAdmittedIsIgnored.
The follow-up commit is limited to those two fixes, their public contract text, and focused regressions. I found no new substantive issue in the delta.
Validation
- Local
fleet-build --target IrredenEngineTest: passed (fleet-jobs: 20261105T061545Z-build-26ff42 succeeded exit=0). - Local focused run: all 3 review regressions passed.
- CI at re-review time: completed format, header, instruction-size, comment-reference, whitespace, and closes checks passed;
linux-build,fleet-tests, andperf-gatewere still pending and are not claimed green here.
Praise
- The regressions cover both release orders and the captured-press edge, which pins the hold-ownership contract rather than only the original failing sequence.
🤖 Reviewed by Codex gpt-5.6-sol (review-pr skill; runtime codex)
Opus recheck not required (reviewed at opus class).
Perf gateHead host slug: perf comparison: fae9b65 → f3b274a-cibaseline: host calibration
thresholds: regress ≥ 10%, improve ≥ 5% voxel cull effectiveness
frame timing (ms)
GPU frame timing (ms; separate from stage samples)
GPU stage timing (avg ms per sampled invocation)
top CPU systems by avg ms (head)
|
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
257.459 → 256.217 (-0.5%) |
| RENDER | ComputeLightVolume |
35.123 → 35.071 (-0.1%) |
| RENDER | CanvasToFramebuffer |
17.567 → 18.218 (+3.7%) |
| RENDER | BakeSunShadowMap |
10.266 → 10.492 (+2.2%) |
| RENDER | ComputeSunShadow |
8.088 → 8.016 (-0.9%) |
| UPDATE | PropagateTransform |
4.778 → 4.845 (+1.4%) |
| UPDATE | FogRevealEval |
4.235 → 4.241 (+0.1%) |
| RENDER | LightingToTrixel |
3.965 → 4.191 (+5.7%) |
target=IRLuaPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1030.235 → 1029.234 (-0.1%) |
| RENDER | ComputeLightVolume |
29.441 → 29.434 (-0.0%) |
| RENDER | ComputeSunShadow |
21.962 → 22.007 (+0.2%) |
| RENDER | CanvasToFramebuffer |
16.233 → 16.511 (+1.7%) |
| RENDER | ComputeVoxelAO |
9.406 → 9.456 (+0.5%) |
| RENDER | BakeSunShadowMap |
8.992 → 8.766 (-2.5%) |
| RENDER | LightingToTrixel |
8.465 → 8.534 (+0.8%) |
| UPDATE | PropagateTransform |
4.339 → 4.567 (+5.3%) |
target=IRPerfGrid,zoom=1,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
299.030 → 296.391 (-0.9%) |
| RENDER | ComputeSunShadow |
60.014 → 58.280 (-2.9%) |
| RENDER | LightingToTrixel |
38.631 → 37.833 (-2.1%) |
| RENDER | ComputeLightVolume |
32.634 → 33.089 (+1.4%) |
| RENDER | BakeSunShadowMap |
23.692 → 23.290 (-1.7%) |
| RENDER | CanvasToFramebuffer |
17.726 → 17.878 (+0.9%) |
| RENDER | FogToTrixel |
7.366 → 7.329 (-0.5%) |
| UPDATE | PropagateTransform |
6.200 → 6.145 (-0.9%) |
target=IRPerfGrid,zoom=4,sub_mode=full,sub_base=1
| pipeline | system | avg ms (base→head) |
|---|---|---|
| RENDER | SingleVoxelToCanvasFirst |
1462.392 → 1460.085 (-0.2%) |
| RENDER | ComputeLightVolume |
30.012 → 29.257 (-2.5%) |
| RENDER | ComputeSunShadow |
18.963 → 19.087 (+0.7%) |
| RENDER | CanvasToFramebuffer |
16.640 → 16.383 (-1.5%) |
| RENDER | BakeSunShadowMap |
9.165 → 8.870 (-3.2%) |
| RENDER | ComputeVoxelAO |
7.862 → 7.695 (-2.1%) |
| RENDER | LightingToTrixel |
7.002 → 6.902 (-1.4%) |
| UPDATE | PropagateTransform |
6.182 → 6.368 (+3.0%) |
|
Cross-host smoke OK on windows (fresh checkout + IRShapeDebug --auto-screenshot 10 — build clean, exit 0, no log warnings). |
Summary
engine/command/include/irreden/command/action_registry.hpp,IRCommand::actions()): each operation has a stable namespaced id, label, section, context and availability, plus oneinvoke_that keys, widget clicks, Lua andIRCommand::invokeActionall call. An action can have no chord, several chords, or a hold (release_).CommandManagerrows. Rebinding moves them in place and unbinding parks them (inactive rows are skipped), so text capture, modifier specificity and start/end pairing apply unchanged. NoCommandIdis invalidated. Chord masks are exact.replaceChordonto a chord the action already holds drops the replaced chord rather than duplicating the target.adoptNamedCommands(prefix)turns a creation's namedcreateCommandbindings into actions without touching their call sites. Each adopted chord keeps its body and blocked mask; start/end pairs stay plain.globalaction overlaps every context). Policy isREJECTorREPLACE. A plain command row that would fire alongside the chord cannot be displaced.keymap_store.hpp,IRCommand::keymap()): versioned per-creation overrides live at<IR_PREFS_DIR or userDataDir>/keymaps/<creation>.keymap, separate from documents.IR_PREFS_DIR.engine/prefabs/irreden/render/):Widget::bindActiongives a control a keyless hotkey whose Alt badge is the resolved chord;WIDGET_SYNC_ACTION_HINTSrefreshes it.registerFocusAction/registerStepActioncover value fields.actions_window.hpp,System<ACTIONS_WINDOW>) searches by name or key, runs, assigns, adds, removes and resets chords, and settles a conflict with REPLACE / CANCEL.IRCommand.registerAction{...},invokeAction,add/replace/remove/clearActionKey(s)returningok, IRCommand.BindStatus, conflicts,restoreActionDefaults,actionKeys,findAction,searchActions,findActionConflicts,setActionContextActive, andIRGui.bindAction/actionHint.lua_widgetsregisterslua_widgets.pulsefrom Lua with key J and binds a PULSE button. The key and the click run the same function, and the badge reads J.docs/design/command-actions-keymap.md; contract summary inengine/command/CLAUDE.md§"Actions and keymaps".The voxel editor's adoption (key commands as actions, toolbar/workspace/part-size controls, Actions window,
actions_workflow+actions_restartGUI replay) is the stacked PR #4908, which closes the issue.Test plan
fleet-build --target IrredenEngineTest/IRVoxelEditor/IRLuaWidgetsDemoon this branch alone: clean.fleet-run IrredenEngineTest(full suite, head62f650d58):[ PASSED ] 3617 tests.(3620 run; 3 platform skips:BinaryIO.CloseReportsBufferedOutputFailure,RigFormat.SaveReportsBufferedWriteFailureBeforeEmittingSummary,FogCrossSectionTest.SkippedOnNonOpenGLBackend)action_registry.cpp(negative control) and pass with the fix:ReplaceOntoAnotherBoundChordKeepsOneCopy,SecondChordPressedMidHoldJoinsIt,ReleaseOfAChordTheHoldNeverAdmittedIsIgnored.python3 scripts/gui-verify.py IRLuaWidgetsDemo:37/37 assertions passed(newLUA_ACTION key_runs_lua_action PASS pulses=1 badge=J,click_runs_same_action PASS pulses=2 badge=J;hints_visiblenow counts 4 glyphs with the PULSE badge).python3 scripts/gui-verify.py IRVoxelEditor(standing table, editor unchanged here):42/42 assertions passed.cmake -P cmake/run_header_checks_standalone.cmakeclean (save inventory 207/207);python3 scripts/lint_comment_refs.pyclean;python3 scripts/lint_instruction_size.py --against origin/masteradds no offender (engine/command/CLAUDE.mdat 200/200, the other touched instruction files keep their line counts).Acceptance evidence
IrredenEngineTest. Extend command registry/dispatch tests to verify direct invocation, rebind, unbind, secondary assignment, conflict rejection/replacement and default restore. Prove an old chord stops firing, the assigned chord fires once, and rebind during a held input balances its release.fleet-run IrredenEngineTest --gtest_filter='ActionRegistry*:HeldAction*'IdAndKeyRunTheSameOperation,ReassignMovesDispatchAndIntrospection("the old chord must stop firing", "fires exactly once", registration rows move),ClearSecondChordAndRestoreDefaults,ConflictRejectsThenReplaces,PlainCommandRowCannotBeDisplaced,RebindDuringHoldBalancesTheRelease(one end on rebind, none on the old key's release),ReplaceOntoAnotherBoundChordKeepsOneCopy([K,J,L]K→L is[J,L], L fires once),SecondChordPressedMidHoldJoinsIt,ReleaseOfAChordTheHoldNeverAdmittedIsIgnored: all PASSfleet-run IrredenEngineTest --gtest_filter='KeymapStore*'(each case under its ownIR_PREFS_DIRtemp dir)RoundTripsAcrossReorderedRegistrationAndRestart,MissingExtensionActionSurvivesARoundTrip,MalformedFileKeepsWorkingBindingsAndIsNotOverwritten,NewerVersionIsNotAppliedOrOverwritten,FailedWriteKeepsTheSessionBindings,FailedWriteLeavesThePreviousFile(file bytes unchanged, no.tmpleft): 9/9 PASSIRVoxelEditorGUI replay with layout checks. Search by name and by assigned key, run an unbound action, configure an editor control, invoke its new chord, and capture a matching corner badge. Relaunch against the same temporary preferences and verify dispatch survives.claude/4897-editor-actions-adoptionWidgetActionsTest.WindowSearchesRunsAndSettlesAConflict/CaptureEscapeCancelsAndRemoveAndResetEditKeys/BadgeFollowsTheResolvedChord: PASSfleet-run IrredenEngineTest --gtest_filter='LuaCommand*:LuaWidgetValues*:KeyboardDispatch*:DefaultBinding*:*Hotkey*:WidgetKeyboard*:ActionRegistryTest.ContextsScopeConflictsAndDispatch:ActionRegistryTest.KeyboardCaptureSuppressesActions';gui-verify IRLuaWidgetsDemoLuaActionRunsFromIdAndFromCpp,LuaActionKeyMutatorsReportConflicts,LuaActionAvailabilityAndContexts,BindActionShowsTheActionKeyAsTheBadgePASS; full suite 3617 passed, 3 skipped;lua_widgets_action_key/_clickPASSpulses=1/2 badge=JNotes for reviewer
fleet-pr-overlap --base master→VERDICT: overlap. The only non-clean rows are the codex editor stack's own conflicts with master:getRegistrationGeneration()now also bumps when an action chord changes, not only on append. The help overlay is its only in-tree consumer and only compares it for change.ActionRegistry::adoptNamedCommandskeeps an adopted chord's original blocked mask, so adopted keys behave exactly as before until the user reassigns them. A user-assigned chord uses an exact mask.toLower/containsLower/splitWordshave no shared string-utility home in the tree.writeFileAtomicoverlapsFieldChunkDiskPersistence::saveRegion's inline temp+rename; a sharedengine/utilityhelper would serve both.Refs #4897
🤖 Generated with Claude Code