Repository navigation
Conversation
# Conflicts: # npm/branch-services.d.ts
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Full review of origin/main...HEAD at 2bab82a, three non-merge commits.
APPROVE. The change matches the agreed owner operations in docs/design/contracts/process-owner-operations.md: Connection to UiHost binds detach/release/finished (line 47), PluginManager to UiExtensions binds plugins/refusal/register/withdraw (line 30), uiHost and uiExtensions are marked data in the catalog, and serverControl/connectionHub leave it while their typed handles stay private to the crate. Native call paths and the Node fixture reach the same UiHost and UiExtensions instances.
Checks run in an isolated home with LC_ALL=en_US.UTF-8:
- cargo fmt --all -- --check: pass.
- node scripts/adr-check.mjs --base origin/main: pass.
- cargo run --locked -p xtask -- check: pass (service catalog, plugin documents, literal main).
- cargo clippy --locked -p dim-app-server --all-targets -- -D warnings: pass.
- cargo test -p dim-app-server --test transport_flow -- ui_host::, ui_extensions::, plugin_manager:: and reload::process_plugin_reloads_keep_sessions: pass. The Node tests stay ignored without DIM_TEST_NODE.
- cargo test -p dim-app-server --lib -- agents::tests:: (12 passed): pass.
- Generated app-server/services.json and catalog.md match the assembly, and npm/branch-services.d.ts matches the service macro; xtask check confirms both.
- CI at review time: changes and dependencies passed; verify (linux) and macos-native were still queued.
Optional notes, detailed inline:
- uiExtensions.register trusts a caller supplied Package, including an absolute root, while the owner contract names PluginManager and its validated content. If supported content is meant to be registrable from another language, validate the structured package at the face; otherwise state the restriction in the owner contract.
- The new Node test never exercises the only effect of finished, clearing disposing, and no detach/disconnect race. One native test would pin the behavior.
- register returns Result<(), String> across the new face, so the generated error carries code "Error". A typed error would let callers branch by kind.
Merge conflicts with open PRs: #1910 and #1913 conflict in crates/dim-app-server/src/lib.rs (the register_faces list); #1907 conflicts in crates/dim-app-server/src/connection.rs (RpcPlugin::new, where this PR sets hub/control to Key::of and #1907 sets loader); #1902 conflicts in docs/architecture/rust-agent/generated/catalog.md. The generated app-server/services.json also overlaps with #1907 and #1902 and must be regenerated after either lands. There is no conflict with current origin/main.
Unverified: the new Node test node_ui_operations_use_the_connected_client_and_extension_catalog needs DIM_TEST_NODE, DIM_TEST_JS_RUNTIME and runtime/node_modules, which are not installed here. CI runs it in the node group.
zerob13
left a comment
There was a problem hiding this comment.
Static review of 2bab82ae1521b9e7f55d94d74717d79f7f723ca1 against ffd3e11623267f15e11421aa419532e131da82cb. Please address both inline findings before merge.
Isolated checks passed for the ADR freeze (node scripts/adr-check.mjs --base HEAD^1), fixture syntax (node --check runtime/fixtures/ui-owner.ts), and whitespace (git diff --check HEAD^1 HEAD).
CI run 44745442704 uses merge commit 53770ceb8cf53f92b169569740629d0edbc1c0da, whose tree matches the reviewed head. Change selection, dependency checks, macOS native flows, Linux build and lint, and Linux boundary checks passed when checked. Linux workspace tests were in progress, Node binding verification was pending, and Windows CLI was skipped. Local Rust, Node integration, and tmux results are unverified. Electron lag is tracked downstream and is outside the merge criteria for this review.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Re-review of origin/main...HEAD at 25e6610 against ffd3e11. The head adds one commit over 2bab82a that touches only npm/plugin.d.ts and runtime/fixtures/ui-owner.ts; the rest is unchanged.
REQUEST_CHANGES. The TypeScript return shape is fixed. One blocking item remains at the new uiExtensions face.
Blocking: uiExtensions.register still takes the caller's Package
Problem: the data face at crates/dim-app-server/src/ui_extensions/mod.rs:131 accepts UiExtensionRegistration.package and passes it to prepare (ui_extensions/mod.rs:143-152) without the checks the manifest path applies. Package::read is the only path that enforces root containment under the plugin directory and validates panels (crates/dim-app-server/src/ui_extensions/manifest.rs:76-155), and its only caller is PluginManager's record reader (crates/dim-app-server/src/plugin_manager/record.rs:421). The owner contract says the face accepts PluginManager's validated content (docs/design/client-ui-extensions.md:433), that declaration parsing belongs to PluginManager (78), and that the directory holds only selected and enabled content (69). The request also carries PathBuf across a data face, which AGENTS.md's cross-language rule excludes.
Failure scenario: a row that injects uiExtensions (the new fixture does, runtime/fixtures/ui-owner.ts:8) calls register({plugin, name, package:{kind:"supported", root:"/Users/", panels:[...]}}) without any manifest. prepare copies the whole tree below root into the UI cache (ui_extensions/mod.rs:217-256 and 257-364), publishes the supplied panels (153-172), and every authorized client sees them in ui.extensions.list and can read the copied bytes through ui.extensions.read (545-559). The same caller can replace or withdraw another plugin's entry by passing its id. This bypasses selection, enablement, root containment and panel validation, and gives any row a host-directory copy plus UI content injection path.
Fix: make the face resolve {plugin} through PluginManager and use its validated Manifest.ui and plugin directory, so no package crosses the boundary; update docs/design/contracts/process-owner-operations.md:30 if the signature changes. If a package must cross, validate it at the face with the Package::read rules, type the root as a string, and require it inside the plugin install directory before mutating configuration.sources or the catalog.
Resolved: UiHost TypeScript results
npm/plugin.d.ts:631-635 now declares detach, release and finished as void, and runtime/fixtures/ui-owner.ts:24, 29 and 30 assert the result is undefined instead of awaiting it. The dispatcher marks the three methods sync and returns Value::Undefined (crates/dim-app-server/src/ui_host.rs:609-633), and the new Node test passes against rutis 0.23.0 locally, so the declaration, the dispatcher and the fixture agree. No other UI or Connection face in this PR declares a sync method as Promise.
Optional from round 1, still open
- finished clearing disposing is untested: the Node test calls finished on a connection that never entered disposing (crates/dim-app-server/tests/transport_flow/ui_host.rs:567-590), so a regression at ui_host.rs:115-120 would not fail.
- register still returns Result<(), String> (ui_extensions/mod.rs:131), so the generated binding keeps StringThrown with code "Error" (npm/branch-services.d.ts:1374).
Checks
Run at 25e6610 in an isolated home with LC_ALL=en_US.UTF-8:
- cargo fmt --all -- --check --config error_on_line_overflow=true: pass.
- node scripts/adr-check.mjs --base origin/main: pass.
- cargo run --locked -p xtask -- check: pass.
- tsc --strict on npm/plugin.d.ts and runtime/fixtures/ui-owner.ts with the rutis 0.23.0 declarations: pass.
- cargo test -p dim-app-server --test transport_flow ui_host::: 4 passed, 1 ignored.
- ui_host::node_ui_operations_use_the_connected_client_and_extension_catalog with DIM_TEST_NODE and the rutis 0.23.0 runtime: pass.
- CI: changes, dependencies and macos-native passed; verify (linux) still queued; windows-cli and web skipped.
Merge conflicts: none with origin/main, which is also the merge base. The round 1 pairwise conflicts remain: #1907 changes loader in the same RpcPlugin::new block where this PR changes hub and control (connection.rs:2472-2474); #1910, #1913, #1902 and #1904 touch the register_faces and register_names lists and the generated catalog.md, app-server/services.json and npm declarations, which must be regenerated after either side lands. #1951 and #1952 do not touch these files.
Unverified: the full Linux and Windows CI runs; the local Node run used Node v24.21.0, not the CI image.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Re-review of origin/main...HEAD at d3ac98c against d38bf67. The head adds one commit over 25e6610 that touches only crates/dim-app-server/tests/transport_flow/ui_host.rs and runtime/fixtures/ui-owner.ts; the rest is unchanged.
REQUEST_CHANGES. The finished coverage is fixed. One blocking item remains at the uiExtensions data face.
Blocking: uiExtensions.register still accepts an unvalidated Package
Problem: the face at crates/dim-app-server/src/ui_extensions/mod.rs:131 takes UiExtensionRegistration.package and passes it to prepare (ui_extensions/mod.rs:143-152) without the manifest checks. Package::read (crates/dim-app-server/src/ui_extensions/manifest.rs:76-155) is the only code that enforces root containment inside the plugin directory and validates panel ids, titles, entries and methods; its only caller is PluginManager's record reader (crates/dim-app-server/src/plugin_manager/record.rs:421). The owner contract says the face accepts PluginManager's validated content (docs/design/client-ui-extensions.md:433), and AGENTS.md excludes PathBuf from a data face. Package now derives Deserialize with Supported { root: PathBuf }, and the generated binding exposes {kind:"supported", root:string, panels} (npm/branch-services.d.ts:1293-1301). The same face also replaces or withdraws any plugin id it names.
Failure scenario: a Node row that declares uiExtensions in inject, as the new fixture does (runtime/fixtures/ui-owner.ts:8), calls register({plugin:"other-plugin", name:"other-plugin", package:{kind:"supported", root:"$HOME", panels:[...]}}). prepare copies the tree below that root into the UI cache (ui_extensions/mod.rs:217-256, 257-364), publishes the supplied panels even when ids, titles or methods are invalid, and every authorized client can list and read the copied bytes (ui_extensions/mod.rs:545-559). The same caller can replace or withdraw another plugin's entry by passing its id. The fixture proves this face is reachable from Node: it calls register with a package (runtime/fixtures/ui-owner.ts:34) and the test observes the refusal.
Fix: keep register on the PluginManager path only and resolve {plugin} to the validated Manifest.ui and plugin directory, so no package crosses the data face. If a package must cross, reject Package::Supported at the face, validate it with the Package::read rules against the plugin install directory, and type root as a string before mutating configuration.sources or the catalog. Update docs/design/contracts/process-owner-operations.md:30 if the signature changes.
Resolved: finished clearing disposing
The new test closes an attached leaf (crates/dim-app-server/tests/transport_flow/ui_host.rs:597-598), which inserts its connection into disposing (crates/dim-app-server/src/ui_host.rs:514-521), then calls uifixture.finished from that leaf's Tui (crates/dim-app-server/tests/transport_flow/ui_host.rs:599-606). The fixture reads presences before (1) and after (2) and asserts no presence is tui (runtime/fixtures/ui-owner.ts:25-31). It fails if finished stops clearing disposing. Local run with DIM_TEST_NODE and the rutis 0.23.0 runtime: pass.
Optional from round 2, still open
register still returns Result<(), String> (crates/dim-app-server/src/ui_extensions/mod.rs:131), so the generated binding keeps StringThrown with code "Error" (npm/branch-services.d.ts:1307-1308, 1374). A caller cannot branch between unsupported content, a failed snapshot and a closed owner.
Checks
Run at d3ac98c in an isolated home with LC_ALL=en_US.UTF-8:
- cargo fmt --all -- --check --config error_on_line_overflow=true: pass.
- node scripts/adr-check.mjs --base origin/main: pass.
- cargo run --locked -p xtask -- check: pass.
- cargo clippy --locked -p dim-app-server --all-targets -- -D warnings: pass.
- cargo test -p dim-app-server --test transport_flow -- ui_host::: 4 passed, 1 ignored; ui_extensions:: and plugin_manager::: 58 passed, 4 ignored.
- ui_host::node_ui_operations_use_the_connected_client_and_extension_catalog with DIM_TEST_NODE and the rutis 0.23.0 runtime: pass.
- tsc --strict on npm/plugin.d.ts and runtime/fixtures/ui-owner.ts: pass.
- CI at d3ac98c: changes, dependencies and macos-native passed. The first verify (linux) attempt failed in actions-rust-lang/setup-rust-toolchain (rustup component download and rename errors, no code step ran), so ci-ok failed and web, windows-cli and acp-registry were skipped; a second attempt was in progress at review time.
Merge conflicts: none with origin/main at d38bf67; git merge-tree is clean and the PR is MERGEABLE. Main moved only in crates/dim-agent-scheduler and its docs since the merge base. The pairwise overlaps remain: #1907 touches connection.rs and plugin_manager.rs; #1911 touches connection.rs; #1910, #1911, #1913, #1902 and #1904 touch lib.rs and the generated catalog, services.json, service-faces.md or npm declarations, which must be rechecked and regenerated after either side lands. #1951 and #1952 do not touch these files.
Unverified: the Linux and Windows CI runs, because the first verify attempt failed at toolchain setup before any code step ran and the rerun had not completed; the local Node run used Node v24.21.0, not the CI image.
zerob13
left a comment
There was a problem hiding this comment.
The synchronous UiHost contract is fixed, and the service now validates the manifest. The existing PluginManager ownership finding remains open.
New test regression: the Node integration fixture still sends the previous package format. The new decoder rejects it before the unsupported-version assertion or the later disposal coverage. Update the fixture together with the owner contract so the integration test reaches those assertions. This is from static review; macOS native passed, but the current Linux/Node run was still in progress when I checked.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Re-review of origin/main...HEAD at f7a68b0 against ffd3e11, full PR, with the delta d3ac98c..f7a68b0 checked separately. The PR makes uiHost and uiExtensions data faces, serves detach, release and finished on uiHost and plugin UI registration on uiExtensions, and adds a Node owner test.
REQUEST_CHANGES. The round 3 blocker is not fixed, and the delta leaves the Node test and the generated declarations failing.
P2, still blocking from round 3: register and withdraw still let any row name the directory and the plugin
Problem: UiPackage carries directory: PathBuf and a raw manifest: Value from the request (crates/dim-app-server/src/ui_extensions/mod.rs:112-117). register passes both to Package::read (crates/dim-app-server/src/ui_extensions/mod.rs:155), and that check only proves the manifest root is inside directory (crates/dim-app-server/src/ui_extensions/manifest.rs:87-93). Containment is relative to a caller-supplied directory, not to a plugin install directory. The face is data now (crates/dim-app-server/src/lib.rs:1444-1445, docs/architecture/rust-agent/generated/catalog.md:64), and the fixture shows a row reaching it (runtime/fixtures/ui-owner.ts:8, 34). withdraw and the package: None arm of register also take the plugin id from the caller (crates/dim-app-server/src/ui_extensions/mod.rs:144-147, 191-204).
Failure scenario: a row calls register({plugin:"other", name:"other", package:{directory:"$HOME", manifest:{version:1, root:".ssh", panels:[{id:"leak", title:{default:"Leak"}, entry:"known_hosts", placement:"session-panel", requires:[], methods:[]}]}}}). prepare registers $HOME as a FileStorage root and copies the tree below .ssh into the UI cache (crates/dim-app-server/src/ui_extensions/mod.rs:269-283), and ui.extensions.read serves every copied file (crates/dim-app-server/src/ui_extensions/mod.rs:383-410). The same caller replaces or withdraws another plugin's entry by passing its id. I verified this end to end with a temporary fixture that registered a directory named by the test and then read a marker file through ui.extensions.read; the test passed. This contradicts docs/design/client-ui-extensions.md:39 and :69 (selected and enabled content only) and :433 (accepts PluginManager's validated content), and AGENTS.md:43 and docs/design/service-faces.md:11 (no PathBuf on a data face). Agree with zerob13 on 4643398124.
Fix: keep register and withdraw on the in-process PluginManager path only. Move them out of the #[rutis::service] impl or mark both #[service(skip)], so no package or host path crosses the data face; the typed binding still calls the same methods. Keep plugins and refusal on the wire for the catalog. If the mutation methods must stay on the wire, resolve the plugin install directory from PluginManager and reject a caller-named directory before mutating sources or the catalog.
P2: the new Node test cannot pass at this head
Problem: the fixture still sends the removed Package shape, {kind:'unsupported', version:2} (runtime/fixtures/ui-owner.ts:34). UiPackage is now {directory, manifest} with deny_unknown_fields (crates/dim-app-server/src/ui_extensions/mod.rs:112-117).
Failure scenario: tsc --strict rejects the literal (TS2353: 'kind' does not exist in type 'UiPackage'), and the ignored Node test fails inside the fixture: the binding rejects the request with BindingError: uiExtensions.register: argument 1: unknown field kind, expected directory or manifest, so the fixture's assert.rejects fails. CI runs this test in the node group of verify (.github/workflows/ci.yml:253-274), so the PR cannot merge green. With the literal changed to {directory: '.', manifest: {version: 2}}, the same test passes locally, including the finished presence assertions.
Evidence: runtime/fixtures/ui-owner.ts:34; crates/dim-app-server/src/ui_extensions/mod.rs:112-117; npm/branch-services.d.ts:1271-1274.
Fix: update the fixture to the current request shape, or drop the register assertions if register leaves the data face per the finding above. Then run tsc --strict on the fixture and the node test.
P2: the generated declarations are stale
Problem: the head hand-edited npm/branch-services.d.ts. It removed export type StringThrown but left the comment /** What a method returning Err(String) throws. */ (npm/branch-services.d.ts:1351-1352). The file is generated by xtask/src/types.rs:11-58.
Failure scenario: cargo run --locked -p xtask -- check fails with npm/branch-services.d.ts: service declarations are stale; run cargo run -p xtask -- types. CI runs target/debug/xtask check in verify (.github/workflows/ci.yml:192-199), so this is a second red gate. Regenerating removes exactly the two stale lines.
Evidence: npm/branch-services.d.ts:1351-1352; xtask/src/types.rs:65-73; local xtask check output.
Fix: run cargo run -p xtask -- types and commit the result. Do not hand-edit generated declarations.
P2: the contracts disagree on who validates the UI manifest
Problem: the code now passes the raw ui Value and the plugin directory from PluginManager (crates/dim-app-server/src/plugin_manager.rs:860-868, crates/dim-app-server/src/plugin_manager/record.rs:420) and validates in UiExtensions (crates/dim-app-server/src/ui_extensions/mod.rs:155). docs/design/plugins/PluginManager.md:87 still says the manifest is parsed at that boundary and owners receive documents already read, and :99 says PluginManager forwards the validated declaration. docs/design/client-ui-extensions.md:46 and :433 say the face accepts PluginManager's validated content, and :78 says PluginManager reports parse failures. The changed row in docs/design/contracts/process-owner-operations.md:30 now says UiExtensions admits the root and panels, and docs/design/client-ui-extensions.md:220 already says UiExtensions reports invalid declarations.
Failure scenario: a new content owner or client implementer cannot tell whether to parse and validate ui or receive a validated value; either implementation contradicts one of the two contracts. This is a contract self-contradiction, not a wording issue.
Evidence: lines above; crates/dim-app-server/src/plugin_manager.rs:860-868; crates/dim-app-server/src/ui_extensions/mod.rs:155.
Fix: keep one division and update the rest. If UiExtensions validates, update PluginManager.md:87 and :99 and client-ui-extensions.md:46, :78 and :433 to say PluginManager forwards the directory and the raw declaration. If PluginManager validates, restore record.rs and change process-owner-operations.md:30.
Resolved and withdrawn
- The round 3 finished finding is fixed and still holds: the test closes an attached leaf, calls uifixture.finished from its Tui, and asserts the connection is counted again (crates/dim-app-server/tests/transport_flow/ui_host.rs:591-606, runtime/fixtures/ui-owner.ts:25-31). The patched run above passed this part. Withdraw it.
- The Result<(), String> optional is fixed: register returns Result<(), ResourceError> (crates/dim-app-server/src/ui_extensions/mod.rs:138) and the binding throws ResourceErrorThrown (npm/branch-services.d.ts:1290-1292, 1345-1346). Replied as fixed.
- Empty package handling is resolved: an absent or null package withdraws (crates/dim-app-server/src/ui_extensions/mod.rs:144-147), an empty or invalid manifest returns invalid_params and a catalog error, and Package::Rejected is gone with no remaining callers.
- The round 2 TypeScript return shape finding stays withdrawn (npm/plugin.d.ts:631-636).
Optional (P3)
- The unsupported version and a malformed manifest share code invalid_params (crates/dim-app-server/src/ui_extensions/mod.rs:160-163). That matches docs/design/client-ui-extensions.md:220 (no separate error code). Distinct codes would help callers that must tell them apart, but this is not blocking.
- UiPackage.directory is still PathBuf on the data face, against AGENTS.md:43 and docs/design/service-faces.md:11. The binding spells it as a string (npm/branch-services.d.ts:1272), but the face still carries a host path. Moving register and withdraw off the wire resolves it.
Checks
Run at f7a68b0 in an isolated home with LC_ALL=en_US.UTF-8:
- cargo fmt --all -- --check --config error_on_line_overflow=true: pass.
- node scripts/adr-check.mjs --base origin/main: pass (18 changed files).
- cargo run --locked -p xtask -- check: fail, stale npm/branch-services.d.ts (the only difference is the two lines at 1351-1352).
- cargo clippy --locked -p dim-app-server --all-targets -- -D warnings: pass.
- cargo test -p dim-app-server --test transport_flow -- ui_host::: 4 passed, 1 ignored. ui_extensions::: 7 passed, 1 ignored. plugin_manager::: 51 passed, 3 ignored. agents::tests::: 12 passed.
- plugin_manager::node_plugin_manager_installs_reloads_and_replaces_typescript_plugins with DIM_TEST_NODE and the local rutis 0.23.0 runtime: pass (environment sanity).
- ui_host::node_ui_operations_use_the_connected_client_and_extension_catalog at this head: fail with the BindingError above. With the fixture shape updated to {directory, manifest:{version:2}} it passes; with a temporary fixture that registered a caller-named directory it also passed and read the copied marker through ui.extensions.read.
- tsc --strict on npm/plugin.d.ts: pass. tsc --strict on runtime/fixtures/ui-owner.ts: fail TS2353 at line 34.
- CI at f7a68b0: changes, dependencies and macos-native passed; verify (linux) pending; web, windows-cli and acp-registry skipped. verify will hit the xtask failure first, and its node group fails too if it reaches that step.
Merge conflicts: none with origin/main at 44f0dd4; merge-tree is clean and the PR is MERGEABLE. Pairwise merge-tree conflicts with open PRs sharing files: #1907 (crates/dim-app-server/src/connection.rs, docs/design/contracts/process-owner-operations.md); #1900 (docs/design/service-faces.md); #1906 (lib.rs, catalog.md, npm/branch-services.d.ts); #1911, #1910, #1909 and #1913 (lib.rs); #1905 (lib.rs, catalog.md); #1912 (lib.rs, npm/plugin.d.ts); #1904 and #1903 (npm/plugin.d.ts); #1902 (catalog.md); #1306 (Cargo.toml, Cargo.lock). #1899 and #1917 are clean. The generated catalog.md, app-server/services.json and npm declarations must be regenerated after either side lands.
Unverified: the Linux and Windows CI runs. The local Node runs used Node v24.21.0 and the rutis 0.23.0 runtime from the local #1910 worktree, not the CI image. I did not copy a real host directory; the end-to-end proof used a fixture directory under the isolated temp home with a marker file.
zerob13
left a comment
There was a problem hiding this comment.
The installed-ID change closes the earlier caller-supplied package issue, and the synchronous UiHost contract remains fixed. One functional blocker remains: plugin_manager.rs:190–200 resolves installation records before the shipped default, independently of the effective selection used to read the manifest (plugin_manager.rs:575–613, :1646). When switching back to the shipped default with a same-ID installed copy still present, ui_extensions/mod.rs:139–150 can pair the default manifest with the other copy’s directory and make the selected UI unavailable or incorrect. Resolve the manifest, directory, and reload replay from the same selected and enabled package identity. Please cover the ordinary switch-back flow with both copies installed. Static review; the exact macOS and static checks passed, and the current Linux/Node result was still pending at review time.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Re-review of origin/main...HEAD at 52d7ec3 against f7a68b0, full PR, with the delta f7a68b0..52d7ec3 checked separately. The PR serves detach, release and finished on uiHost and plugin UI registration on uiExtensions as data faces, and resolves the UI installation directory by plugin ID through PluginManager.
REQUEST_CHANGES. The four round 4 P2 items are fixed. One P2 remains: the new lookup ignores the selected and enabled state, so a trusted caller can publish UI for a plugin the user turned off.
P2: register publishes UI for any installed or default plugin ID
Problem: State::package_by_id returns record.installed(id) or defaults.plugins.get(id) without consulting record.names or using() (crates/dim-app-server/src/plugin_manager.rs:191-200). using() encodes the selected and enabled state: it returns None for an off name and the chosen candidate otherwise (crates/dim-app-server/src/plugin_manager.rs:577-605). UiExtensions::register calls package_by_id and publishes the resolved root (crates/dim-app-server/src/ui_extensions/mod.rs:140-180). Every normal caller passes a used id: reconcile_content calls own_id(name, used) after using() (crates/dim-app-server/src/plugin_manager.rs:416-433), and switch does the same for the new state (crates/dim-app-server/src/plugin_manager.rs:2071-2096). The face does not check the selection.
52d7ec3 does resolve the installation directory from the plugin ID through PluginManager, so the caller can no longer name another plugin's directory or $HOME. The root and panel entries still come from the request's manifest, constrained to that directory; that matches the caller-declaration model at client-ui-extensions.md:46 and process-owner-operations.md:30. What the lookup does not resolve is the selected and enabled state.
Failure scenario: install plugin X (install selects it: crates/dim-app-server/src/plugin_manager.rs:1246, 1342-1349) and let PluginManager register its UI. Disable X, or install a second copy Y and select it; PluginManager withdraws X's UI (crates/dim-app-server/src/plugin_manager.rs:2060-2065, 441-445; docs/design/client-ui-extensions.md:77). A trusted backend row that injects uiExtensions, as runtime/fixtures/ui-owner.ts:8,35-38 shows, calls uiExtensions.register({plugin:'X', manifest:{version:1, root:'ui', panels:[...]}}). package_by_id finds the installed entry regardless of the choice, prepare copies the root, and the catalog lists X again (crates/dim-app-server/src/ui_extensions/mod.rs:150-180). ui.extensions.list and ui.extensions.read serve a plugin that is off or replaced, whose methods are not running. A default plugin name has the same problem after the name switches to an installed copy, because defaults.plugins.get(id) ignores the choice. This contradicts client-ui-extensions.md:69 (catalog contains only selected and enabled content) and client-ui-extensions.md:433 (PluginManager-selected packages), while process-owner-operations.md:30 says any trusted caller can register by ID.
Fix: in package_by_id, require the id to be the candidate using() returns for its name: Use::Installed(id) for an installed entry, Use::Default for a default. Normal callers already pass that id, and the Node test still passes because install defaults enable=true and records use_ (crates/dim-app-server/src/plugin_manager.rs:1246, 1342-1349). If the intended contract is that any trusted caller may republish disabled content, update client-ui-extensions.md:69, 77 and 433 to say so and add a test; I would keep the selected-only guarantee. Add a test that registers a disabled id and expects Unknown plugin ID with no catalog entry.
Resolved and withdrawn
- The round 4 caller-named directory finding is fixed in 52d7ec3: the request no longer carries directory or name; package_by_id resolves both through PluginManager; Package::read checks the root and panel entries against the install directory (crates/dim-app-server/src/ui_extensions/manifest.rs:87-93, 119-125); unknown IDs are rejected before sources or the catalog change (crates/dim-app-server/src/ui_extensions/mod.rs:133-150). This closes zerob13's 4643398124. Withdraw 4646419836 and 4646420532. The permission scope is the P2 above.
- The fixture shape finding is fixed in de3b7a7 and updated in 52d7ec3; tsc --strict and the Node test pass. Withdraw 4646419844.
- The generated declaration finding is fixed in de3b7a7; xtask check passes. Withdraw 4646419852.
- The validation ownership finding is fixed in 52d7ec3: PluginManager forwards the plugin ID and UI declaration, and UiExtensions validates the declaration and resource paths (docs/design/plugins/PluginManager.md:99-100, docs/design/client-ui-extensions.md:46, 78 and 433, docs/design/contracts/process-owner-operations.md:30). Withdraw 4646419857.
- The optional PathBuf item from round 4 is gone with UiPackage. The distinct error code optional is not worth another round; the contract still says one code (client-ui-extensions.md:220).
- zerob13's 4643398132 (UiHost declarations promised Promise while the dispatcher is sync) is fixed in 25e6610: npm/plugin.d.ts:631-636 returns void and runtime/fixtures/ui-owner.ts:28,33,43 asserts undefined. No action.
Optional (P3)
- The fixture pins the unknown-ID and unsupported-version failures but not the canonicalize containment check. A root or panel entry that resolves outside the install directory through a symlink is rejected at crates/dim-app-server/src/ui_extensions/manifest.rs:91 and 123; if that check regressed, the Node test would stay green. Add a native Package::read test with a symlink inside the plugin directory that points to a sibling, or add such a symlink to the installed fixture and assert the rejection.
- The declaration is still caller-supplied. For a selected plugin, a caller can set root to a non-UI subdirectory such as 'src' and expose the plugin's backend source through ui.extensions.read, against client-ui-extensions.md:60. The normal path forwards manifest.ui and the docs give the declaration to the caller (client-ui-extensions.md:46, process-owner-operations.md:30), so this is the documented model, not a regression. If you want the owner to enforce the package's own declaration, read Manifest.ui in package_by_id and reject or ignore a different one.
Checks
Run at 52d7ec3 in an isolated home with LC_ALL=en_US.UTF-8:
- cargo fmt --all -- --check --config error_on_line_overflow=true: pass.
- node scripts/adr-check.mjs --base origin/main: pass (20 changed files).
- cargo run --locked -p xtask -- check: pass (service declarations, plugin locks, comment links, literal main, service catalog).
- cargo clippy --locked -p dim-app-server --all-targets -- -D warnings: pass.
- cargo test -p dim-app-server --test transport_flow -- ui_host::: 4 passed, 1 ignored. ui_extensions::: 7 passed, 1 ignored. plugin_manager::: 51 passed, 3 ignored.
- cargo test -p dim-app-server --lib -- agents::tests::: 12 passed.
- ui_host::node_ui_operations_use_the_connected_client_and_extension_catalog and ui_extensions::node_typescript_publishes_files_without_binary_bridge_callbacks with DIM_TEST_NODE and DIM_TEST_JS_RUNTIME: pass (0.22s and 0.20s).
- tsc --strict on runtime/fixtures/ui-owner.ts and npm/plugin.d.ts: pass.
- CI at 52d7ec3: changes, static-checks and macos-native passed; verify (linux) pending; dependencies, scripts, web, windows-cli and acp-registry skipped.
Merge conflicts: none with origin/main at 9d1d2e3; the PR is MERGEABLE. Pairwise merge-tree conflicts with open PRs sharing changed files: #1907 (crates/dim-app-server/src/connection.rs, docs/design/contracts/process-owner-operations.md); #1900 (docs/design/service-faces.md); #1902 (docs/architecture/rust-agent/generated/catalog.md); #1905 (crates/dim-app-server/src/lib.rs, catalog.md); #1906 (lib.rs, catalog.md, service-faces.md); #1909, #1910, #1911 and #1913 (lib.rs); #1912 (lib.rs, npm/plugin.d.ts); #1903 and #1904 (npm/plugin.d.ts). #1899 and #1917 are clean. The generated catalog.md, app-server/services.json and npm declarations must be regenerated after either side lands.
Unverified: the Linux and Windows CI runs. The local Node runs used Node v24.21.0 and the rutis 0.23.0 runtime from a local worktree; the worktree had no runtime/node_modules, so I linked it for the run and removed it afterward. I did not run the disabled-plugin registration end to end; the P2 follows from package_by_id and using() and from the fixture's reachability.
| impl State { | ||
| pub(crate) fn package_by_id(&self, id: &str) -> Option<(String, PathBuf)> { | ||
| let record = self.record.lock().unwrap(); | ||
| if let Some(entry) = record.installed(id) { |
There was a problem hiding this comment.
Problem: package_by_id returns any installed entry or default directory without checking the selected and enabled state. using() is the state check: it returns None for an off name and the chosen candidate otherwise (crates/dim-app-server/src/plugin_manager.rs:577-605). This lookup never calls it. UiExtensions::register publishes whatever it returns (crates/dim-app-server/src/ui_extensions/mod.rs:140-180), so the face accepts a plugin the user turned off.
Failure scenario: install plugin X (install selects it: crates/dim-app-server/src/plugin_manager.rs:1246, 1342-1349) and let PluginManager register its UI. Disable X, or install a second copy Y and select it; PluginManager withdraws X's UI (crates/dim-app-server/src/plugin_manager.rs:2060-2065, 441-445; docs/design/client-ui-extensions.md:77). A trusted row that injects uiExtensions, as runtime/fixtures/ui-owner.ts:8,35-38 does, calls uiExtensions.register({plugin:'X', manifest:{version:1, root:'ui', panels:[...]}}). package_by_id still returns X's install directory, prepare copies the root, and ui.extensions.list and ui.extensions.read serve a plugin that is off or replaced. A default plugin name has the same problem after the name switches to an installed copy, because defaults.plugins.get(id) ignores the choice. This contradicts client-ui-extensions.md:69 and client-ui-extensions.md:433.
Evidence: crates/dim-app-server/src/plugin_manager.rs:191-200, 577-605, 1246, 1342-1349, 2060-2065; crates/dim-app-server/src/ui_extensions/mod.rs:140-180; runtime/fixtures/ui-owner.ts:8,35-38; docs/design/client-ui-extensions.md:69,77,433; docs/design/contracts/process-owner-operations.md:30.
Fix: require the id to be the candidate using() returns for its name (Use::Installed(id) for an installed entry, Use::Default for a default). Normal callers already pass that id (crates/dim-app-server/src/plugin_manager.rs:416-433, 2071-2096), and the Node test still passes because install defaults enable=true and records use_ (crates/dim-app-server/src/plugin_manager.rs:1246, 1342-1349). Add a test that registers a disabled id and expects Unknown plugin ID with no catalog entry. If any trusted caller may republish disabled content is intended, update client-ui-extensions.md:69, 77 and 433 and add that test.
| assert.ok(after.presences.every(presence => presence.channel !== 'tui')) | ||
| } else if (call.method === 'uifixture.detach') { | ||
| assert.equal(host.detach({connectionId, sessionId}), undefined) | ||
| await assert.rejects(extensions.register({plugin: 'missing-ui-fixture', manifest: {version: 1}}), /Unknown plugin ID/) |
There was a problem hiding this comment.
Optional. The fixture pins the unknown-ID and unsupported-version failures (lines 34 and 39) but not the canonicalize containment check added in 52d7ec3. A root or panel entry that resolves outside the install directory through a symlink is rejected at crates/dim-app-server/src/ui_extensions/manifest.rs:91 and 123; if that check regressed, this test would stay green. Add a native Package::read test with a symlink inside the plugin directory that points to a sibling, or install a fixture with such a symlink and assert the rejection.
Refs #1292
sessionClientsHost.presences.processActivity.activated/hold/releaseand the existingdaemon.ping/shutdownRPCs. Socket handles and shutdown control are private to the server.detach({connectionId,sessionId}). Disconnect callsrelease({connectionId})and thenfinished({connectionId}).plugins({}),refusal({plugin}),register({plugin,manifest?}),withdraw({plugin}). PluginManager resolves the installation directory and name by ID.Native and Node calls share the UI owners. The catalog exposes the UI faces and omits the private connection and shutdown handles.