Skip to content

refactor(execution): run every query through one tab lifecycle and stop keystrokes waking the window - #4286

Merged
datlechin merged 2 commits into
mainfrom
refactor/execution-pipeline-4270
Nov 14, 2026
Merged

datlechin merged 2 commits into
mainfrom
refactor/execution-pipeline-4270

Conversation

@datlechin

@datlechin datlechin commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Summary

  • QT-10: single, parameterized, statement-list, batch and Explain runs all go through one TabRun (Core/Execution/TabRun.swift): claim and lease, scope, task, settle gate, cancel, failure and success reports, history. Strategies only produce and install results.
  • One history writer, so a script's statements now record the tab's schema. One Explain installer, one failed-run installer, one dispatch for plain and parameterized runs. Run All now saves the tab list like Run.
  • Parameterized runs gain the early row-count mark, the definition fetch after a definition change, and clear isLoading on failure.
  • A background tab's result no longer flips the window's results-collapsed toggle.
  • QT-11: execution and reload entries take the tab id (runQuery(onTab:), runStatement(_:sourceOffset:onTab:), runAllStatements(onTab:), runExplain(onTab:variant:), executeTableTabQueryDirectly(onTab:), reloadTableTab(_:), reloadActiveResult(onTab:), rebuildTableQuery(forTab:)). Commands resolve the shown tab at the gesture.
  • QT-11: discard prompts, refresh, pagination, filters, browse search, column scope, navigation history, FK refilter, Explain approval, rewind, sidebar save, close with save, bulk close, discard and the Save As fallback act on the tab captured before the await and stop if it is gone or no longer in front. fetchEnumValues reads the tab's scope.
  • A confirmed discard always puts the tab's rows back to their originals, so a reload that is refused, fails or never runs (a filter the engine cannot build, a navigation abandoned behind the prompt) no longer leaves edited values on screen untracked. One guard, confirmDiscardChangesIfNeeded, replaces the plain and restoring pair.
  • PF-06: keystrokes write through QueryTabManager.setEditorText(_:ofTab:) without publishing tabs; it publishes only when the text's emptiness or a file tab's dirty state flips.
  • PF-07: MainContentView and MainEditorContentView observe a per-connection ConnectionCatalogSnapshot, not SchemaService.shared and DatabaseTreeMetadataService.shared.

Measurements (PF-06)

Unit-test host, Debug build, 40 query tabs of 2,000 characters, tab strip hosted in a window, 400 keystrokes, three rounds. Old path is the editor binding's previous write (mutate(tabId:)).

Per keystroke Old path setEditorText
tabs publishes 1 0
Write 126 to 136 µs 2.3 to 2.4 µs
Next run loop turn (strip re-render) 9.4 to 9.8 ms 6.8 to 7.1 µs

Each old publish also re-evaluated MainContentView, MainEditorContentView and two AppKit sinks.

Test plan

  • New TabRunLifecycleTests and MainViewInvalidationTests.
  • Existing suites updated for the signature changes; tests that drove the selection implicitly pass the shown tab (commandTabId).
  • verify.sh build, full Unit plan, lint on every changed file.

Closes #4270

@datlechin
datlechin merged commit 7f759ee into main Nov 14, 2026
11 of 12 checks passed
@datlechin
datlechin deleted the refactor/execution-pipeline-4270 branch November 14, 2026 21:29
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.

Query execution and window state: remaining audit items

1 participant