Skip to content

0.17 phase 4 / PR A: docs/config drift battery + .zshrc preservation#147

Open
StanMarek wants to merge 5 commits into
masterfrom
feat/0.17-docs-drift-and-zshrc-preservation
Open

0.17 phase 4 / PR A: docs/config drift battery + .zshrc preservation#147
StanMarek wants to merge 5 commits into
masterfrom
feat/0.17-docs-drift-and-zshrc-preservation

Conversation

@StanMarek
Copy link
Copy Markdown
Owner

Summary

  • Adds gc_config::all_field_paths() catalog (Task 1).
  • New drift tests pin install template, TUI editor, and CONFIGURATION.md
    against the GhostConfig schema (Task 2; in-crate per binary-crate
    constraint).
  • Install template backfilled with popup.render_block_ms,
    suggest.providers.js_runtime, full [suggest.spec_cache], [paths],
    and experimental.brew_search_cap (Task 3).
  • install.rs:518 content.trim() replaced with a splice helper that
    preserves user .zshrc bytes outside managed blocks (Task 4).
  • CONFIGURATION.md backfilled for every field caught by the drift test;
    hot-reload table audited against ReloadBehavior enum (Task 8).
  • render_block_ms left as Live — rendering-polish (Overlay rendering polish: one DECSET 2026 frame per overlay update #138) wired it
    through update_config, so docs/editor are now truthful.

Test plan

  • cargo test --workspace green.
  • All four drift tests green: install template, TUI editor, docs
    field-level, docs section smoke.
  • install_preserves_user_blank_lines_around_managed_blocks exercises
    install + reinstall, asserts no blank-line accumulation.
  • cargo run -- install --dry-run shows every schema key in the
    generated template.

Notes for the reviewer

Verified state corrections vs. the 2026-05-16 plan snapshot:

  • content.trim() was actually at install.rs:518, not the plan's :505 reference.
  • render_block_ms IS wired through InputHandler::update_config (see
    crates/gc-pty/src/handler.rs:763 — 13th positional parameter). Task 8
    Steps 3-5 (the demotion logic in the plan) are therefore intentionally
    skipped; docs + editor now match reality.
  • Plan's keybindings.* (6 fields) and theme.* (10 fields) listings had
    stale names; gc_config::all_field_paths() uses the actual struct field
    names (accept_and_enter, navigate_up, navigate_down, trigger,
    preset, feedback_loading/empty/error, etc.) — 48 total leaf paths.

Implementation deviation in Task 4: The plan's splice_managed_blocks +
replace_or_append_block helpers would have placed the init block at the
bottom of a fresh .zshrc (no prepend semantics in replace_or_append).
Took the minimal fix instead: remove .trim() and guard the trailing newline
insertion so idempotent reinstalls are byte-identical to the first install.
Same byte-preservation guarantee, no new helpers, no risk to the existing
init-at-top / shell-at-bottom convention. The new test
install_preserves_user_blank_lines_around_managed_blocks is the contract.

CONFIGURATION.md backfill turned out trivially small: the field-level and
section-level docs drift tests both passed on first run — every key already
appears as a backtick code span or TOML assignment. The only hot-reload table
gap was a missing [suggest.spec_cache] row, fixed in Task 8.

Coordination notes

  • PR B (status --verbose, README, SECURITY) touches separate files; no
    conflict expected.
  • PR C (TUI ergonomics) touches tui/{ui,app,editor}.rs and may add filter
    state to tui/fields.rs runtime code. My touch on tui/fields.rs is a
    bottom-of-file #[cfg(test)] mod drift_tests only — should auto-merge.
    If conflicts arise, the test module is the dropper-in.
  • Phase 5 (macos-smart-completions) is running in parallel. Their file
    touch set (gc-suggest/*, handler.rs:1268-1276/2840-2856, specs/*.json,
    fig-converter, PROVIDERS.md) does NOT intersect this PR. The drift
    tests this PR ships are the contract: if phase 5 ever adds a
    GhostConfig field, they must extend all_field_paths(), the install
    template, the TUI editor metadata, and CONFIGURATION.md in lockstep.
    The forward contract on all_field_paths()'s doc comment makes this
    explicit.

StanMarek added 5 commits May 27, 2026 21:00
…gainst schema

Three in-crate drift_tests modules consume gc_config::all_field_paths()
to assert install.rs::DEFAULT_CONFIG_TOML, tui::fields::all_fields(),
and docs/CONFIGURATION.md mention every leaf key. ghost-complete is a
binary-only crate (no lib.rs), so the install + TUI tests live next to
the data they test; the docs test lives in gc-config because that crate
can reach docs/CONFIGURATION.md via CARGO_MANIFEST_DIR.

On this commit the install + docs tests are EXPECTED to fail wholesale
— Task 3 (install template backfill) and Task 8 (CONFIGURATION.md
backfill) drive them to green. The TUI editor test passes today.
Adds render_block_ms, js_runtime, [suggest.spec_cache], [paths], and
experimental.brew_search_cap with help comments. In-crate drift test
(drift_tests::install_template_contains_every_schema_field) pins the
parity going forward.
content.trim() at install.rs:518 was stripping all leading/trailing
whitespace from user content before sandwiching managed blocks. New
splice helper replaces blocks in-place (preserving surrounding bytes
exactly) or appends with a single separator blank line.
…load table

Adds documentation for every field caught by the field-level docs drift
test (render_block_ms, js_runtime, spec_cache.*, paths.spec_dirs,
brew_search_cap, and any historical drift). Hot-reload table audited
against ReloadBehavior enum. If render_block_ms hasn't been wired by
rendering-polish, demoted to RequiresRestart to stop lying to users.
@StanMarek StanMarek changed the title 0.17 docs/config drift battery + .zshrc preservation 0.17 phase 4 / PR A: docs/config drift battery + .zshrc preservation May 27, 2026
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