Skip to content

fix(tokens): keep JSON export responsive when the file chooser stalls - #1178

Draft
Claudius-Maginificent wants to merge 2 commits into
feat/app-design-systemfrom
fix/token-json-export
Draft

Claudius-Maginificent wants to merge 2 commits into
feat/app-design-systemfrom
fix/token-json-export

Conversation

@Claudius-Maginificent

Copy link
Copy Markdown
Collaborator

TL;DR

Saving a token contract no longer freezes the application when the system file chooser does not respond. Users can cancel browsing and enter a destination directly, then explicitly save the reviewed JSON.

User story

As a token creator, I can save the contract I reviewed and recover from an unavailable file chooser without restarting the application or losing my export.

Scenario

Actual behavior

Choosing Save contract JSON opens a synchronous system dialog on the application thread. An unresponsive desktop portal freezes the application and prevents saving.

Expected behavior

The export form stays responsive. Browse chooses a destination; Save writes the reviewed snapshot. Cancelling browsing permits direct path entry, and a late chooser result cannot write a file. Replacing an existing file requires a separate confirmation.

Detailed discussion

Stacked on #1177 (feat/app-design-system). Covers exports from both prepared review and confirmed receipts. Native browsing and file writes use backend tasks with request ownership; a process-wide single-flight guard bounds native chooser workers. Writes publish a completed temporary file atomically and refuse protected application files and file aliases.

Testing

  • Regression reproduced before implementation; 31 focused export and file-protection tests pass.
  • cargo fmt --all, scoped library Clippy with warnings denied, and GUI binary build pass.
  • Independent Astra review completed; both review findings fixed and rechecked.
  • Real desktop GUI: 11 passing groups cover cancel, exact exported bytes, explicit replacement, write error/retry, protected configuration, native browsing/cancel, and a deliberately unresponsive isolated portal. Direct saving worked while that portal was suspended; a subsequent late chooser selection produced no file.
  • Live export checks used a confirmed receipt. Prepared-review export shares the same code and has automated coverage. Full workspace CI and other operating systems were not run locally.

🤖 Co-authored by Claudius the Magnificent AI Agent

lklimek and others added 2 commits November 13, 2026 07:10
Capture the reviewed JSON in a path form with optional asynchronous native
browsing. Retain one native chooser until it finishes, reject abandoned
chooser replies, and allow direct path entry after cancelling interest.
Write only after explicit Save and require confirmation before replacement.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>
… files

Keep filesystem discovery out of the export form's render path. Write and
sync the reviewed JSON to a temporary file before publishing it, preserving
existing contents on failure. Reuse protected-file checks and reject symbolic
links, hard links and nonregular export destinations.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Codex GPT-6 <noreply@openai.com>
@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@thepastaclaw

Copy link
Copy Markdown
Collaborator

🕓 Review not started yet because this PR is a draft.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit 9c41644. Normal review starts when eligible; priority review starts as soon as a slot is available.

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.

3 participants