Skip to content

fix: dialog reentrancy guard and settings-dialog Escape contract#18

Merged
shoom1 merged 1 commit into
developfrom
fix/dialog-lifecycle
Jun 12, 2026
Merged

fix: dialog reentrancy guard and settings-dialog Escape contract#18
shoom1 merged 1 commit into
developfrom
fix/dialog-lifecycle

Conversation

@shoom1

@shoom1 shoom1 commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Changes

  1. DialogManager.show() raises RuntimeError if a dialog is already open. Previously a second show() overwrote _current_dialog, orphaning the first dialog's result future — its awaiter hung forever with no way to resolve. Failing loudly makes the single-dialog contract explicit.
  2. SettingsDialog(can_cancel=False) disables Escape (_UNSET) instead of setting escape_result to the string "close", which leaked through DialogManager.show() as the return value of show_settings_dialog() — violating its documented dict | None contract (callers iterating result.items() would crash on a str). With no cancel concept, the Done button is the only way out.

Tests

  • Reentrancy: second show() raises; the first dialog is unaffected and still resolvable.
  • Escape contract: can_cancel=TrueNone; can_cancel=False_UNSET (escape disabled).

Identified in docs/notes/project_review_20260612.md (findings 3 and 4).

DialogManager.show() now raises RuntimeError if a dialog is already
open. Previously a second show() overwrote _current_dialog, orphaning
the first dialog's result future — its awaiter hung forever with no
way to resolve. Failing loudly makes the single-dialog contract
explicit.

SettingsDialog with can_cancel=False now disables Escape (_UNSET)
instead of setting escape_result to the string "close", which leaked
through DialogManager.show() as the return value of
show_settings_dialog() — violating its documented dict-or-None
contract (callers iterating result.items() would crash on a str).
With no cancel concept, the Done button is the only way out.
@shoom1 shoom1 merged commit da9e616 into develop Jun 12, 2026
@shoom1 shoom1 deleted the fix/dialog-lifecycle branch June 12, 2026 20:08
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.

1 participant