Add Tauri/GPUI shell contract tests for deeplink, tray, and search cores

Closed
DE
2mo ago
+956-10

Summary

Problem: ANLG-320 Phase 1 requires contract tests proving the Tauri plugins and the GPUI shell interpret the same inputs identically through the extracted core crates. Until now each adapter only had its own ad-hoc tests, so the two shells could drift silently (e.g. one treating a URL as a share-open and the other as a focus request).

Fix: Each core crate owns golden fixtures and exposes them behind a contract-fixtures feature (anlg_<core>::contract::*_cases()); both adapters consume the same fixtures in their tests.

  • deeplink-core: tests/fixtures/deeplink_contract.json (24 URLs across all DeepLink variants × anarlog/-staging/-dev schemes, share/open, malformed, redaction) and callback_contract.json (6 parse_callback/render_html_from_callback cases). Asserted by the core, by plugins/deeplink2 (new pure classify(url) -> Classified seam that process_url now calls; Invalid carries the parse error), and by desktop-gpui::deeplink::classify plus scheme(bundle_id).
  • tray-core: tests/fixtures/tray_contract.json (8 cases for agenda_sections, menu_bar_title, next_schedule_refresh_ms), asserted by the core and by the GPUI EventRow -> TrayScheduleEvent conversion. The Tauri tray plugin receives already-converted events, so it has no adapter-side seam to test.
  • search-index: contract module with a fixed en/ko/ja document set and requests (term, phrase, created_at range, CJK, limit, no-match) asserting hit order and highlight ranges; adds Collections::reload so freshly indexed docs are visible deterministically. Neither the tantivy plugin nor GPUI has a thin request-mapping wrapper, so this is core-only.

No shell divergences were found; all fixtures pin current core behavior.

Verification

  • cargo test --locked -p deeplink-core -p tray-core -p search-index (15 / 14 / 25 tests)
  • cargo clippy --locked -p deeplink-core -p tray-core -p search-index --all-targets --no-deps -- -D warnings
  • cargo test --locked -p tauri-plugin-deeplink2 -p tauri-plugin-anlg-tray (8 / 12) and clippy -D warnings on deeplink2
  • In the ubuntu-24.04 CI-equivalent container: cargo test --locked -p desktop-gpui deeplink (8), ... tray (4), cargo clippy --locked -p desktop-gpui --all-targets --no-deps -- -D warnings
  • pnpm exec dprint fmt / rustfmt --edition 2024 on changed files

Link to Devin session: https://app.devin.ai/sessions/f83ed73d85c648fcbdbd041cd4f15720
Open in Devin Desktop: https://app.devin.ai/desktop/session/f83ed73d85c648fcbdbd041cd4f15720?variant=devin
Requested by: @ComputelessComputer