Skip to content

fix(engine): a cancelled or backgrounded connect is no error toast - #81

Merged
hans-fischer merged 8 commits into
mainfrom
fix/connect-outcomes-not-errors
Oct 22, 2026
Merged

hans-fischer merged 8 commits into
mainfrom
fix/connect-outcomes-not-errors

Conversation

@hans-fischer

Copy link
Copy Markdown
Contributor

Neither the user's own Cancel Connecting nor a connect that goes on in the background raises an error toast any more (the owner's alpha walk of 2026-10-22, AW15 and AW16). A failed connect still does.

Cause

  • The window toasted every dispatch error except a declined confirmation.
  • Only cluster.connect turned "another cluster was shown; the connect goes on in the background" into a result. hotbar.openCluster, ui.tab.select and ui.setNavigatorScope passed the Go error on.
  • A cancel that ended the run at the moment the window's connect looked at it came back as "superseded by a newer connect".
  • A second connect of the cluster being connected ended the first connect's wait as if another cluster had been shown.

Fix

  • Engine:
    • Typed outcomes ErrConnectCancelled and ErrConnectSuperseded beside ErrConnectInBackground, plus ConnectNotFailed.
    • awaitRun answers "cancelled" or "in the background" in every race.
    • A connect of the cluster the window already waits for joins that wait, so both callers get the real outcome from one login.
  • Commands: every connecting command answers a background connect without an error: {state: connecting} from the connect commands, the UI state from the tab and navigator commands.
  • Window: showError and the --context answer raise no toast for these outcomes. The connection dot and Connection Updates say it.
  • MCP and the built-in agent: a cancel comes back as cancelled, not failed, and asks the agent not to reconnect unless the user asks. An agent's cancel is as quiet in the window as the user's; the audit log has its cluster_disconnect.
  • D-97 records the decisions (the lead's, open to revision). D-66, G16, ui-parity and usage.md are updated.

Tests

  • Each failing before the change:
    • Engine: TestABackgroundConnectIsNoFailureOnEveryPath, TestACancelledConnectIsNoFailureOnEveryPath, TestAwaitRunAtTheMomentItsRunEnded, TestAConnectReplacedBeforeItBeganSaysWhy, TestAConnectOfTheSameClusterJoinsTheWait.
    • Commands: TestConnectCommandsAnswerABackgroundConnect, TestConnectCommandsAnswerACancel.
    • MCP: TestConnectOutcomesAreNoFailures.
    • Window: TestConnectOutcomesThatAreNoFailureRaiseNoToast. Before the change it toasted the walk's exact text.
  • TestAFailedConnectStaysAFailureOnEveryPath guards that a real failure stays one.
  • Locally: build; vet (plain, kind, envtest, standby); the engine, commands, mcp and agent tests; -race on the connect and command tests; make test-ui; lint (0 issues); make cyclo.
  • Not seen in a real window.

…outlined

The owner's alpha walk of 2026-10-22 on v0.38.0 (G16):

- AW3, AW19: the window's Escape knew the palette, the notifications, a
  settings page and the drawer only, so over a dialog it closed the drawer
  behind it or did nothing. Every overlay now registers what Escape does
  over it as it shows (escape.go: onEscape, onShown); the window's escape
  runs the top one's, an overlay without one takes the key. Every Fyne
  dialog is shown through sh.showDialog (Escape is its Dismiss), a framed
  dialog hides (its SetOnClosed answers no), the pop-ups, the palette, the
  notifications, the MCP details and the top bar's menus close.
- Fyne hands a key to the focused widget only: the fields of Cogpit's
  dialogs are types that pass an Escape on (fieldEntry, fieldSelectEntry,
  fieldCheck, fieldSlider, secretEntry), so Escape cancels a dialog
  whatever field has the keyboard.
- AW4: a list's search is cleared and the table gets the keys; the find bar
  closes from its fields and from the editor (yamlview's OnEscape). D-57's
  "any other search" had been the navigator's only.
- AW2: Escape on an open dropdown's list takes the keyboard off the field,
  and a dropdown with the keyboard passes Escape on.
- AW1: a closed dropdown draws an entry's outline; the field outline token
  is raised to 2:1 on every surface in both themes, the wells' and cards'
  edges keep the old value as colorHairline.

TestEveryDialogTakesEscape reads the sources for a dialog or pop-up shown
past the mechanism. D-116 and D-104 record the lead's decisions; G16,
ui-parity, usage, architecture, conventions and the design language say so.
The owner's alpha walk (AW12): a click below a list's rows closed the
drawer about a second later, × and Escape at once. Fyne's driver holds
every tap on a fyne.DoubleTappable for the double-click interval before
it calls Tapped (internal/driver/glfw/window.go,
mouseClickedHandleTapDoubleTap; NSEvent.doubleClickInterval on macOS,
0.5 s by default), and the list's table was one for its header
separators' double click, which fits a column.

The table now counts that double click itself, as the tab bar and the
navigator do (doubleClickTime and the tab bar's clock), and is no
DoubleTappable: every click on it acts at its release. Rows and headers
were not held: their cells take their own taps.

TestListClicksAreNotHeld clicks a row, a header, a header separator and
the area below the rows as the driver finds the object under the pointer
and fails on a DoubleTappable target; it and the reworked
TestDoubleClickSeparatorFitsColumn fail before the change. D-106's GW1
table records the cause and the lead's choice; G16, ui-parity and
architecture follow.
The welcome page's cluster rows were a fyne.DoubleTappable, their double
click doing what a click does, so Fyne's driver held every click on them
for the double-click interval (AW12's cause, found on the table first).
The row takes clicks only now.

Without the hold, a double click's second click reaches the row again,
which the page has rebuilt by then for the cluster connecting: a second
cluster.connect would join the run under way but end the first one's
wait with errConnectInBackground, an error toast naming another cluster,
and a login program not allowed yet would be reviewed twice. The page
therefore does nothing for a cluster whose connect it began and that has
not returned (pending, from before the review or the dispatch to the
engine's answer) or that the window shows connecting.

TestWelcomeRowConnectsOnce fails on the old row (held) and on a row
without the page's guard (connected twice). D-106 records the choice
and the clicks left held (the sync picker's rows, the log tab's head
row) with why; G16's AW12 entry follows.
…114)

The owner's AW17, AW13 and AW18 of the alpha walk (2026-10-22, D-114).

A chosen cluster's failed connect, the restore's or a click's, now shows
that cluster's error page over the workspace whether or not a tab is
open; the welcome page shows only without a chosen cluster. The page is
the welcome page's look: the logo, that it is an error page, the cause
in a sentence under the stage it failed in, the connect stage by stage,
Connect Again and Show Connection Updates.

The cluster layer measures every connect in stages: the kubeconfig, a
credential plugin's login, DNS with its addresses, TCP to the address
and port (or the proxy's), TLS and the API server's answer. DNS, TCP
and TLS come from client-go's own first request through
net/http/httptrace, so Cogpit opens no connection of its own. The
stages reach the connection log (an attempt's stages, a record each in
its file), UIState.ConnectFailure and the ConnectError; the
connection's error is the failed stage's sentence, the chain stays in
the log. Connection Updates shows each connect's stages.

The welcome page lists the hotbar and Recent only, the kubeconfigs'
clusters as "Your clusters" on a first start alone (AW13). The view's
placeholder no longer says the failure and fits the view with an
ellipsis: its long line drew a clipped "Could not" over the navigator
(AW18). The window tests' fake engine derives the welcome page where
the connection changes, as the engine does.
TestWelcomeRowConnectsOnce failed on the stacked tree for two reasons of
D-114's commit, not of the guard. The window tests' fake engine now
derives the welcome page as the engine does, which hides it while the
shown cluster connects, so the row it waited to see rebuilt never was.
And the page has no "Other clusters" any more (AW13): once a cluster is
recent, the others' rows went, and the later steps found none.

The scene puts every cluster on the hotbar, so each keeps its row, and
keeps the page up after each connect the test shows, so that a click on
the connecting cluster's row is still checked; a last step checks that
the page hides while the shown cluster connects. The error page's test
checks that Connect Again, which goes through the welcome page's
connect, connects once for a double press.
…o failures

The owner's alpha walk of 2026-10-22 (AW15, AW16): his own Cancel
Connecting raised the error toast "connect <context>: connecting
cancelled", and a click on another cluster while a login waited raised
"connect <context>: another cluster was shown; the connect goes on in the
background". cluster.connect answered the background case with
{state: connecting}, but hotbar.openCluster, ui.tab.select and
ui.setNavigatorScope passed the Go error on, and the window toasted every
error but a declined confirmation. A cancel that ended the run at the
moment the window's connect saw it said "superseded by a newer connect".

The engine now types the outcomes (ErrConnectCancelled,
ErrConnectSuperseded beside ErrConnectInBackground, ConnectNotFailed),
awaitRun answers cancelled or in the background on every race instead
of "superseded", every connecting command answers a background connect
without an error, and the window's showError and the --context answer
skip the three. MCP and the built-in agent read a cancel as cancelled,
not failed. A second connect of the cluster the window's connect waits
for joins that wait instead of ending it, so the first no longer says
another cluster was shown. A failed connect keeps its toast.

D-97 records the lead's decisions; D-66, G16, ui-parity and usage follow.
@hans-fischer
hans-fischer force-pushed the fix/connect-outcomes-not-errors branch from a871176 to daa476b Compare October 22, 2026 16:04
@hans-fischer
hans-fischer merged commit 0c99d92 into main Oct 22, 2026
@hans-fischer
hans-fischer deleted the fix/connect-outcomes-not-errors branch October 22, 2026 16:36
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