Repository navigation
Description
Summary
The free app reloads schemas and collections when pro:tier-detected fires. That works only because the Pro capability probe happens to be the first real gRPC round trip at startup.
This issue:
- adds one shared, bounded data-plane round trip to
GrpcClient, and makes the wedge probe inprobe_and_recover_channeluse it, with the same semantics; - emits a neutral
daemon:data-plane-readyevent from core's startup task, after the post-startup reachability check succeeds and the daemon answers (ADR-082 (proposed) §3.4); - switches
app-shell.svelteto that event; - replaces the tautological test with a source-contract test.
The Pro probe and its pro:tier-detected emit stay untouched; #3334 deletes them. After this issue, #3334 can do so without silently dropping the free app's reload.
Context (main @ af8ddb6; locate by symbol)
-
The emitter. In
src-tauri/src/lib.rsrun(), the spawned startup task runs the Pro probe block (607-635), which emitspro:tier-detectedwhatever the outcome. The post-startup reachability check follows (637-663):check_daemon_socketonresolve_socket_path(). OnNotRunningit logsnodespaced unreachable after startupand emitsdaemon-status: not_running. -
The listener. In
src/lib/components/layout/app-shell.svelte:import { schemasData }(22); this listener is its only use;unlistenTier(249);- the listener (277-284), which calls
schemasData.loadSchemas()andcollectionsData.loadCollections(); - its cleanup (599-601).
Its comment gives the reason for it:
healthyonly proves the socket accepts a connection (daemon_setup.rscheck_daemon_socket, aUnixStream::connect), not that gRPC answers. -
Duplicated probe logic.
src-tauri/src/commands/nodes.rsprobe_and_recover_channelhas a privateprobe(). It sends oneGetNodefor__ns_channel_probe__bounded by 5 s, treats any completion as live, and treats only a timeout as a wedge. A healthy daemon answers that id withNotFound(packages/daemon/src/services/node_service.rsget_node). -
The only test is a tautology.
src/tests/unit/props-driven-components.test.ts246-270 defines its own handler and calls it. -
The doc.
src/lib/services/daemon-status.ts17-19 describes the module as generalising "the one-offpro:tier-detectedreload pattern". -
ADR-082 §3.4 says this reload must not be lost silently: core emits a core-named event after its post-startup reachability check succeeds.
Scope
src-tauri/src/services/grpc_client.rs- Add
pub const DATA_PLANE_PROBE_TIMEOUT: Duration = Duration::from_secs(5);and the sentinel id__ns_channel_probe__, moved fromnodes.rs. - Add
#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum DataPlaneRoundTrip { Answered, Failed(tonic::Code), TimedOut }:Answered: a response, orNotFound, which is what a healthy daemon returns for the sentinel id;Failed(code): the call completed with any other status, such as a transport failure while nothing serves the socket, or a daemon-side error;TimedOut: no completion within the timeout, meaning a wedged channel or a daemon that does not answer.
- Add
pub async fn data_plane_round_trip(&self, timeout: Duration) -> DataPlaneRoundTriptoimpl GrpcClient, next tochannel(). It sends oneGetNodefor the sentinel id onself.client().await, insidetokio::time::timeout.
- Add
src-tauri/src/commands/nodes.rsprobe_and_recover_channel- Delete the private
probe(),PROBE_TIMEOUTandPROBE_ID. - Both probes become
!matches!(client.data_plane_round_trip(DATA_PLANE_PROBE_TIMEOUT).await, DataPlaneRoundTrip::TimedOut). That keeps "any completion is live, only a timeout is a wedge" exactly. - Leave the
ProClientrebind block and its doc paragraph for Delete the pro_* commands, ProClient, startup Pro probe and Pro rebind from core #3334.
- Delete the private
src-tauri/src/lib.rs- Next to
check_daemon_status, addpub const DATA_PLANE_READY_EVENT: &str = "daemon:data-plane-ready";. Document it as emitted at most once per app start, after the post-startup reachability check, when the daemon answers a real gRPC round trip, with anullpayload. - In the startup task, clone the client before it moves into
start_token_stream_subscription, for examplelet data_plane_client = grpc_client.clone();. - Make the reachability block evaluate to
socket_reachable:trueunlesscheck_daemon_socketreportsNotRunning. Keep itsnot_runningemit and thenodespaced unreachable after startuplog line byte-identical; Add daemon-ready tasks and a channel-rebuilt hook to AppExtensions #3307's source-text test anchors on that line. - After that block, at the end of the task:
- if
socket_reachableanddata_plane_client.data_plane_round_trip(DATA_PLANE_PROBE_TIMEOUT).awaitisAnswered, callapp_handle.emit(DATA_PLANE_READY_EVENT, ()). This is a broadcast, like the event it replaces. Logtracing::warn!if the emit fails, andtracing::info!when it succeeds. - Otherwise log a
tracing::warn!with the outcome and emit nothing.
- if
- Reword the reachability comment (637-646). It says "After the probe has exercised the channel"; describe the socket check without referring to the probe.
- Do not change the Pro probe block (607-635), or Add daemon-ready tasks and a channel-rebuilt hook to AppExtensions #3307's channel-ready hook call if Add daemon-ready tasks and a channel-rebuilt hook to AppExtensions #3307 has landed.
- Next to
src/lib/services/daemon-status.ts- Export
DATA_PLANE_READY_EVENT = 'daemon:data-plane-ready', documented as mirroring the Rust constant. - Reword the module doc at 17-19 so it names the neutral event and no Pro event.
- Export
src/lib/components/layout/app-shell.svelte- Add
DATA_PLANE_READY_EVENTto the existing$lib/services/daemon-statusimport. - Rename
unlistenTier(249) tounlistenDataPlaneReady, and rename its cleanup (599-601) to match. - Replace 277-284 with a listener on
DATA_PLANE_READY_EVENTthat makes the same two calls. Its comment describes gRPC readiness and does not mention Pro. - Keep
import { schemasData }. Leave theproSynclines (36, 248, 256-263, 605) for Stop driving Pro sync lifecycle from the app shell, database store and debug channel #3329.
- Add
src/tests/unit/props-driven-components.test.ts- Replace the tautological test (246-270) and keep the
NavigationSidebar Tauri independencedescribe. - The new tests read source with
node:fsreadFileSync. The cwd ispackages/desktop-app, as insrc/tests/services/persistence-timing-constants.test.ts. They assert:app-shell.sveltecontainslisten(DATA_PLANE_READY_EVENT, and the 300 characters after it containschemasData.loadSchemas()andcollectionsData.loadCollections();app-shell.sveltedoes not contain the legacy event name. Build that needle from fragments (['pro', 'tier-detected'].join(':')), per Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299's absence-test convention, so neither the ratchet nor anyrg pro:tier-detectedsearch matches this test;DATA_PLANE_READY_EVENTis'daemon:data-plane-ready', andsrc-tauri/src/lib.rs(or the constant's new file, if Split the desktop Tauri crate and add ADR-082's Tauri extension points #3322's library split moved it) contains that value in double quotes;navigation-sidebar.sveltedoes not import@tauri-apps/api/event.
- Replace the tautological test (246-270) and keep the
Out of scope
- Deleting the Pro probe,
ProClient, the rebind or thepro:tier-detectedemit (Delete the pro_* commands, ProClient, startup Pro probe and Pro rebind from core #3334). - The pro-sync store's own
pro:tier-detectedlistener (Move the Pro sync and collaboration UI out of core #3333). onDaemonReconnectsemantics, or which stores register with it.
Coordination
- Stop driving Pro sync lifecycle from the app shell, database store and debug channel #3329 depends on this issue. It must keep
unlistenDataPlaneReady(declaration, listener and cleanup),import { schemasData }and the tests above. It removes onlyproSync's import, start and cleanup. - Remove Pro and cloud-sync wording from frontend comments, tests and the fly-out tooltip #3366 no longer rewords the
daemon-status.tsmodule doc. - Route the desktop app through run(extensions, context) with no extensions in core #3306 and Add daemon-ready tasks and a channel-rebuilt hook to AppExtensions #3307 move this code into
run_withunchanged. Add daemon-ready tasks and a channel-rebuilt hook to AppExtensions #3307's channel-ready hook call stays before the reachability check, and this emit stays after it.
Steps
- Run the CLAUDE.md startup sequence:
git pull origin mainin the primary checkout;EnterWorktree({name: "issue-<N>-data-plane-ready-event"});bun install;- a
bun run testbaseline; bun run gh:assign <N> "@me";bun run gh:status <N> "In Progress".
- Add
data_plane_round_trip, the enum and their unit tests, and pointprobe_and_recover_channelat them. - Add the Rust constant, the emit, the comment rewording and the source-text test in
lib.rs, plus the integration test. - Add the TS constant and the doc rewording, switch
app-shell.svelte, and replace the test. - Run
bun run scripts/check-pro-boundary.tsand paste the printedBASELINES. - Finish and ship:
bun run test:changed;bun run quality:fix, then commit;git push origin HEAD:issue-<N>-data-plane-ready-event;gh pr create --repo NodeSpaceAI/nodespace-core --head issue-<N>-data-plane-ready-event;/pragmatic-code-review, then/address-review, until no re-review is needed;- after the user approves,
bun run merge <PR#>in the background.
Standards:
- No
#[allow(dead_code)]. - No issue numbers in code comments.
- Use
createLogger, notconsole.*. - Run frontend tests with
bun run test, neverbun test.
Acceptance criteria
-
GrpcClient::data_plane_round_tripreturnsFailed(_)for a refused endpoint andTimedOutfor one that accepts but never answers (unit tests), andAnsweredagainst a real daemon (integration test). -
probe_and_recover_channelbehaves as before: any completion is live, and only a timeout rebuilds the channel.src/tests/services/daemon-status.test.tspasses unchanged. -
Each app start emits
daemon:data-plane-readyat most once: after the reachability check, and only when the daemon answered. A source-text test inlib.rspins the placement. -
app-shell.sveltereloads schemas and collections ondaemon:data-plane-readyand no longer referencespro:tier-detected. -
The Pro probe and its
pro:tier-detectedemit are unchanged, and the pro-sync store tests pass. -
The new contract test fails if the listener is removed or pointed back at the legacy event. It contains no
pro:tier-detectedliteral. -
bun run scripts/check-pro-boundary.tspasses, withBASELINESlowered in this PR to the printed counts. Expected at af8ddb6:proEvents−4: app-shell 281,daemon-status.ts17, and the old test's lines 247 and 259;proWording−2: the app-shell comment at 277 and 279.
New code adds no marker line.
Tests and verification
- Unit tests in a new
#[cfg(test)] mod data_plane_round_trip_testsingrpc_client.rs. They use TCP, so they are platform-agnostic, and run under#[tokio::test]. Build the client with the privateGrpcClient::from_channel.a_refused_endpoint_fails_without_timing_out: bind127.0.0.1:0, note the port, drop the listener, and build a channel withEndpoint::from_shared(format!("http://127.0.0.1:{port}"))?.connect_lazy(). ExpectFailed(_)with a 2 s timeout.a_silent_endpoint_times_out: atokio::net::TcpListenerthat accepts connections and holds them without writing. With a 200 ms timeout, expectTimedOut.
- Integration test. In
tests/it/startup_readiness_data_plane_test.rs, addthe_data_plane_round_trip_answers_once_the_daemon_is_healthy:SpawnedDaemon::spawn(),hold_connect_mutex_and_socket_env,GrpcClient::connect_lazy(),wait_for_daemon, then expectAnswered. - Source-text test. A new
#[cfg(test)] mod data_plane_ready_emit_testsinlib.rs. It findsnodespaced unreachable after startup, takes the text from there up toStreamingTaskRegistry::default(), and asserts it containsdata_plane_round_trip(andemit(DATA_PLANE_READY_EVENT. - Mutation-check each new test: break the code path it covers, confirm the test fails, then restore.
- Commands:
cargo test --lib -p nodespace-app data_planecargo build --bin nodespaced && NODESPACED_TEST_BIN="$PWD/target/debug/nodespaced" .tools/bin/cargo-nextest nextest run -p nodespace-app --test it startup_readiness_data_plane_test::cargo clippy -p nodespace-app --all-targets -- -D warnings -D clippy::unused-asyncbun run --cwd packages/desktop-app test src/tests/unit/props-driven-components.test.ts src/tests/services/daemon-status.test.tsbun run test:changed
- Manual check. Run
bun run dev:tauriagainst a dev daemon, never your real~/.nodespace.- Collections and schemas populate, and the log shows the data-plane line after
Pro capability probe done. - With the daemon stopped, the not-running banner shows and no data-plane event is emitted.
- Collections and schemas populate, and the log shows the data-plane line after
Dependencies
- Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299: the ratchet this PR lowers, and the absence-test convention.
Risks and rollback
- No reload when nothing answers. Today the Pro probe emits, and the shell reloads, even when nothing answers. Now the event fires only when the daemon answers. The reconnect-driven loads (
onDaemonReconnect) and the 15 s steady-state poll still cover recovery. - One extra RPC at startup, until Delete the pro_* commands, ProClient, startup Pro probe and Pro rebind from core #3334 removes the probe RPC.
- A missed emit. If the webview registers its listener after the emit, this reload is skipped, exactly as with
pro:tier-detectedtoday.onDaemonReconnectcovers the first load. - A path-based test. If Split the desktop Tauri crate and add ADR-082's Tauri extension points #3322's library split moves
lib.rs, update the path in the mirror test. - Rollback: revert the PR. The Pro probe path is untouched.
Plan key: C4.1 (pro-boundary DAG).
🤖 Generated with Claude Code
Activity
mstomar125 commentedon Oct 1, 2026
Frontend baseline at cb778ae: 308 files, 5606 tests passed
mstomar125 commentedon Oct 1, 2026
Superseded by #3412 (umbrella against the final ADR-081–085)