Skip to content

Feat/integrated config edit#161

Draft
Firstp1ck wants to merge 7 commits intomainfrom
feat/integrated-config-edit
Draft

Feat/integrated config edit#161
Firstp1ck wants to merge 7 commits intomainfrom
feat/integrated-config-edit

Conversation

@Firstp1ck
Copy link
Copy Markdown
Owner

@Firstp1ck Firstp1ck commented Apr 27, 2026

Summary

  • Integrated TUI config editor: New modal to view and edit settings from inside the app, with typed schema, validation, persistence, global events, mouse support, footer integration, and UI under src/ui/modals/config_editor.rs / src/events/modals/config_editor.rs / src/state/config_editor.rs.
  • Keybind editing hardening: keybinds.conf is fully wired into the integrated editor flow (schema exports, file activation, active-path visibility), with typed key-chord serialization/lookup and same-scope conflict detection to block invalid colliding saves.
  • Typed config patching: theme/config/patch.rs and theme/config/schema.rs support structured edits aligned with shipped config examples.
  • Update checks: Prefer checkupdates when available; classify failures and stderr; fall back through fakeroot temp-db sync and stale pacman -Qu when appropriate. Optional pacman -Sl index paths are gated on active repo names from the main pacman.conf (EndeavourOS, CachyOS, Artix, BlackArch) via PacmanConfScan::active_repo_names_lower and refactors in src/index/fetch.rs.
  • Logging: Periodic update-check INFO lines are deduplicated: summary INFO only when count, authority, strategy, or reason digest changes (or first non-empty reason run); isolated checkupdates execution logs at DEBUG.
  • Updates modal UX: Scroll position centers the selected row when possible (clamped at list ends); tests and docs updated for centering behavior.
  • Locales: New strings for en-US, de-DE, hu-HU for the config editor and related UI.
  • Assets: Images/Config_Editor_v0.8.3.png added for the config editor UI.

Type of change

  • feat (new feature)
  • fix (bug fix)
  • docs (documentation only)
  • refactor (no functional change)
  • perf (performance)
  • test (add/update tests)
  • chore (build/infra/CI)
  • ui (visual/interaction changes)
  • breaking change (incompatible behavior)

Related issues

Closes #

How to test

cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings
cargo check
cargo test -- --test-threads=1

Manual / integration:

  • Run the TUI (RUST_LOG=pacsea=debug cargo run -- with --dry-run where you only need to observe behavior without installs).
  • Open the integrated config editor from the documented entry point (footer / keybind as wired in this branch); change a setting, save, restart, and confirm values persist and match config/ schema expectations.
  • In keybinds.conf, attempt both a valid keybind edit and a same-scope conflicting keybind edit; confirm valid saves persist and conflicts are rejected with no file write.
  • Trigger update checks with and without checkupdates on PATH; confirm authority ordering, reason codes in logs, and that INFO spam is reduced on steady-state repeats.
  • Open the updates modal, move selection through the list (start, middle, end), and confirm the selected row stays centered when the viewport allows it.
  • Spot-check localized strings if using de-DE or hu-HU.

Screenshots / recordings (if UI changes)

See Images/Config_Editor_v0.8.3.png for the integrated config editor.

Checklist

Code Quality:

  • Code compiles locally (cargo check)
  • cargo fmt --all ran without changes
  • cargo clippy --all-targets --all-features -- -D warnings is clean
  • cargo test -- --test-threads=1 passes
  • Complexity checks pass for new code (cargo test complexity -- --nocapture)
  • All new functions/methods have rustdoc comments (What, Inputs, Output, Details)
  • No unwrap() or expect() in non-test code

Testing:

  • Added or updated tests where it makes sense
  • For bug fixes: created failing tests first, then fixed the issue
  • Tests are meaningful and cover the functionality

Documentation:

  • Updated README if behavior, options, or keybinds changed (keep high-level, reference wiki)
  • Updated relevant wiki pages if needed:
  • Updated config examples in config/ directory if config keys changed
  • For UI changes: included screenshots and updated Images/ if applicable

Compatibility:

  • Changes respect --dry-run flag
  • Code degrades gracefully if pacman/paru/yay are unavailable
  • No breaking changes (or clearly documented if intentional)

Security (CI):

  • Ran ./dev/scripts/security-check.sh before opening the PR (local mirror of Security + Lint workflows: rustfmt, clippy, cargo audit, cargo deny check, gitleaks — skipped steps print install hints)
  • After adding or updating dependencies: cargo audit and cargo deny check pass (deny.toml); no new high-severity or license issues that would fail GitHub dependency review on this PR
  • No secrets or credential-like placeholders that would trip gitleaks (see .gitleaks.toml for allowlisted paths if you must add test fixtures)
  • Follows secure coding rules in AGENTS.md / CLAUDE.md (shell quoting, credentials, HTTP, paths) — see dev/SECURITY_REMEDIATION_GUIDE.md for remediation patterns

Other:

  • Not a packaging change for AUR (otherwise propose in pacsea-bin or pacsea-git repos)

Notes for reviewers

  • Large surface area: config editor crosses state, events, ui, theme, persist, and locales; a skim of modal lifecycle (open/save/cancel) and AppState integration will pay off.
  • Update-check path touches workers/updates.rs, index/fetch.rs, and pacman_conf.rs; optional -Sl is now tied to active repo sections—worth validating on installs that only enable a subset of community repos.
  • Log dedupe uses digests; confirm debug-level detail is still sufficient for troubleshooting without restoring INFO noise.

Breaking changes

None intended. Config editing goes through the existing theme/settings model; if any default or validation behavior changed, call it out during review.

Additional context

  • Branch: feat/integrated-config-edit
  • Prior planning doc updates under dev/ (e.g. integrated config editing plan) may accompany this work for historical context.

- feat: add dry-run-aware atomic config patch API with structured outcomes and errors
- feat: introduce editable settings schema with value kinds, reload behavior, and sensitivity metadata
- refactor: re-export new patch and schema types from theme config modules for upcoming integrated editor flows
- feat: add config editor state, input handling, and modal UI
- feat: extend theme config schema for editor metadata and validation
- feat: add locale strings for config editor (de-DE, en-US, hu-HU)
- feat: persist config editor recents and bookmarks; debounce search recents
- change: wire editor into runtime tick/cleanup, global keys, mouse, search, and results UI
- chore: add Config_Editor_v0.8.3 screenshot asset
…ex -Sl on pacman.conf

- change: prefer checkupdates before fakeroot temp-db sync when the binary exists; fall back to fakeroot then stale pacman -Qu when checkupdates is missing or non-authoritative.
- change: defer checkupdates-unavailable reason until after authoritative paths are exhausted; classify checkupdates stderr on failure.
- feat: add PacmanConfScan::active_repo_names_lower for active [repo] section names from pacman.conf.
- change: run pacman -Sl for EndeavourOS, CachyOS, Artix, and BlackArch only when a matching repo is active in the main pacman.conf.
- refactor: extract optional repo filtering and pacman -Sl spawn_blocking helpers in index fetch.
- test: assert active_repo_names_lower ignores commented sections and [options].
- docs: tighten rustdoc and reason-code comments for update-check tooling and Landlock-related stderr.
- change: compute updates modal scroll to vertically center the selected entry when possible, clamping at list ends.
- change: derive scroll from selection and viewport geometry only; prior scroll offset is unused.
- test: refresh modal scroll expectations and add a middle-of-list centering regression test.
- docs: align rustdoc and comments in modal, mouse, and utils with centering behavior.
- change: emit update-check summary INFO only when count, authority, strategy, or reason digest changes, or the first run has non-empty reason codes.
- change: log isolated checkupdates execution at DEBUG instead of INFO.
- test: add unit tests for update_check_cycle_emits_info (baseline skip, reasons, count change, digest clear, unchanged).
…er save validation

- feat: enable `keybinds.conf` in the config editor flow with schema exports, file activation, and active-path visibility in details pane.
- feat: add semantic and typed popup validation (color, key chord, optional numeric/all, pane order, locale, terminal token, selected countries) before patch writes.
- feat: add keybind chord serialization/lookup helpers and same-scope conflict detection to prevent invalid or colliding keybind saves.
- test: add phase 1 integration coverage for bool/enum saves and dry-run no-write behavior through real config-editor key events.
- test: add phase 2 integration coverage for keybind save, dry-run no-write behavior, and conflict-blocked save behavior.
@Firstp1ck Firstp1ck self-assigned this Apr 28, 2026
@Firstp1ck Firstp1ck added enhancement New feature or request improve-consistency labels Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant