config: migrate completion + behavior (incl. the migrate-into-CREG sub-pattern)#361
Merged
Conversation
Bind the four struct-backed completion.* keys -- enabled and case_sensitive (bool), match_mode (enum, via a creg_enum_pair_t table), threshold (int) -- to their config.completion_* cells, delete completion_sync_to/from_runtime, remove the migrated keys from the legacy config_options[] table, and drop the now-dead completion_match_mode enum tables. completion.chain_directories and completion.menu_shadow_ghost are read straight from the registry (no runtime cell) and were already binding-free; completion.show_all and completion.hints stay in the legacy table (not registry-backed). Section hooks NULL. The keys resolve through the registry: config set lands in SESSION (threshold 80 survives), the lush=fuzzy / others=prefix per-mode default applies via the MODE layer, and config explain shows the provenance stack. Full suite green.
…yers Bind behavior.auto_cd, behavior.spell_correction, and behavior.confirm_exit (the three behavior.* keys that have a CREG section entry) to their config struct cells, delete behavior_sync_to/from_runtime, and remove the three keys from the legacy config_options[] table. The many other behavior.* keys (autocorrect_*, tab_width, the loop-failure pair, ...) live only in the legacy table and migrate into the registry later. Section hooks NULL. config set lands in SESSION and config explain shows the provenance; the keys remain visible in config show via the registry-aware section printer. Full suite green.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Move the six config-struct-backed behavior limit keys -- tab_width, brace_expansion_max, regex_pattern_max, path_negative_cache_ttl_ms, loop_failure_streak, loop_failure_seconds -- from the legacy config_options[] table INTO the CREG registry: register them in behavior_options[] with their defaults, bind each to its config.* int cell, and remove the legacy rows. Unlike the keys migrated so far (already in CREG, only bound), these were legacy-only -- this is the migrate-into-CREG sub-pattern the bulk of the remaining legacy keys need. tab_width is read in display hot paths; the binding keeps config.tab_width the plain int the renderer reads, with the registry as its sole writer. The keys gain layering, provenance (config explain), and discoverability (config show), and config set lands in SESSION. Full suite green, so the limit consumers still read correct values.
Move the seven config-struct-backed behavior.autocorrect_* keys (max_suggestions, threshold [int]; interactive, learn_history, builtins, external, case_sensitive [bool]) from the legacy config_options[] table into the CREG registry: register them in behavior_options[], bind each to its config.autocorrect_* cell, and remove the legacy rows. The autocorrect engine (executor.c, init.c) keeps reading the same config.* fields; the registry is now their sole writer. With this, every config-struct-backed behavior key is on the registry. Only the confirmed-dead behavior keys (no_word_expand, multiline_mode, color_scheme, colors_enabled, verbose_errors, debug_mode) remain in the legacy table, for a separate removal. Full suite green.
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.
Summary
More strangler steps of the configuration nervous system, including the first migrate-into-CREG sub-pattern.
enabled,case_sensitive,match_modeenum,thresholdint); deletecompletion_sync_*and the dead enum tables. (chain_directories/menu_shadow_ghostare registry-direct;show_all/hintsstay legacy.)auto_cd,spell_correction,confirm_exit); deletebehavior_sync_*.tab_width,brace_expansion_max,regex_pattern_max,path_negative_cache_ttl_ms,loop_failure_streak,loop_failure_seconds) are added to CREG and bound, then removed from the legacy table. Unlike 1-2 (already in CREG, just bound), these were legacy-only — proving the pattern the bulk of remaining keys need.tab_widthstays the plain int the renderer reads; the registry becomes its sole writer.All keys now resolve through the registry:
config set→ SESSION layer (survives mode switch),config explainprovenance, completeconfig show.Verification
meson test: 156/156, zero warnings (sotab_width/ limit consumers still read correct values).config set completion.threshold 80/behavior.tab_width 8→ SESSION (confirmed viaconfig explain).Note on
shell(next, separately)Investigated
shelland confirmed it is the architectural special case, not a quick migration:shell_optsis the executor's hot-path truth andset -o/setoptmutate it directly, so foldingshell.*into the binding+layer model correctly requires routingset -o/setoptwrites through the registry (a careful, riskier change). It gets its own dedicated PR with that reconciliation designed first, perdocs/development/CONFIG_NERVOUS_SYSTEM.md.🤖 Generated with Claude Code