Repository navigation
Route import-progress events to the window showing the import's database (closes #3002) - #3056
Conversation
…ase (closes #3002) The import commands broadcast `import-progress` to every window via bare `app.emit`, and the payload carried no database id, so concurrent imports (or a second window) could not be told apart. - `GrpcClient::import_client` now returns the client paired with the database id its routing header names, read under one lock so a concurrent switch can't mismatch them. - `ImportProgressEvent` gains `database_id` (omitted for the daemon's default database) and both commands forward through `window_routing::emit_routed` via a shared `forward_progress` helper. - Tests: mock-app routing test (db-1's import reaches only db-1's window) and a serialization test for the default-database case. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Review Type: Initial Review Requirements Check:
Code Review Findings:
No security, lint-suppression, backward-compat, or issue-number-in-comment problems. The change is small, atomic, and matches the existing Recommendation: APPROVE |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
- forward_progress doc: `None` goes to the focused window, not "the default database's window" — a window can be pinned while the client sends no routing header. - New test covers that production path (one pinned window, id None). - Skipped: mid-import database switch dropping later progress (intended routing); frontend database_id filter (nothing consumes it yet). - Startup pin/routing drift filed separately as #3058. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Review addressed (17f5580)✅ #1 (doc note): Tests: Re-review decision: NO RE-REVIEW NEEDED. The changes are one doc comment and one test, with no logic changes. |
Summary
import_markdown_file/import_markdown_filesbroadcastimport-progressto every window with bareapp.emit, and the payload had no database id, so concurrent imports (or a future second window) couldn't be told apart.GrpcClient::import_clientnow returns(ImportClient, Option<String>): the client plus the database id itsx-ns-database-idheader names. Both are read under one lock, so a database switch mid-call can't pair a client with the wrong id.ImportProgressEventgets adatabase_idfield. It is left out of the payload when the import targets the daemon's default database. Both commands now send progress throughwindow_routing::emit_routedusing a sharedforward_progresshelper.ImportProgressEventtype gets an optionaldatabase_id.Not reachable today: there's one window and imports run one at a time. This gets routing right before multi-window or concurrent-import work ships.
Tests
forward_progress_reaches_only_the_window_showing_the_import_database: mock app with two windows pinned to db-1 and db-2. An import into db-1 reaches only db-1's window, and its payload carriesdatabase_id: "db-1".progress_event_omits_database_id_for_default_databasecargo test -p nodespace-app --lib commands::import: 15 passed.bun run test: 5313 passed.--no-verifyat the maintainer's request (a fix for a timing-flaky test is pending), so the full pre-push gate did not run.🤖 Generated with Claude Code