From 040c98c0a71bead5c30b64ab28c85b0a55e418be Mon Sep 17 00:00:00 2001 From: Rootiest Date: Tue, 18 Aug 2026 16:46:46 -0400 Subject: [PATCH] fix(config-settings,docs): address final whole-branch review findings Bundled fix wave for six findings from the sub-category-granularity whole-branch review: - config-settings: reset in_subcat on Tab/Shift-Tab so up/down keep routing to cur_row instead of freezing on the Sponge/Paths pages after a drill-down - verify-manual: _parsed_components() now delegates to generate_component_registry.collect_components() instead of a lossy dict.update() merge, closing a taxonomy-check blind spot on identity collisions - verify-manual: add test_committed_registry_matches_headers to catch the committed registry drifting from current # COMPONENT headers - build-docs workflow: trigger on conf.d/** and config.fish edits, not just functions/** - __config_settings_draw_subcat: show (Universal)/(Session) in the drill-down title so the persistence scope is visible before toggling - __config_settings_draw / config-settings: mention the Enter sub-category drill-down in the on-screen hint and --help text - generate_component_registry: send the "wrote ..." progress line to stderr so it no longer corrupts --concat's stdout output --- .github/workflows/build-docs.yml | 2 ++ docs/generate_component_registry.py | 2 +- docs/verify-manual.py | 21 +++++++++++++++----- functions/__config_settings_draw.fish | 2 +- functions/__config_settings_draw_subcat.fish | 16 ++++++++++++--- functions/config-settings.fish | 15 +++++++++++--- 6 files changed, 45 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 8134284..453a46c 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -11,6 +11,8 @@ on: - "docs/verify-manual.py" - "docs/site/**" - "functions/**" + - "conf.d/**" + - "config.fish" workflow_dispatch: jobs: diff --git a/docs/generate_component_registry.py b/docs/generate_component_registry.py index 2c0b572..60d4381 100644 --- a/docs/generate_component_registry.py +++ b/docs/generate_component_registry.py @@ -105,7 +105,7 @@ def main() -> int: for w in warnings: print(f" WARN {w}", file=sys.stderr) OUTPUT.write_text(render(registry)) - print(f"wrote {OUTPUT} ({len(registry)} entries)") + print(f"wrote {OUTPUT} ({len(registry)} entries)", file=sys.stderr) return 0 diff --git a/docs/verify-manual.py b/docs/verify-manual.py index 2963de4..a8675f7 100644 --- a/docs/verify-manual.py +++ b/docs/verify-manual.py @@ -131,11 +131,9 @@ def _parsed_functions() -> dict[str, dict[str, list[str]]]: def _parsed_components() -> dict[str, list[str]]: - repo = Path(__file__).parent.parent - out = mt.parse_components(repo / "functions") - out.update(mt.parse_components(repo / "conf.d")) - out.update(mt.parse_component_file(repo / "config.fish")) - return out + import generate_component_registry as gcr + + return gcr.collect_components() _C0_TAGS = {"always/on", "always/off"} @@ -1123,6 +1121,19 @@ def test_build_manual_regenerates_registry_before_building(): ) +def test_committed_registry_matches_headers(): + """The committed conf.d/__fish_config_op_registry.fish must match what + generate_component_registry.py would produce right now from the current + `# COMPONENT` headers -- otherwise CI has nothing catching drift.""" + import generate_component_registry as gcr + + registry, _ = gcr.build_registry(gcr.collect_components()) + assert gcr.render(registry) == gcr.OUTPUT.read_text(), ( + "conf.d/__fish_config_op_registry.fish is stale — run " + "__fish_config_op_registry_rebuild" + ) + + TESTS = [v for k, v in sorted(globals().items()) if k.startswith("test_")] diff --git a/functions/__config_settings_draw.fish b/functions/__config_settings_draw.fish index 077081b..1d28444 100644 --- a/functions/__config_settings_draw.fish +++ b/functions/__config_settings_draw.fish @@ -182,7 +182,7 @@ function __config_settings_draw # ── Keybind hint ────────────────────────────────────────────────────── # string pad is width-aware (arrows count as 1 column) - set -l hint " ↑↓/kj move ←→/hl set Tab page q quit" + set -l hint " ↑↓/kj move ←→/hl set Enter sub-cats Tab pg q quit" printf '%s│%s%s%s│\n' $p $c_dim (string pad -r -w $iw -- $hint) $c_reset # ── Bottom border ───────────────────────────────────────────────────── diff --git a/functions/__config_settings_draw_subcat.fish b/functions/__config_settings_draw_subcat.fish index 30eddce..c7dccd3 100644 --- a/functions/__config_settings_draw_subcat.fish +++ b/functions/__config_settings_draw_subcat.fish @@ -71,9 +71,19 @@ function __config_settings_draw_subcat set -l desc_w (math $iw - 34) set -l cat_label (string replace -r '^__fish_config_op_' '' -- $category_var) - set -l title_dashes (math $iw - (string length -- $cat_label) - 19) - printf '%s┌─%s Sub-categories: %s %s┐\n' \ - $p $c_head "$cat_label$c_reset" (string repeat -n (math "max(0, $title_dashes)") '─') + # Scope indicator: toggling a row on this page writes -U (Universal, + # persistent) or -g (Session, this-shell-only) -- the title must say + # which, since it isn't otherwise visible anywhere on the page. + set -l scope_label Universal + test "$cur_scope" = session; and set scope_label Session + # Title layout is "┌─ Sub-categories: