Skip to content

feat(desktop): add observation navigation and unify feedback and context - #2188

Merged
knqiufan merged 13 commits into
oceanbase:masterfrom
sunlight798:feat/desktop-shared-layout-2102
Oct 24, 2026
Merged

knqiufan merged 13 commits into
oceanbase:masterfrom
sunlight798:feat/desktop-shared-layout-2102

Conversation

@sunlight798

@sunlight798 sunlight798 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Closes #2102.

Rationale for this change

Desktop needs consistent navigation, feedback and recovery guidance, with the current connection and exact Scope visible across pages. These improvements must preserve existing workflows and protect drafts when asynchronous connection, Scope and write results arrive.

Packaged macOS testing also exposed navigation-origin and confirmation-dialog issues that prevented reliable use of the shared shell.

What changes are included in this PR?

  • Add Observation with Runtime state, Current-Scope inventory & usage, and This session tabs. Preserve Overview as the initial page and keep Settings & diagnostics at the bottom.
  • Standardize loading, empty, unavailable and error feedback, including recovery guidance for definitively failed writes.
  • Show the current connection, full address and exact Scope ID globally. Present identity, compatibility and health facts separately.
  • Open the selected connection profile from the global menu without activating it.
  • Protect drafts during pending connection and Scope changes, cancelled navigation and late responses. Preserve unknown-write confirmation and duplicate-submission protections.
  • Add disconnected Memory entry paths for local setup and an existing Server, offline-accessible Local Server guidance, bilingual help and copyable documentation/support addresses.
  • Replace host confirmation dialogs with application dialogs supporting keyboard focus containment, Escape cancellation and focus restoration.
  • Accept the platform-specific packaged application origin, including tauri://localhost on macOS, while retaining navigation restrictions.
  • Update English/Chinese documentation, regression tests and validation records.

Observation data integrations remain explicitly unavailable pending #2105, #2106 and #2107. Server installation and lifecycle management remain owned by #2117.

Are there any user-facing changes?

Yes. Users gain Observation navigation, clearer global context, consistent recovery guidance, help and local setup entry points, and reliable application confirmations on macOS.

Existing connection, Scope, Memory and diagnostic workflows remain accessible. Language and theme changes preserve drafts. Selecting a saved profile opens its editor without activating it, and Observation navigation does not trigger connection checks.

There are no changes to public HTTP APIs, IPC command schemas, credential formats or persisted data formats. No migration is required.

How was this change tested?

Validation is recorded in desktop/VALIDATION.md, using Node 24.14.1, pnpm 11.13.1 and Rust 1.95.0.

Passed checks:

pnpm --dir desktop test
pnpm --dir desktop typecheck
pnpm --dir desktop lint
pnpm --dir desktop build
pnpm --dir desktop ipc:check
cargo fmt --manifest-path desktop/src-tauri/Cargo.toml --check
cargo clippy --locked --manifest-path desktop/src-tauri/Cargo.toml --all-targets -- -D warnings
cargo test --locked --manifest-path desktop/src-tauri/Cargo.toml

Generated contracts and icons were checked without regeneration.

Regression coverage includes navigation, bilingual feedback, exact Scope identity, targeted profile selection, draft cancellation, pending context changes, late responses, failed and unknown writes, confirmation dialogs and keyboard focus.

Windows headless Edge checks with synthetic IPC covered English/Chinese, light/dark/system themes, narrow windows, 800×600 layouts, error states and forced colors. The 200% layout check used an equivalent viewport; it was not native WebView zoom acceptance.

On macOS 26.5.1 Apple Silicon, a debug application was built with:

pnpm --dir desktop tauri build --debug --bundles app --ci -- --locked

The packaged application loaded without Vite, and native state/version IPC worked. Actual WebView checks covered bilingual draft navigation, cancel-editing confirmations, explicit discard, Escape cancellation, Tab/Shift+Tab containment and Scope-dialog focus restoration.

Packaged macOS checks did not use a real Server. Signing/notarization, Intel Mac, IME, VoiceOver, native 200% zoom, Keychain and installed Server workflows remain unqualified.

Repository-wide uv run --locked prek run -a encountered existing Windows Python type-check failures in unchanged code; the other hooks passed.

AI usage statement

OpenAI Codex assisted with implementation, regression tests, documentation and review.

Copilot AI balanced review requested due to automatic review settings October 22, 2026 05:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Copilot AI balanced review requested due to automatic review settings October 22, 2026 08:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Comment thread .github/workflows/desktop.yml Outdated
working-directory: .
run: |
uv run --no-sync ruff check --no-fix desktop/tests/installed_ui.py desktop/tests/installed_fixture.py desktop/tests/installed_workflow.py desktop/tests/fixture_qualification.py
uv run --no-sync ruff check --no-fix desktop/tests/installed_ui.py desktop/tests/installed_fixture.py desktop/tests/installed_workflow.py desktop/tests/installed_lifecycle.py desktop/tests/fixture_qualification.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] harness 静态检查清单仍漏 installed_boundaries.py

本次把 desktop/tests/installed_lifecycle.py 加进这四条 ruff / format / ty 命令,但同一目录下的 desktop/tests/installed_boundaries.py 仍未纳入。它不是孤立脚本:desktop/tests/installed_workflow.py:25 直接 from installed_boundaries import exercise_note_budget, exercise_search_limit,而 installed_ui.py:213 无条件调用 exercise_memory,所以该文件在 Windows 安装包验收里真实执行,却从不被 lint / format / ty 检查。

证据:desktop/tests/*.py 共 8 个文件。real_cli.py / real_server.py 由第 113 / 116 行作为脚本执行;fixture_qualification.py 与另外四个 installed_*.py 在本清单内;installed_boundaries.py 是唯一既不在本清单、也不被单独执行的模块。同时 desktop/VALIDATION.md 的 "The five installed-harness Python files passed Ruff lint/format and Windows/Linux ty check" 会让读者把这一遗漏读成「全部 harness 文件已覆盖」。

建议:把文件枚举改成 desktop/tests/installed_*.py desktop/tests/fixture_qualification.py,或显式补上 installed_boundaries.py;否则下次新增 harness 模块仍会漏,而「Ruff/ty 通过」这句话的覆盖范围无法从命令本身看出来。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已改为自动收集全部 installed_*.py,与 fixture_qualification.py 共用四项静态检查,覆盖 installed_boundaries.py。

Comment thread desktop/src-tauri/src/ipc.rs Outdated
url.scheme() == "http" && url.host_str() == Some("tauri.localhost")
} else {
url.scheme() == "tauri" && url.host_str() == Some("localhost")
} && url.port().is_none();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 端口判断被移出平台分支后,Windows / Android 形态缺端口拒绝断言

先说结论:当前行为没有回归。if cfg!(...) { A } else { B } && url.port().is_none() 里的 && 作用于整个 if-else 表达式,我写了独立探针确认(if true { true } else { false } && false 求值为 false),所以 packaged 仍等价于 base 的「分支命中 且 无端口」。

问题是这段代码的回归保护:

  1. 新增的负向用例只覆盖 tauri://localhost:8000。在 Windows / Android 上这条已经被 scheme 判断(只接受 http)拒掉,真正只能由 url.port().is_none() 拦住的是 http://tauri.localhost:8000,它不在 blocks_remote_navigation_and_userinfo 的拒绝对照表里。
  2. 结构上端口条件现在看起来像属于 else 分支。若后续有人把 && url.port().is_none() 挪进 else 或给分支加括号,Windows 上会静默放行任意 http://tauri.localhost:<port>,而现有全部断言(LOCAL_ORIGIN 放行、tauri://* 拒绝、other_platform 拒绝)仍然全绿——这是导航白名单,属于安全边界。

建议:把端口条件写回各分支表达式(url.scheme() == "http" && url.host_str() == Some("tauri.localhost") && url.port().is_none()),并在同一用例补 http://tauri.localhost:8000 的负向断言。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已将端口限制显式写入各平台分支,并补充 http://tauri.localhost:8000 的拒绝断言。

Copilot AI balanced review requested due to automatic review settings October 23, 2026 12:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@knqiufan knqiufan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two reproducible P2 issues remain in draft preservation and keyboard focus restoration. Details are attached inline. Both reproductions used UI tests with mocked IPC; no installed-package acceptance is claimed.

Comment on lines +337 to +338
key={connectionSelection?.request ?? 0}
initialProfileId={connectionSelection?.id}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Preserve new drafts when reopening a profile with a pending save

Start saving a connection profile, then use the global menu to select that same profile again, confirm discard, and enter a new draft before the save resolves. The new key remounts Connections with busy = false, allowing editing while the previous save remains pending. When that response reaches receiveState, the profile revision changes and the new editor's [selected, profile?.revision] effect calls reset(profile), overwriting the new input and clearing its dirty guard. A mocked-IPC UI reproduction changes First new draft to First saved when the old response arrives, including with active: null as returned when saving an active profile. Preserve the newer draft across that revision update, or keep editing that profile disabled until its pending save completes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

late save responses no longer overwrite new drafts entered after reopening the same profile. The discard guard remains intact. Regression tests cover responses that retain or clear the active connection.

Comment on lines +105 to +106
const target = restore.current ? restore.current() : previous;
if (target === null) return;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Restore focus when Scope recovery stays on the Connections page

With local state loaded and no active connection, open the Scope dialog while already on Connections, then choose "Manage connections and credentials" ("管理连接与凭据"). The callback clears scopeReturnFocus.current and closes the dialog, but navigate("connections") returns early because the page is unchanged. This null-target return also skips the modal's fallback, so neither path restores focus. A mocked-IPC UI reproduction confirms that document.activeElement becomes document.body after dismissal. Restore focus to the page heading or the original trigger even when recovery does not change pages.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scope recovery now restores focus to the page heading when already on Connections, while preserving the draft.

Copilot AI balanced review requested due to automatic review settings October 23, 2026 14:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Copilot AI balanced review requested due to automatic review settings October 23, 2026 15:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@AlexStocks AlexStocks added the 1.4.1 v1.4.1 release tracking label Oct 24, 2026

@knqiufan knqiufan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@knqiufan
knqiufan merged commit 9250779 into oceanbase:master Oct 24, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.4.1 v1.4.1 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(desktop): establish the shared application layout and navigation

4 participants