Skip to content

fix(wallet): fail declined resets and preserve JSON output - #108

Open
Kewe63 wants to merge 1 commit into
Polymarket:mainfrom
Kewe63:fix/issue-98-wallet-reset-json-status
Open

Kewe63 wants to merge 1 commit into
Polymarket:mainfrom
Kewe63:fix/issue-98-wallet-reset-json-status

Conversation

@Kewe63

@Kewe63 Kewe63 commented Oct 25, 2026 •

Copy link
Copy Markdown

Summary

  • require --force for non-interactive wallet resets in JSON mode
  • return failure when an interactive reset is declined
  • preserve the wallet configuration on every declined reset
  • keep forced reset success output as one valid JSON result

Problem

Declining wallet reset returned exit status 0 and mixed a plain-text prompt and abort message into JSON output. Automation could interpret the reset as completed and could not parse the documented JSON result.

Approach

JSON mode rejects reset without --force before prompting. Interactive table mode still prompts, but a negative response now returns an error. Forced JSON resets retain the existing successful deletion behavior.

Tests

  • JSON reset without force: nonzero, one valid JSON error, config preserved
  • table-mode decline: nonzero, config preserved
  • forced JSON reset: success, valid JSON, config removed
  • cargo +1.91.1 fmt --check
  • cargo +1.91.1 clippy --locked --all-targets -- -D warnings
  • git diff --check

Risk

Low. The only compatibility change is that declined destructive operations are no longer reported as success.

Fixes #98


Note

Low Risk
Behavior change is limited to wallet reset exit codes and JSON output; declined resets no longer report success, which is the intended fix for automation.

Overview
wallet reset now treats declined or non-forced destructive runs as failures instead of success, so scripts and humans get a clear signal when nothing was deleted.

In JSON mode, reset without --force fails immediately with a single structured JSON error (no interactive prompt mixed into stdout). Table mode still prompts, but answering no returns a nonzero exit with Aborted on stderr via bail!, and config is left intact in both cases. Forced JSON reset behavior is unchanged.

Integration tests add an isolated TestHome fixture and cover JSON-without-force, table decline, and forced JSON success paths.

Reviewed by Cursor Bugbot for commit 620bc80. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

[Bug]: wallet reset refusal exits successfully and breaks JSON output

1 participant