You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cancelling a pending Setup Connection attempt now cancels the in-flight connect without closing the dialog or losing entered values. Cancel remains visible beside Connecting… while an attempt is pending.
Each explicit Start runs in its own generation (own raw client, lifetime token and handlers), so a cancelled or superseded attempt cannot fire stale callbacks, establish a reconnect, or resurrect itself after cancellation. Closing/disposing the dialog and stopping while an automatic reconnect is pending are both safe.
Validation: full solution build (0 warnings / 0 errors); Core 1765 passed / 1 skipped; UI 1731 passed / 1 skipped; integration 59 passed; formatting, security, comments, blocking-awaits, file-length and the CI script tests pass; coverage 89%; browser checks (desktop 1280x900, mobile 390x844, short 390x480) pass for the dialog flows.
Compatibility: the raw adopted-client constructor (IMqttClient) is now single-generation - repeat starts need the IMqttClientFactory constructor. Production DI uses the factory path and is unaffected.
AGENTS.md comment guidance is tightened to keep added comments minimal.
Each explicit Start gets its own generation (raw client, lifetime token, handlers) so a canceled or superseded attempt cannot reach the next one. Adds StartAttempt/ConnectAttemptCompletedAsync for caller-visible attempt correlation, and makes Stop/DisposeAsync await every retiring generation's cleanup.
The Connect button becomes Cancel while an attempt is in flight; cancelling retires the attempt through the managed client and preserves the dialog and its values. Close/dispose and stop-while-reconnecting are safe. Uses StartAttempt attempt correlation to ignore stale outcomes.
If the dialog is disposed while Save & Connect awaits AddConnectionAsync, disposal cancels and releases the operation, but the completed save still proceeds into StopActiveConnectionGracefullyAsync before checking ownership. The closed dialog can therefore disconnect the active session. Check IsCurrent(operation) after validation and the save prompt, before starting shutdown. Add a regression test that disposes the dialog during a blocked save.
If the dialog is disposed while validation or the unsaved-changes prompt is pending, startup can resume and call StopActiveConnectionGracefullyAsync after its operation has been canceled and released. The ownership check after shutdown is too late to prevent disconnecting the active session. Recheck IsCurrent(operation) after each earlier await, and add a regression test that disposes the dialog while the prompt is pending, then resolves it with “Connect anyway.”
If the dialog is disposed while “Save & Connect” awaits certificate import or AddConnectionAsync, disposal cancels and releases the operation. When the save finishes, startup still calls StopActiveConnectionGracefullyAsync before checking ownership, so the closed dialog can disconnect the existing session. Check IsCurrent after validation and the save prompt, before stopping the session. Add a regression test that disposes the dialog during a blocked save and verifies that session shutdown is not called.
Addressed all three body-only findings in Copilot review 5547811617 in 17622e1:
Disconnect notification after successful connection cancellation: caller cancellation now retires only its own generation, waits for its resource cleanup, and uses the existing exactly-once, supersession-aware deliberate disconnect dispatcher. Regression coverage verifies raw disconnect before managed disconnect/state, never-connected silence, supersession suppression, and a disconnect subscriber awaiting Stop. The original regression tests failed before the fix; the strengthened main test blocks a connected-state subscriber with the raw client connected.
Cancel during reconnect cleanup: the connecting footer appears before graceful shutdown is awaited, so Cancel cancels startup in place rather than closing the dialog. Cancel_DuringBlockedGracefulShutdown_CancelsStartupInPlace failed before the fix and now verifies the dialog and entered values remain, no discard prompt appears, and no new MQTT attempt or broker reset occurs.
Blocked fake-connect test cleanup: both lifecycle tests now release their gates in finally, retaining their assertions while ensuring an assertion failure cannot hang teardown. The new UI regression also releases its gate in finally.
Validation: full solution build with zero warnings/errors; unfiltered Core 1,787 passed / 1 skipped, UI 1,736 passed / 1 skipped, integration 59 passed; 89% line coverage; full-tree formatting, security, comment, blocking-await and file-length gates pass. CI-script tests: 361 run, 2 skipped, successful. Commit and push hooks enabled and passing. Independent core review found no blocker.
These findings exist only in the review body, so there are no corresponding threads to resolve. Fresh reviews of 17622e1 are required; no merge performed.
If the raw Connected handler runs before cancellation and ConnectAsync then throws (including a wrapped cancellation), CompleteFailure settles Canceled but leaves WasConnected true. This condition therefore emits managed disconnect and state notifications for an attempt whose success was never reported. Unlike CompleteSuccess, the exception path does not clear that flag. Exclude canceled outcomes here, while preserving notifications for established connections and successful reconnects. Add an exception-path variant of the raw-connected cancellation race test.
Addressed the additional body-only finding in Copilot review 5554506653 in 7842cf9: NotifyDeliberateStopAsync now excludes settled Canceled outcomes, including direct and wrapped exception paths after the raw Connected handler. Regression tests prove raw cleanup occurs without managed connected/failure/disconnect/state notifications; established cancellation and successful reconnect notifications remain covered. This commit also scopes dialog teardown and certificate ownership to its attempt (inline thread reply has details). Validation passed: full solution build, unfiltered Core/UI/integration suites, 89.2% line coverage, browser checks, formatting, security, and repository gates.
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
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.
Cancelling a pending Setup Connection attempt now cancels the in-flight connect without closing the dialog or losing entered values. Cancel remains visible beside Connecting… while an attempt is pending.
Each explicit Start runs in its own generation (own raw client, lifetime token and handlers), so a cancelled or superseded attempt cannot fire stale callbacks, establish a reconnect, or resurrect itself after cancellation. Closing/disposing the dialog and stopping while an automatic reconnect is pending are both safe.
Validation: full solution build (0 warnings / 0 errors); Core 1765 passed / 1 skipped; UI 1731 passed / 1 skipped; integration 59 passed; formatting, security, comments, blocking-awaits, file-length and the CI script tests pass; coverage 89%; browser checks (desktop 1280x900, mobile 390x844, short 390x480) pass for the dialog flows.
Compatibility: the raw adopted-client constructor (IMqttClient) is now single-generation - repeat starts need the IMqttClientFactory constructor. Production DI uses the factory path and is unaffected.
AGENTS.md comment guidance is tightened to keep added comments minimal.
Closes #150