Repository navigation
fix(route): answer an uninstalled service as NoService - #2238
Conversation
zerob13
left a comment
There was a problem hiding this comment.
Approved at 62d67b97bc27673c32c12f103c685449e2dbeb23. A missing dispatch now returns a non-retryable selection error in both Session and line scope; an invoked owner's error and the existing reload paths retain their behavior. On the exact merge tree, eight routing flows, three router unit tests, and two SDK tests passed. The sessions.call envelope was checked by tracing the mapping and serialization.
The required CI gate is red. Linux passed format, Clippy, build, and declaration validation, then stopped at execStop: internal(control) names no catalog service, before workspace and Node tests. The same failure is present on the current base after #2206 removed the catalog entry. macOS-native passed; Windows was not selected. This approves the PR's code, not bypassing the merge gate.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Goal: a routed call that reaches a Session or line where the requested service has no provider must answer a selection error instead of an owner-shaped failure. This PR adds RouteError::NoService { service }, maps it to SessionsError::NoService on sessions.call, and lists no_service on every surface. The change does that correctly.
Why it is correct:
SessionScope::line_callresolves the line before the service (crates/dim-agent-runtime/src/route.rs:363-370), andSessionScope::callchecks Session liveness before the service (route.rs:339-351).SessionClosingandNoLinestill win overNoService, andNotDataFace/WrongScope/MethodNotRoutablestill win over it, which matches the #2127 order: Session, line, service.call_faceanswersNoServiceonly when the per-instanceHostDispatchis missing (route.rs:446-450), beforeinvoke. No owner runs, and noOwnerconstruction remains for this case.SessionsError::NoServiceis mapped atcrates/dim-app-server/src/agents/sessions.rs:941, andretryable()(sessions.rs:376-387) excludes it, so the envelope reportscode: no_servicewithretryable: false.- Every contract face carries the code:
npm/branch-services.d.ts:1419,1482,1487,1826,1832,npm/plugin.d.ts:308-313,docs/typescript-plugin-authoring.md:36-41,63-70, anddocs/design/contracts/runtime-owner-operations.md:46-51, besides the Rust docs inroute.rsandagents.rs. I found no face that lists the sibling codes but omitsno_service. - The new cases at
crates/dim-agent-capabilities/tests/routing_flow.rs:604-623register a shared branch and Session name with no provider (routing_flow.rs:80-86) and assertNoServicefor bothline_callandcall. They fail on the old code and pass now.
Findings (no P0-P2):
P3 - crates/dim-agent-runtime/src/route.rs:26: the doc phrase change is not a stale-phrase fix. The "two operations" are SessionScope::line_call and SessionScope::call; sessions.call is the process envelope over the same two forms, and the #2127 decision says Rust uses only those two. Problem: the sentence now follows a list of three operations and reads as if Rust calls sessions.call too. Failure scenario: a contributor adds a third Rust entry point or documents the binding incorrectly. Evidence: route.rs:19-23 (the three operations) and route.rs:26; the decision is the comment at #2127 (comment). Fix: keep "the same two operations", or name the two SessionScope operations.
P3 - test coverage stops at the SessionScope surface. Problem: the sessions.call mapping this PR adds is not exercised end-to-end. Failure scenario: a later change maps a missing provider back to Routed at crates/dim-app-server/src/agents/sessions.rs:941, or the code is dropped from the serialized error, and these tests still pass. Evidence: the new cases call scope.line_call/scope.call only (routing_flow.rs:604-623); sessions.call is covered in crates/dim-app-server/tests/routed_call_flow.rs:121-164 with installed faces only, and no test covers an unknown service name or NoLine precedence. Fix: add one case to routed_call_flow.rs that registers a shared name with no provider on the builder (as routing_flow.rs:80-86 does) and asserts the {ok:false, error:{code:"no_service", service, retryable:false}} envelope; optionally assert no_line wins when the line is absent. A follow-up is fine.
Verification:
cargo test --locked -p dim-agent-capabilities --test capabilities_flow routing_flow::passed 8 of 8.cargo test --locked -p dim-agent-runtime --lib route::testspassed 3 of 3.cargo fmt --all --checkis clean.- I did not run
runtime/plugin-sdk.test.mjs:runtime/node_modulesand the npm cache are absent in this offline environment, and the Linux verify job did not reach the Node step. The declaration check did pass ("service declarations passed"), sonpm/branch-services.d.tsis current. - CI now: verify (linux) and ci-ok fail at
execStop: internal(control) names no catalog serviceafter the format, Clippy, build and declaration steps.execStopis incrates/dim-app-server/src/lib.rs:1692on current main (06f1402) and this PR does not touch it; macos-native passed, the other jobs are skipped. - Cross-PR: mergeable with current main. #2226 overlaps
runtime-owner-operations.md(its line 25) andbranch-services.d.ts(its line 1213), not this PR's hunks; #2234 and #1881 do not touch these files.
Not verified: the process-envelope no_service path end-to-end, the Node SDK compile, and the cross-language RouteError serialization. No earlier review opinions to withdraw (round 1).
| //! | ||
| //! Each call looks the target up again, so a caller never keeps a live target | ||
| //! (D4). Rust calls the same two operations: it builds `args` from the target | ||
| //! (D4). Rust calls the same operations: it builds `args` from the target |
There was a problem hiding this comment.
P3. Problem: this is not a stale phrase. The "two operations" are SessionScope::line_call and SessionScope::call; sessions.call is the process envelope that takes the same two forms, and the #2127 decision says Rust uses only those two. Failure scenario: the sentence now follows a list of three operations and reads as if Rust calls sessions.call too, which invites a third Rust entry point or an incorrect binding. Evidence: crates/dim-agent-runtime/src/route.rs:26; the operation list at route.rs:19-23; the decision comment at #2127 (comment). Fix: keep "the same two operations", or name the two SessionScope operations.
There was a problem hiding this comment.
Fixed in b1f5f45. The sentence now names the two SessionScope operations, so it no longer reads as if Rust calls sessions.call for a routed call.
| service: "notInstalledHere".into() | ||
| }, | ||
| "the holder answers a face the Session does not install" | ||
| ); |
There was a problem hiding this comment.
P3. Problem: the new cases stop at the SessionScope surface, so the sessions.call mapping this PR adds is untested. Failure scenario: a later change maps a missing provider back to Routed at crates/dim-app-server/src/agents/sessions.rs:941, or the code is dropped from the serialized error, and these tests still pass. Evidence: the new assertions call scope.line_call/scope.call only (routing_flow.rs:604-623); sessions.call is exercised in crates/dim-app-server/tests/routed_call_flow.rs:121-164 only with installed faces, and no test covers an unknown service name or NoLine precedence. Fix: add one case to routed_call_flow.rs that registers a shared name with no provider on the builder (as routing_flow.rs:80-86 does) and asserts no_service with service and retryable: false; optionally assert no_line wins when the line is absent. A follow-up is fine.
There was a problem hiding this comment.
Fixed in b1f5f45. The new case at crates/dim-app-server/tests/routed_call_flow.rs:170-202 registers a shared branch name with no provider, drives it through sessions.call, and asserts no_service with service and retryable: false, plus no_line precedence for an absent line.
|
@yyhhyyyyyy Both P3 notes are fixed in
CI stays red until #2239 fixes the |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Goal: a routed call that reaches a Session or line where the requested service has no provider must answer a selection error instead of an owner-shaped failure. This PR adds RouteError::NoService, maps it to SessionsError::NoService on sessions.call, lists no_service on every contract face, and covers the process envelope end to end. The change does that correctly.
Round 1 P3s, both fixed and withdrawn:
crates/dim-agent-runtime/src/route.rs:26now says "Rust calls the same twoSessionScopeoperations". That names exactly the two SessionScope operations listed atroute.rs:19-21and matches the #2127 decision, so it no longer reads as if Rust callssessions.callfor a routed call.crates/dim-app-server/tests/routed_call_flow.rs:170-202drives an uninstalled branch face throughsessions.call: the Rig shares a branch name with no provider (routed_call_flow.rs:74-77), then assertsok: false,code: "no_service",service: "notInstalled"andretryable: false, and assertsno_linewins for an absent line. On main (06f1402) the same call answersroutedthroughRouteError::Owner(route.rs:437-446there), so the case fails without the fix.
No new P0-P2 findings in the complete main...head diff. The #2127 order still holds: line_call resolves the line first and call checks liveness first (route.rs:269-286,338-370), and call_face answers NoService only when the per-instance HostDispatch is missing, before invoke (route.rs:445-450). The envelope mapping and retryability are at crates/dim-app-server/src/agents/sessions.rs:941,969-977,376-387. Every surface that lists the sibling codes lists no_service: npm/branch-services.d.ts:1419,1482,1487,1826,1832, npm/plugin.d.ts:308-313, docs/typescript-plugin-authoring.md:36-41,63-70, docs/design/contracts/runtime-owner-operations.md:46-51.
Verification at b1f5f45:
cargo test --locked -p dim-app-server --test routed_call_flowpassed 3 of 3, including the new case.cargo test --locked -p dim-agent-capabilities --test capabilities_flow routing_flow::passed 8 of 8.cargo test --locked -p dim-agent-runtime --lib route::testspassed 3 of 3.cargo fmt --all --checkis clean.node --check runtime/plugin-sdk.test.mjspasses. I did not run the Node SDK compile:runtime/node_modulesis absent in this offline environment.- CI: verify (linux) and ci-ok fail at
xtask checkwithexecStop: internal(control) names no catalog service, after the build, lint, access layer, service declarations and the other static checks pass. The same check fails on current main atcrates/dim-app-server/src/lib.rs:1692; this PR does not touch that file, and #2239 carries the fix, still open. macos-native passed; the other jobs were skipped. CI does not reach the workspace tests at this head, and the macos-native selection does not includerouted_call_flow, so the local run above is the only execution of the new case. - Cross-PR: mergeable with main 06f1402. #2226 touches
docs/design/contracts/runtime-owner-operations.mdline 25,docs/typescript-plugin-authoring.mdline 919 andnpm/branch-services.d.tsline 1213, none of this PR's hunks. #2234 and #2239 do not touch these files.
Not verified: the Node SDK compile and the Linux workspace test run, which CI does not reach.
APPROVE
Simon-He95
left a comment
There was a problem hiding this comment.
Reviewed at b1f5f457.
The direction matches the #2127 decision: NoService { service } is one of the selection answers, answered by the holder before any owner runs, and final. The implementation puts it in the right place: face() first proves the name is a data face of the target's group, then call_face answers NoService only when the selected instance has no provider (crates/dim-agent-runtime/src/route.rs:445-451); sessions.call maps it to its own non-retryable no_service (crates/dim-app-server/src/agents/sessions.rs:941, and retryable() covers only reloading/publication-unknown). The tests cover line_call and call on a catalog-shared name the profile omits, and the process envelope pins line selection before service selection and retryable: false.
External interface: an additive variant on the existing sessionScope.lineCall/call and sessions.call faces. The behavior change — a missing provider was previously reported as routed with a fake owner failure — is the classification the #2127 decision already specifies. I checked the TUI and dim-electron: neither matches these codes, and the generated npm/branch-services.d.ts, npm/plugin.d.ts, the TypeScript authoring guide and the runtime owner operations contract are updated consistently. No RPC method, event or persistence change.
CI at this head: verify (linux) fails in xtask check with execStop: internal(control) names no catalog service, which is the pre-existing failure on main at 06f14021 (main run 45836621783 fails identically), not this PR. macos-native is green. Approval is code review only; the merged tree needs a green run before merge.
No blocker from my side.
A routed call that selects a Session or line where no provider of the
service is installed was answered as the owner's own failure
("... is not provided now"). No owner ran, so the holder answers it:
RouteError::NoService { service }, and `no_service` on `sessions.call`,
final and not retryable, as the #2127 decision states.
Refs #2127
Restores the route docs to name the two SessionScope operations Rust calls, and adds a process-envelope case: an uninstalled branch face answers no_service, non-retryable, and an absent line still answers no_line first. Refs #2127
b1f5f45 to
d0bb910
Compare
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Goal: a routed call that reaches a Session or line where the requested service has no provider must answer a selection error instead of an owner-shaped failure: RouteError::NoService, envelope code no_service, retryable false, and the code listed on every contract face.
Rebase and new commit:
- The head is two commits on 770f848. The full
main...headdiff is patch-identical to the previously approved b1f5b457 diff; only theagents.rshunk offset moved with main. The new test commit restores the route.rs wording "Rust calls the same twoSessionScopeoperations" and adds the process-envelope case atcrates/dim-app-server/tests/routed_call_flow.rs:170-202. - The new case registers a catalog-shared branch name with no provider (
routed_call_flow.rs:74-77), drivessessions.call, and asserts the full envelope:ok: false,code: "no_service",service: "notInstalled",retryable: false(routed_call_flow.rs:186-189), thenno_linefor an absent line (routed_call_flow.rs:190-199). I copied it onto 770f848 without the fix and it fails at the code assertion with{"code":"routed","name":"notInstalled","message":"notInstalled is not provided now",...}, so it pins the change. It does not duplicate the SessionScope cases and follows the Rig, launch and shutdown conventions of this file.
No P0-P2 findings. The previous P3s are fixed and withdrawn.
Code and contract check:
RouteError::NoServiceis defined atcrates/dim-agent-runtime/src/route.rs:86-90, maps tono_serviceatroute.rs:130, and is returned only when the selected instance has no dispatch for the face (route.rs:445-450).line_callresolves the line before the service (route.rs:362-370), andcallchecks liveness and the face before the same lookup (route.rs:338-341), sono_line,session_closing,not_data_face,method_not_routableandwrong_scopestill win.SessionsError::NoServiceis atcrates/dim-app-server/src/agents/sessions.rs:315-317, mapped atsessions.rs:941, serialized by the envelope atsessions.rs:969-979, and excluded fromretryable()atsessions.rs:376-387. The envelope is{ok: false, error: {code: "no_service", service, message, retryable: false}}.- Every face that lists the sibling codes lists
no_service:npm/branch-services.d.ts:1419,1482,1487,1826,1832;npm/plugin.d.ts:307-313;docs/typescript-plugin-authoring.md:36-41,63-70;docs/design/contracts/runtime-owner-operations.md:46-51;runtime/plugin-sdk.test.mjs:140; plus the Rust docs atroute.rs:43-45,crates/dim-app-server/src/agents.rs:1825-1827andsessions.rs:299-302. I found no face that lists the siblings and omits it.
Verification:
cargo test --locked -p dim-app-server --test routed_call_flow: 3 passed, including the new case.cargo test --locked -p dim-agent-capabilities --test capabilities_flow routing_flow::: 8 passed.cargo test --locked -p dim-agent-runtime --lib route::tests: 3 passed.cargo fmt --all -- --check --config error_on_line_overflow=trueandnode --check runtime/plugin-sdk.test.mjspass.- CI at d0bb910:
verify (linux),macos-nativeandci-okpass; the other jobs are skipped. This includesxtask checkand the generated declaration validation. - Cross-PR: mergeable with main 770f848; no file overlap with #2234, #2244 or #1881. #2226 touches
runtime-owner-operations.md,typescript-plugin-authoring.mdandbranch-services.d.tsat different hunks (25, 919, 1213), so it does not conflict with this PR's hunks. - I did not run the full workspace locally; CI did.
runtime/node_modulesis absent, so the Node SDK test was not run locally.
APPROVE
zerob13
left a comment
There was a problem hiding this comment.
Approved at d0bb9106977dfb9547dea2a7e79dd993f6df3ed9. The rebase preserves both reviewed patches and the routing contract: a selected line or Session missing a registered provider returns no_service with the service name and retryable: false; no_line still takes precedence for a nonexistent line. Owner errors and reload retry behavior are unchanged.
PR check passed Linux, macOS, and ci-ok on d015fd8e6d9173b0f396b4235d9336f7492699ee. Linux passed the catalog check that stopped the old run, then ran the routing and envelope coverage, workspace tests, and Node binding checks. Windows was not selected. No remaining review blocker.
Summary
Refs #2127. Follow-up to #2174, which merged before this point of the #2127 decision landed.
When a routed call selects a Session or a line but no provider of the service is installed there (its profile leaves the service out), the runtime answered it as the owner's own failure:
Owner { name: service, message: "... is not provided now" }, whichsessions.callreported asrouted. No owner ran, so the holder now answers it as a selection answer:RouteError::NoService { service }(crates/dim-agent-runtime/src/route.rs), codeno_service;SessionsError::NoService { message, service }onsessions.call, final and not retryable;npm/branch-services.d.ts;npm/plugin.d.ts, the TypeScript authoring guide and the runtime owner operations contract list the new code.Also fixes one stale phrase in the
route.rsmodule docs ("Rust calls the same two operations": there are three).Design rule checklist
beforecallbacks: n/a.sessionScopeandsessionsfaces.Documentation
Verification
cargo test -p dim-agent-capabilities --test capabilities_flow routing_flow: new cases call a line face and a Session face the catalog shares but the profile does not install, and both answerNoService.cargo test -p dim-agent-scheduler --test scheduler_flow data_faces_flownode --test runtime/plugin-sdk.test.mjs(theSessionsErrorThrowncode union includesno_service)cargo fmt --check, clippy-D warningson the three touched crates,node scripts/adr-check.mjs --base origin/maincargo run -p xtask -- check: access layer, service declarations and the other static checks pass. It then stops atexecStop: internal(control) names no catalog service, which fails the same way on main at79ce0a2b7without this change.