Skip to content

config: migrate completion + behavior (incl. the migrate-into-CREG sub-pattern)#361

Merged
berrym merged 4 commits into
masterfrom
config/migrate-completion
Jun 25, 2026
Merged

config: migrate completion + behavior (incl. the migrate-into-CREG sub-pattern)#361
berrym merged 4 commits into
masterfrom
config/migrate-completion

Conversation

@berrym

@berrym berrym commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

More strangler steps of the configuration nervous system, including the first migrate-into-CREG sub-pattern.

  1. completion — bind the four struct-backed keys (enabled, case_sensitive, match_mode enum, threshold int); delete completion_sync_* and the dead enum tables. (chain_directories/menu_shadow_ghost are registry-direct; show_all/hints stay legacy.)
  2. behavior (registry keys) — bind the three keys that have a CREG entry (auto_cd, spell_correction, confirm_exit); delete behavior_sync_*.
  3. behavior (migrate-into-CREG) — the six config-struct-backed legacy-only limit keys (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_width stays 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 explain provenance, complete config show.

Verification

  • meson test: 156/156, zero warnings (so tab_width / limit consumers still read correct values).
  • config set completion.threshold 80 / behavior.tab_width 8 → SESSION (confirmed via config explain).

Note on shell (next, separately)

Investigated shell and confirmed it is the architectural special case, not a quick migration: shell_opts is the executor's hot-path truth and set -o/setopt mutate it directly, so folding shell.* into the binding+layer model correctly requires routing set -o/setopt writes through the registry (a careful, riskier change). It gets its own dedicated PR with that reconciliation designed first, per docs/development/CONFIG_NERVOUS_SYSTEM.md.

🤖 Generated with Claude Code

berrym added 2 commits June 25, 2026 17:18
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

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

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.
@berrym berrym changed the title config: migrate the completion and behavior sections to bindings + layers config: migrate completion + behavior (incl. the migrate-into-CREG sub-pattern) Jun 25, 2026
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.
@berrym berrym merged commit 07fc4f0 into master Jun 25, 2026
4 checks passed
@berrym berrym deleted the config/migrate-completion branch June 25, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant