Skip to content

fix: treat delete-thread 404 as success to free the delete dialog#375

Merged
91jaeminjo merged 1 commit into
mainfrom
fix/delete-thread-dialog-trap
Jun 22, 2026
Merged

fix: treat delete-thread 404 as success to free the delete dialog#375
91jaeminjo merged 1 commit into
mainfrom
fix/delete-thread-dialog-trap

Conversation

@91jaeminjo

Copy link
Copy Markdown
Collaborator

Summary

Fixes #365 — the Delete Thread dialog trapped the user when deleting a thread that no longer existed server-side. The DELETE returned 404 (NotFoundException), which propagated up through RoomState.deleteThread into AsyncActionDialog, leaving the dialog open with red error text. Every retry repeated the same 404, and the stale entry was never removed from the sidebar.

HTTP DELETE is idempotent: a 404 means the desired end state (thread gone server-side) is already true. ThreadListState.deleteThread now catches NotFoundException and falls through to the existing local-list cleanup, so the dialog closes and the stale entry is dropped. All other exceptions (network, 500, AuthException) keep their existing behavior, so genuine failures still surface in the dialog.

Changes

  • Fix (thread_list_state.dart): catch NotFoundException in deleteThread, log it, and fall through to local cleanup.
  • Logging: route ThreadListState logging through soliplex_logging (soliplex.thread_list_state) instead of dart:developer, matching the lobby_state/room_screen migration. The two level: 900 paths map to _logger.warning; the benign "keeping stale list" and new 404 paths map to _logger.info.
  • Tests: idempotent-success (404 → no throw, stale entry removed) and the non-Loaded reconciliation path (404 swallowed → falls through to a fresh fetch).
  • CHANGELOG: Fixed entry under [Unreleased].

Reviewed

Reviewed with Gemini and the PR-review agents (code, tests, errors, comments). Acted on two findings: added the observability log (was the only catch branch in the file without one) and the non-Loaded coverage test.

Test plan

  • flutter test test/modules/room/thread_list_state_test.dart — green (incl. existing deleteThread propagates API error, which confirms non-404 errors still bubble)
  • flutter analyze — zero warnings
  • markdownlint-cli2 on CHANGELOG — clean

🤖 Generated with Claude Code

Deleting a thread that no longer exists server-side returned a 404
(NotFoundException), which propagated into AsyncActionDialog and left it
open with an error on every retry while the stale entry stayed in the
sidebar. DELETE is idempotent, so a 404 means the desired end state is
already reached: catch NotFoundException, log it, and fall through to the
existing local-list cleanup. Other exceptions keep propagating so genuine
failures still surface.

Route ThreadListState logging through soliplex_logging instead of
dart:developer, matching the lobby_state/room_screen migration.

Closes #365
@91jaeminjo 91jaeminjo merged commit 35ac38d into main Jun 22, 2026
6 checks passed
@91jaeminjo 91jaeminjo deleted the fix/delete-thread-dialog-trap branch June 22, 2026 22:01
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.

Delete Thread dialog traps the user on a 404 (delete not idempotent)

1 participant