fix: surface global config writes and correct first-run guidance#37
Merged
Conversation
Make read and setup commands honest about what they touch and guide the new user to the right next step. - setup now prints a notice before writing when settings land in the global config file (AUTOPHAGY_CONFIG_DIR unset) while --database points elsewhere; interactive runs fold it into the summary, --yes runs send it to stderr so JSON stdout stays clean. The "Re-running setup" line now keys off an on-disk config file rather than a possibly-stale flag. - status reports the true on-disk footprint by summing the WAL/shm sidecars, so a brand-new WAL database no longer under-reports ~4 KiB when it actually holds the ~250 KiB migrated schema, and says "created new database" for a file it just made. - status's search line points a fresh, empty database at `autophagy setup` instead of a `reindex` that has nothing to rebuild; the reindex hint stays for imported-but-unindexed stores. - empty `sessions` and `search` print friendly guidance instead of a bare header / unqualified "no matches"; JSON shapes are unchanged (empty arrays stay empty arrays). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Claim
Commands are honest about what they touch and guide the new user correctly. Four coherent UX fixes across
setup,status,sessions, andsearch— output text only, no behavior or storage changes.What changed
setupsurfaces global config writes. When settings would be written to the global config file (AUTOPHAGY_CONFIG_DIRunset) while an explicit--databasepoints elsewhere, setup now prints a notice before writing. Interactive runs fold it into the summary;--yesruns send it to stderr so JSON stdout stays clean. Config location is unchanged — only made visible. The "Re-running setup" line now keys off an on-disk config file rather than a possibly-stale flag.statusreports the real database size. The store opens in WAL mode, so a naive read of the main file right after migrations undercounts a brand-new database (~4 KiB header, not the ~250 KiB migrated schema).statusnow sums the-wal/-shmsidecars, and labels a file it just created ascreated new database.autophagy setup(nothing to reindex yet). Thereindex --index-tool-inputhint stays for the imported-but-unindexed case where it is correct.sessionsprintsno sessions imported yet — run autophagy setup(no bare header);searchagainst a zero-event database says so.--output jsonshapes are unchanged — empty arrays stay empty arrays.Evidence
New CLI integration tests in
crates/autophagy-cli/tests/cli.rs:status_reports_post_migration_size_for_a_new_database—size_bytes > 100_000(was ~4 KiB),exists=false, text sayscreated new database.status_search_hint_points_at_setup_before_import_and_reindex_after— empty DB →autophagy setupand noreindex; imported-unindexed →reindex --index-tool-input.empty_sessions_and_search_guide_the_user_but_keep_json_arrays— friendly text for both; JSONresultstays[]; a real miss on a populated DB still saysno retrieval matches.setup_warns_before_writing_global_config_for_explicit_database— notice fires; the faked global path resolves under a throwawayHOME, never the real one.setup_omits_global_notice_when_config_dir_is_isolated— notice silent whenAUTOPHAGY_CONFIG_DIRisolates the run.Before / after (fresh empty database):
Privacy implications
None. Output text only; no new persistence, network, or execution. Config write location is unchanged (now merely announced). The global-notice test fakes the global path via a throwaway
HOME/XDG_DATA_HOMEand never touches the real config or database.Quality gate
mise run checkgreen (ci + fmt + lint + test + docs).🤖 Generated with Claude Code
https://claude.ai/code/session_015LY7xtercMc3NtLeX2z4YV