fix(storage, workspace, cli): Report disk-full and write errors clearly - #893
Open
JeanMertz wants to merge 5 commits into
Open
fix(storage, workspace, cli): Report disk-full and write errors clearly#893JeanMertz wants to merge 5 commits into
JeanMertz wants to merge 5 commits into
Conversation
Previously a failed conversation write from `Drop` (the safety net for mutation scopes that unwind before an explicit `flush()`) was logged to stderr and swallowed: the CLI could exit zero after silently losing data. `ConversationLock` and `ConversationMut` now record a drop-time persist failure in shared state, and the next `flush()`, or a `take_persist_failure()` drain at teardown, surfaces it so the process exits non-zero and the printer reports it. `jp query`, `jp config set`, and the `jp conversation compact`/`edit`/`fork` subcommands now call `flush()` before printing success, so a write failure is reported as an error instead of a confirmation the user cannot trust. `jp_storage::Error` gains `WriteFailed` and `OutOfSpace` variants that carry the failing path alongside the OS error, replacing the bare, pathless `Io` variant on every write call site. A write that fails because the filesystem is full is classified separately: once seen, later write attempts on the same conversation lock are skipped rather than retried, since none can succeed until space is freed. The CLI renders `OutOfSpace` with a `suggestion` field telling the user to free disk space and re-run, and notes that anything after the last successful write was not saved. Updates RFD 069 (guard-scoped persistence for conversations) to describe the drop-time failure reporting path and the one remaining gap: a lock-owning scope (`into_mut`) that drops without a later `flush()` or `take_persist_failure()` call still only logs the failure. Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.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.
Previously a failed conversation write from
Drop(the safety net for mutation scopes that unwind before an explicitflush()) was logged to stderr and swallowed: the CLI could exit zero after silently losing data.ConversationLockandConversationMutnow record a drop-time persist failure in shared state, and the nextflush(), or atake_persist_failure()drain at teardown, surfaces it so the process exits non-zero and the printer reports it.jp query,jp config set, and thejp conversation compact/edit/forksubcommands now callflush()before printing success, so a write failure is reported as an error instead of a confirmation the user cannot trust.jp_storage::ErrorgainsWriteFailedandOutOfSpacevariants that carry the failing path alongside the OS error, replacing the bare, pathlessIovariant on every write call site. A write that fails because the filesystem is full is classified separately: once seen, later write attempts on the same conversation lock are skipped rather than retried, since none can succeed until space is freed. The CLI rendersOutOfSpacewith asuggestionfield telling the user to free disk space and re-run, and notes that anything after the last successful write was not saved.Updates RFD 069 (guard-scoped persistence for conversations) to describe the drop-time failure reporting path and the one remaining gap: a lock-owning scope (
into_mut) that drops without a laterflush()ortake_persist_failure()call still only logs the failure.