Add keyboard workflows and data safety hardening - #1
Merged
Conversation
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.
What Packrat is
Packrat is a deliberately small, portable backpacking gear planner:
gear_core.pyis the reusable domain/persistence layer: the flat-file schema, weight calculations, review heuristics, and Markdown rendering.gear_tui.pyis a Textual adapter over that model: inventory CRUD, trip composition, dashboards, and exports.gear_data.jsonis both the source of truth and the portability boundary. The design optimizes for “copy or sync one folder and run it anywhere,” not multi-user collaboration.That separation is a good fit for the project. The largest risks were not architectural complexity; they were concentrated state mutation, an optimistic JSON loader, an inaccurate claim that every action had a keyboard equivalent, and no executable regression suite around Textual or persistence.
What this changes
Keyboard-first workflows
1/2/3tab navigation and/to focus the active search.Ctrl+Sto forms/pickers and Enter to confirmation dialogs.?shortcut overlay and exposes useful bindings in the footer.Data and filesystem hardening
gear_data.json.bakon every save.Ctrl+Bfor an on-demand backup.--datafile instead of beside the source code.Regression safety
Verification
uv run --python 3.9 python -m unittest discover -s tests -vuv run --python 3.12 python -m unittest discover -s tests -vuvx ruff check --select E4,E7,E9,F,I gear_core.py gear_tui.py testsgit diff --checkDeliberate limits
This does not attempt to merge simultaneous edits. It detects and blocks an overwrite, keeps a backup, and tells the user to reload. True multi-writer support would require locking plus sync-aware conflict resolution or a different storage model, which would work against Packrat’s single portable JSON-file goal.