Repository navigation
Conversation
zerob13
left a comment
There was a problem hiding this comment.
Static review found two Settings correctness issues that block approval. A write can outlive its source registration, and a file-backed update holds an exclusive lease while waiting for a plugin decoder. The inline comments identify the affected paths and suggest fixes.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
This PR moves the special Settings sources (Scheduler, Modality, SkillsCatalog, PermissionRules, CollaborationModelPolicy, Hooks, MCP) to settings.registerDocument with source-bound read/update, moves collaboration policy, permission rules and Hooks/MCP reads to their owners, and retires the public settingsService name. The ownership split, revision handling and the MCP secret boundary look right, and the targeted tests pass. The findings below are P2 and block.
P2: custom codecs run under the file lease, contrary to the PR text
Problem: the PR says "Custom codecs run outside storage transactions", but for file-backed scopes SettingsService::replace decodes the stored document while holding the exclusive file lease (crates/dim-app-server/src/settings.rs:546-547), and snapshot calls format.decode at crates/dim-app-server/src/settings.rs:643. For Kind::Custom that decode is a foreign call into the plugin (crates/dim-app-server/src/settings/document.rs:21-60). The narrower contract sentence, "Foreign codec calls occur outside SQLite transactions" (docs/design/contracts/resource-owner-operations.md:151), is accurate; only the file-lease path contradicts the PR text.
Failure scenario: a codec whose decode awaits, or calls back into the update it got from registerDocument, holds the settings file's write lease. A concurrent settings.update on the same source (client UI, a management path, or another session sharing the home) spins in SettingsService::lease (crates/dim-app-server/src/settings.rs:577-587) until its cancel token fires, and a reentrant update from inside decode deadlocks because the outer replace awaits decode while decode awaits the lease. Before this PR decode was synchronous Rust, so this call site could not run foreign code.
Fix: do not decode the stored document for custom sources under the lease. RegisteredDocument::update passes a no-op check (crates/dim-app-server/src/settings.rs:251-264), so the decoded current document is unused; compare the revision from the raw bytes and skip the foreign decode, or decode outside the lease and re-check the revision under it. If the intended contract is only the SQLite path, say so in the PR text instead of "storage transactions".
P2: settings-service.md contradicts itself and the code on the Rust binding
Problem: section 4.2 adds registerDocument and authorizeProject (docs/design/appserver/settings-service.md:215-216), but section 1 still enumerates the service as register, read, update, projects (lines 20-21), and section 4.5 says "It provides register(ctx, declaration), read(source, scope, cancel), update(source, scope, expected, document, cancel) and projects()" (lines 318-319). The same section still says "PluginManager's declared-source tools also use it [SettingsService] for reads and owner writes" (lines 325-326), while PluginManager now injects Key<Settings> and calls declared_by (crates/dim-app-server/src/plugin_manager.rs:14, 684, 2128-2145). The ZH mirror has the same stale spots (docs/zh/design/appserver/settings-service.md:19 and 277-284).
Failure scenario: an implementer using section 4.5 as the complete Rust binding misses register_document and authorize_project, and anyone following the PluginManager sentence keeps a dependency on a service the catalog no longer exposes (docs/architecture/rust-agent/generated/catalog.md:60 lists only settings; crates/dim-app-server/src/lib.rs:1448 registers Settings). The contract file contradicts itself in one reading.
Fix: add the two methods to the section 1 bullet and the section 4.5 enumeration, and replace the PluginManager sentence with the Settings binding, in both languages.
P2: other migrated-caller contracts still name SettingsService
Problem: the contracts this PR migrates still describe the retired key and read path.
- docs/design/contracts/resource-owner-operations.md:14 lists
settingsServiceas the interface dependency ("Declared sources use settings.register/read/update/projects"), while the PR removes that catalog name and the same file's new rows (137, 144) route throughsettings. - docs/design/appserver/permission-command-rules.md:184 and docs/zh/design/appserver/permission-command-rules.md:168 say
Keyed<SettingsService>andSettingsService::read::<PermissionSettings>(User); the code usesctx.get::<RegisteredDocument<PermissionSettings>>()onKey<Settings>(crates/dim-app-server/src/permission_rules.rs:54-75, 101-113, 159-176). - docs/design/subagent-model-policy.md:56, 129, 153-154 say
SettingsService::read/updateandKeyed<SettingsService>; the owner now registers throughSettings::register_documentand providesCollaborationModelPolicy(crates/dim-app-server/src/collaboration_model_policy.rs:147-176), read throughctx.get(crates/dim-app-server/src/collaboration.rs:281-291). - docs/design/plugins/Hooks.md:697 and docs/zh/design/plugins/Hooks.md:695 say
SettingsService::project_root(cwd); sources now useSettings::projects()(crates/dim-app-server/src/hooks_settings.rs:165-180). docs/design/plugins/Scheduler.md:927 and docs/zh/design/plugins/Scheduler.md:874 still listSettingsServiceas the typed dependency, nowRegisteredDocument.
Failure scenario: a new consumer or a future contract edit follows these rows, adds Keyed<SettingsService> or a name lookup that no longer exists in the catalog, and the owner matrices stop matching the code they are supposed to audit. These lines were correct before this PR and became stale with it.
Fix: update the four documents, both languages, to the new keys and operations.
Verification
Ran against e7576cb: git diff --check, cargo fmt --all -- --check, adr-check, cargo run -p xtask -- check (module, catalog, declarations, locks, comment links), and clippy on the changed crates pass. Targeted tests pass: settings_flow 16/16, hooks_settings_flow 4/4, mcp_flow 27/27, transport settings_methods (3 non-ignored), permission rules 1/1, collaboration transport 1/1, mcp_session_flow 48/48, dim-app-server lib 125/125. The two node-gated settings tests and runtime/fixtures/settings-owner.ts could not run here (no DIM_TEST_NODE, DIM_TEST_JS_RUNTIME or runtime/node_modules), so the TypeScript registerDocument path is unverified locally; CI verify is still pending.
codoggy
left a comment
There was a problem hiding this comment.
Findings
[Blocking] Reject an old owner’s queued write after re-registration
When a file-backed Rust source is withdrawn while an update waits for the file lease, crates/dim-app-server/src/settings.rs:251–263 has already checked the registration and handed storage the path and the caller’s token. If the new owner registers the same file without changing its contents, the old update can pass the revision check, replace the document and publish a change under the new owner’s source name.
Evidence: Static inspection: RegisteredDocument::path checks the registration identity, but replace does not carry it across the lease wait at settings.rs:546–551. The Hooks management path supplies an independent request token. The stale-handle test starts a read after unload; it does not cover a write already waiting at unload.
Requested change: Carry registration identity through commit admission and order that admission with withdrawal. Hold the file lease in a regression test, queue an update from the old handle, replace its registration, then release the lease. The old write must fail without changing the file or publishing a notice.
[Blocking] Keep plugin decoding outside the exclusive file lease
When a file-backed registerDocument update reads the current revision, crates/dim-app-server/src/settings.rs:546–551 waits for the plugin decoder while holding the exclusive lease. Even a stale update can delay every writer to that document; if the decoder awaits another update of the same document, neither update can finish without cancellation.
Evidence: Static inspection: snapshot now awaits format.decode, and the new Codec delegates that call to plugin code (crates/dim-app-server/src/settings/document.rs:21–60). The registered-document update supplies a no-op check for the current document; it does not need the decoded value to reject a stale revision. Tests not run locally.
Requested change: Compare the raw revision under the lease without calling the plugin. If a caller needs a decoded snapshot, decode outside the lease and recheck the revision at commit. Cover a stale update with a suspended decoder and verify another writer can still make progress.
… codecs outside file leases
# Conflicts: # crates/dim-agent-scheduler/src/methods.rs # crates/dim-modality/src/engine.rs # crates/dim-modality/src/lib.rs # docs/architecture/rust-agent/generated/app-server/services.md # docs/architecture/rust-agent/generated/app-server/services.mmd # docs/architecture/rust-agent/generated/modules.mmd # docs/design/contracts/resource-owner-operations.md # docs/design/plugins/Scheduler.md # docs/zh/design/plugins/Scheduler.md
|
Fixed the Settings write issues in 93abff0 and integrated main in 4d93d07.
The Settings flow (16 tests), Node-backed owner flow, strict fixture type check and App Server Clippy passed on the fix. CI is checking the merged head. |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES
This PR moves the special Settings sources (Scheduler, Modality, SkillsCatalog, PermissionRules, CollaborationModelPolicy, Hooks, MCP) to source-bound registration and reads, adds settings.registerDocument for codec sources, moves trusted callers to the Settings binding, and retires the public settingsService catalog name. The three prior blocking findings are fixed at 93abff0, and the merged head passes the Settings, Hooks, MCP, Permission and Collaboration flows. The only blocker is a new conflict with latest main in the generated module snapshots.
Blocking: latest main conflicts on the generated module snapshots
Problem: origin/main moved during this review from 14cc130 to 44af122. Commit a43607b (#1946) deleted docs/architecture/rust-agent/generated/modules.json and docs/architecture/rust-agent/generated/modules.mmd and stopped committing them, while this PR still modifies both files. GitHub reports the PR as CONFLICTING/DIRTY, and git merge-tree --write-tree origin/main HEAD exits 1 with modify/delete conflicts on exactly those two files.
Failure: the PR cannot merge. Resolving toward the PR side would reintroduce about 63k lines main deliberately removed and contradict the new xtask behavior.
Fix: merge origin/main, accept both deletions, and rerun cargo run --locked -p xtask -- check. No Settings code change is needed for this.
Prior blocking findings, resolved at 93abff0
- Registration identity at commit admission:
SettingsService::replacerecheckscurrent_registrationafter acquiring the file lease (crates/dim-app-server/src/settings.rs:558-562), andnative_replacechecks it undernative_publicationbeforereplace_user(crates/dim-app-server/src/settings/native.rs:97-102). The regression test holds the lease, starts a write, withdraws and re-registers the source, releases the lease, and asserts the old write fails withUnknownSource, the stored document is unchanged, and only the current owner publishes a new revision (crates/dim-app-server/tests/settings_flow.rs:874-953). - Foreign decoder under the file lease: the file-backed Registered path reads raw bytes and compares the revision without calling
format.decodeforKind::Custom(crates/dim-app-server/src/settings.rs:559-569). The Node project flow suspendsdecodeinside a read, then a stale write returnsconflictand a current write commits while the decoder is still suspended (crates/dim-app-server/tests/transport_flow/settings_methods.rs:375-390, runtime/fixtures/settings-owner.ts:48-69). - Docs and contracts: sections 1, 4.2 and 4.5 now list
registerDocumentandauthorizeProjectand name theSettingsbinding (docs/design/appserver/settings-service.md:20,214-215,316-326), with the ZH mirror (docs/zh/design/appserver/settings-service.md:19,194-195,278-283). The resource-owner table and the Permission, Collaboration, Hooks and Scheduler contracts now useSettings/RegisteredDocument(docs/design/contracts/resource-owner-operations.md:14,144,151; docs/design/appserver/permission-command-rules.md:184; docs/design/subagent-model-policy.md:129,139,153; docs/design/plugins/Hooks.md:421,697; docs/design/plugins/Scheduler.md:927, with the matching ZH lines).
Threads to withdraw
All prior threads are still marked unresolved, but their findings are fixed. Withdraw zerob13 review 5989077239 (inline 4639732055 and 4639732064), our review 5989194487 (inline 4639827761 and 4639827790), and codoggy review 5989574981. Our inline 4639831307 only marks the duplicate of 4639732064 and goes with that thread. The issue comment 7035261838 matches the code and tests.
Optional notes, not blocking
P3: the Rust binding sentence calls native sources "custom"
Problem: docs/design/appserver/settings-service.md:317 says "Custom sources use register_document", but Settings::register_document registers a native BusinessDocument as Kind::Rust (crates/dim-app-server/src/settings/declared.rs:344-354; crates/dim-app-server/src/settings.rs:205-209). The codec method in section 4.2 is the dispatcher registerDocument, which creates Kind::Custom (crates/dim-app-server/src/settings/document.rs:107-123).
Failure: a reader maps the codec signature from section 4.2 onto the Rust method, which takes only an owner context, or cannot tell which registration a native owner should use.
Fix: say "Native BusinessDocument sources use register_document and its bound read/update operations", and correct the PR body table that lists the Rust owners as calling settings.registerDocument({source,userFile,projectFile?},codec).
P3: two Settings lines still name the old typed registration
Problem: docs/design/appserver/settings-service.md:121 says native BusinessDocument sources use SettingsService::register::<D>, and lines 265-266 say ScheduleDocument is registered with settings.register::<ScheduleDocument>. Scheduler now calls Settings::register_document::<ScheduleDocument> (crates/dim-agent-scheduler/src/methods.rs:116), as do the other native owners. crates/dim-app-server/README.md:97 uses the same older spelling.
Failure: a new owner following section 3.1 keeps the typed SettingsService path. That path returns no source-bound handle, and its update uses WriteCheck::Compare (crates/dim-app-server/src/settings.rs:504-513), so it does not get the registration recheck added by this PR.
Fix: point both lines, and the README sentence, at Settings::register_document.
P3: native admission reports conflict before unknown_source
Problem: native_replace compares the revision (crates/dim-app-server/src/settings/native.rs:94-95) before current_registration (lines 97-102). A stale handle whose expected revision no longer matches returns Conflict after its registration was withdrawn, not UnknownSource as docs/design/appserver/settings-service.md:125 states for an unregistered source. The file path and the matching-revision native case return UnknownSource.
Failure: a management caller that retries a stale write sees conflict and may read and retry instead of dropping the handle; no write occurs either way.
Fix: check registration before the revision comparison, or state that conflict takes precedence in the native path.
Verification
Head 4d93d07, worktree clean and detached. All commands used isolated HOME, TMPDIR, XDG and CARGO_TARGET_DIR with LC_ALL=en_US.UTF-8.
Against origin/main 14cc130, the PR's stated base:
git diff --check origin/main...HEAD: pass.git merge-tree --write-tree origin/main HEAD: pass, tree 95fab3d0.cargo fmt --all -- --check: pass.node scripts/adr-check.mjs --base origin/main: pass (45 changed files).cargo run --locked -p xtask -- check: pass, including crate and module boundaries, plugin documents, service catalog, service declarations, plugin locks and comment links after the #1901 merge.cargo test -p dim-app-server --test settings_flow: 16 passed, includingsources_appear_while_registered_and_names_are_exclusive.cargo test -p dim-app-server --test hooks_settings_flow: 4 passed.cargo test -p dim-app-server --test mcp_flow: 27 passed.cargo test -p dim-app-server --test transport_flow command_rules_written_by_the_client_apply_to_the_next_call: 1 passed.cargo test -p dim-app-server --test transport_flow product_collaboration_adopts_profile_and_default_capabilities: 1 passed.cargo test -p dim-app-server --test transport_flow settings_methods::: 3 passed, 2 ignored (Node).cargo test -p dim-agent-scheduler -p dim-modality: all scheduler suites and all modality suites passed, includingplugin_file_transactionsandmodality_flow(81 tests).
Against the now-current origin/main 44af122:
git merge-tree --write-tree origin/main HEAD: fails as described in the blocking item.
Unverified:
- The two node-gated settings tests and the strict runtime/fixtures/settings-owner.ts type check need
DIM_TEST_NODE,DIM_TEST_JS_RUNTIMEand runtime/node_modules, which are absent here. The suspended-decoder and current-write ordering rest on the author's run and CI. - I did not rerun App Server Clippy; the author reports it passed, and the changed crates compile under the gates above.
- CI at head 4d93d07:
verifyis queued/pending,dependenciesandchangespass, andweb,windows-cliandacp-registryare skipped. GitHub reports the PR as CONFLICTING/DIRTY because of the new main conflict, not because of a failing check.
|
Verified fixed in At This verifies the point raised in my earlier review. |
# Conflicts: # docs/architecture/rust-agent/generated/modules.json # docs/architecture/rust-agent/generated/modules.mmd
codoggy
left a comment
There was a problem hiding this comment.
Review summary
I reviewed the merge-base diff for 39838ddfe1208b6c344c314512269bd1183b402b, focusing on the settings-source admission and lease handling, the SQLite-backed storage dispatch, and the updated settings regression coverage. I found no blocking issues in that scope.
The earlier queued old-owner write concern is addressed at crates/dim-app-server/src/settings.rs:558-569, where registration is rechecked after file-lease admission; the corresponding regression coverage is in crates/dim-app-server/tests/settings_flow.rs:874-953. The custom-source path compares the stored raw revision without invoking the foreign decoder while holding the exclusive lease, with Node-backed concurrency coverage at crates/dim-app-server/tests/transport_flow/settings_methods.rs:364-390. The current head also carries the generated storage/API updates in its owned diff.
Checks: For this exact head, GitHub reports changes and dependencies passed; verify was queued, while web, windows-cli, and acp-registry were skipped. Tests not run locally; the source and regression coverage were checked by static inspection. Merge readiness (not a finding): the pending verify result remains to be observed; this is not attributed to the PR and is not a change request.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
This PR moves Scheduler, Modality, SkillsCatalog, PermissionRules, CollaborationModelPolicy, Hooks and MCP to source-bound Settings registration and reads, adds the settings.registerDocument codec path, moves trusted callers to the Settings binding, and retires the public settingsService catalog name. The merge conflict from the prior review is resolved, the three earlier blockers still hold at this head, and no main change was reverted.
Merge conflict resolved
At 4d93d07 the branch modified docs/architecture/rust-agent/generated/modules.json and docs/architecture/rust-agent/generated/modules.mmd, which main commit a43607b (#1946) deleted.
Verification at 39838dd:
- Both files are absent from HEAD:
git cat-file -e HEAD:docs/architecture/rust-agent/generated/modules.jsonand the same command formodules.mmdfail, andgit ls-tree -r --name-only HEAD docs/architecture/rust-agent/generated/lists only the 14 remaining files. git merge-tree --write-tree origin/main HEADexits 0 with tree f63c594a652cba97bfbc772228e3ba834330e2c5, and GitHub reports the PR as MERGEABLE.git diff --name-status origin/main...HEADstill lists the same 43 PR files, andgit diff --stat 4d93d071b..39838ddfecontains only main-side changes: AGENTS.md, README, ADR 026 in both languages, docs index and release README,scripts/ci-changes.mjsand its test,xtask/src/main.rs,xtask/src/modules.rs, and the two snapshot deletions. The merge resolution did not alter the PR's code or docs.cargo run --locked -p xtask -- checkpasses, including the live module boundary check:module source boundaries passed (744 modules, 4574 edges).
Prior blocking findings still fixed at 39838dd
- Registration identity at commit admission:
SettingsService::replaceacquires the file lease, reads the raw bytes, and recheckscurrent_registrationbefore the revision check (crates/dim-app-server/src/settings.rs:558-568). The native path checks it undernative_publicationbeforereplace_user(crates/dim-app-server/src/settings/native.rs:92-102). The regression test still holds the lease across withdrawal and re-registration and assertsUnknownSourcewith the stored revision unchanged (crates/dim-app-server/tests/settings_flow.rs:874-953). - Foreign decoder outside the file lease: the
Kind::Custombranch reads the stored bytes and compares the revision without callingformat.decodeunder the lease (crates/dim-app-server/src/settings.rs:560-568). The Node project flow still suspendsdecodewhile a stale write returns conflict and a current write commits (crates/dim-app-server/tests/transport_flow/settings_methods.rs:375-390, runtime/fixtures/settings-owner.ts:44-72). - Docs and contracts: sections 1, 4.2 and 4.5 list
registerDocumentandauthorizeProjectand name theSettingsbinding (docs/design/appserver/settings-service.md:20,214-215,316-326), with the ZH mirror (docs/zh/design/appserver/settings-service.md:19,194-195,278-283). The resource-owner table and the Permission, Collaboration, Hooks and Scheduler contracts useSettingsorRegisteredDocument(docs/design/contracts/resource-owner-operations.md:14,144,151; docs/design/appserver/permission-command-rules.md:184; docs/design/subagent-model-policy.md:129,139,153; docs/design/plugins/Hooks.md:421,697; docs/design/plugins/Scheduler.md:927).
Main changes intact
- #1901 pluginFiles: crates/dim-agent-scheduler/src/methods.rs:47 and :356 still declare
PluginFilesandFileScope, and the PR's hunk on that file only changes the Settings types and reads. Modality still usesFileScope. The scheduler and modality suites pass. - #1946: the two module snapshots stay deleted, and
xtask/src/main.rsandxtask/src/modules.rshave no diff against origin/main. - #1925:
.github/workflows/ci.yml,scripts/ci-changes.mjsandscripts/ci-changes.test.mjshave no diff against origin/main. - #1940:
docs/adr/026-verification-tiers-and-ci-governance.md, its ZH mirror anddocs/adr/README.mdhave no diff against origin/main.
Threads to withdraw
All five review threads are still unresolved. Four are fixed and one is an optional note.
- Withdraw zerob13 review 5989077239 (inline 4639732055 and 4639732064): both findings are fixed and covered by the file and Node flows above.
- Withdraw codoggy review 5989574981: its two findings duplicate zerob13's, codoggy already confirmed the fix in issue comment 7036153560, and the same head verifies it.
- Our review 5989194487 (inline 4639827761 and 4639827790) and review 5990479055 (the merge-conflict blocker plus optional inline 4640785439): the blocker is resolved, the docs fixes stand, and the optional note remains optional. This approval supersedes 5990479055.
- Inline 4639831307 only marks the duplicate of 4639732064 and goes with that thread.
Optional notes, not blocking
The three prior P3 notes are unchanged and remain optional:
- docs/design/appserver/settings-service.md:317 calls the Rust
register_document"custom sources", butSettings::register_documentregisters a nativeBusinessDocumentasKind::Rust(crates/dim-app-server/src/settings/declared.rs:344-354, crates/dim-app-server/src/settings.rs:205-209), while the codec method in section 4.2 is the dispatcherregisterDocumentand createsKind::Custom(crates/dim-app-server/src/settings/document.rs:107-123). The PR body also lists the Rust owners under the codecsettings.registerDocumentform. - docs/design/appserver/settings-service.md:121 and 265-266 and crates/dim-app-server/README.md:97 still name the older
SettingsService::register::<D>andsettings.register::<ScheduleDocument>path. The migrated owners useSettings::register_document(crates/dim-agent-scheduler/src/methods.rs:116), which returns the source-bound handle whose update rechecks registration. - crates/dim-app-server/src/settings/native.rs:94-95 compares the revision before
current_registrationat lines 97-102, so a stale native handle can report conflict where docs/design/appserver/settings-service.md:125 says unknown_source. No write occurs in either ordering.
Verification
Head 39838dd, worktree clean and detached, origin/main b623ac6. All commands used isolated HOME, TMPDIR, XDG and CARGO_TARGET_DIR with LC_ALL=en_US.UTF-8.
git diff --check origin/main...HEAD: pass.git merge-tree --write-tree origin/main HEAD: pass, tree f63c594a652cba97bfbc772228e3ba834330e2c5.cargo fmt --all -- --check: pass.node scripts/adr-check.mjs --base origin/main: pass, 43 changed files.cargo run --locked -p xtask -- check: pass, with module source boundaries (744 modules, 4574 edges), crate and module boundaries, plugin documents (26), service catalog, service declarations, plugin locks, comment links (97) and literal main.cargo test -p dim-app-server --test settings_flow: 16 passed, includingsources_appear_while_registered_and_names_are_exclusive.cargo test -p dim-app-server --test hooks_settings_flow: 4 passed.cargo test -p dim-app-server --test mcp_flow: 27 passed.cargo test -p dim-app-server --test transport_flow settings_methods::: 3 passed, 2 ignored (Node).cargo test -p dim-app-server --test transport_flow command_rules_written_by_the_client_apply_to_the_next_call: 1 passed.cargo test -p dim-app-server --test transport_flow product_collaboration_adopts_profile_and_default_capabilities: 1 passed.cargo test -p dim-agent-scheduler -p dim-modality: all suites passed, 161 tests.cargo test -p dim-session-title --test appended_context_flow: 7 passed, covering the HookSources to HooksService binding added by this PR.
Unverified:
- The two node-gated settings tests and the strict runtime/fixtures/settings-owner.ts type check need
DIM_TEST_NODE,DIM_TEST_JS_RUNTIMEand runtime/node_modules, which are absent here. The suspended-decoder custom write path rests on the author's run and CI. - I did not run App Server Clippy or the full workspace suite.
- CI at head 39838dd:
verifyis queued,dependenciesandchangespass, andweb,windows-cliandacp-registryare skipped. GitHub reports MERGEABLE and mergeStateStatus UNSTABLE (pending verify) with reviewDecision CHANGES_REQUESTED from the prior review.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Commit 64b2284 changes only the App Server README and the English and Chinese Settings design docs. It closes the two documentation P3 notes from review 5990866612; the third optional note is unchanged below. The code is still the approved head 39838dd. The source-bound admission recheck, the foreign decoder boundary and the trusted caller migration still hold. No blocking finding remains.
New commit
The docs now match the code:
docs/design/appserver/settings-service.md:121and:317-319say nativeBusinessDocumentsources useSettings::register_document, and:266saysScheduleDocumentregisters withsettings.register_document::<ScheduleDocument>. This matchesSettings::register_documentatcrates/dim-app-server/src/settings/declared.rs:344-357and every migrated owner:crates/dim-agent-scheduler/src/methods.rs:116,crates/dim-modality/src/lib.rs:1240,crates/dim-app-server/src/hooks_settings.rs:737-739,crates/dim-app-server/src/mcp.rs:1851-1854,crates/dim-app-server/src/permission_rules.rs:162,crates/dim-app-server/src/collaboration_model_policy.rs:170andcrates/dim-app-server/src/skills_management.rs:622.crates/dim-app-server/README.md:97uses the same method for a nativeBusinessDocument.- The ZH mirror matches at
docs/zh/design/appserver/settings-service.md:106,:238and:278. - No "custom sources" wording remains in the changed docs.
Kind::Customstays with the codec path (crates/dim-app-server/src/settings/document.rs:107-123,docs/design/contracts/resource-owner-operations.md:144). - Sections 3.1, 4.2 and 4.5 now agree, and the added text does not duplicate or contradict them. The PR body also lists
Settings::register_document::<D>for the native owners, closing the prior note there.
Prior findings
- Withdraw the two optional doc P3s from review 5990866612. Inline 4640785439 (the "custom sources" wording) and the optional follow-up in thread 4639827790 (lines 121 and 265-266 and README:97) are fixed by 64b2284 at the lines above.
- The earlier blockers stay fixed: registration identity is rechecked after the file lease before the revision check (
crates/dim-app-server/src/settings.rs:561-568) and undernative_publication(crates/dim-app-server/src/settings/native.rs:98-102); the regression test atcrates/dim-app-server/tests/settings_flow.rs:771-954queues a write across withdrawal and re-registration and assertsUnknownSourcewith the stored revision unchanged; the custom decoder no longer runs under the file lease (crates/dim-app-server/src/settings.rs:563-565), and the Node flow atcrates/dim-app-server/tests/transport_flow/settings_methods.rs:380-390withruntime/fixtures/settings-owner.ts:55-68still suspendsdecodewhile a stale write conflicts and a current write commits. - The removed forwarding face is gone:
git grep settingsService HEADfinds nothing incrates,npm,runtimeordocs/architecture, andcrates/dim-app-server/src/lib.rsregisterssettings::Settingswithout asettingsServiceface.
Optional note, not blocking
Problem: crates/dim-app-server/src/settings/native.rs:94-99 compares the revision before current_registration, so a stale native handle whose expected revision no longer matches returns conflict after its source was withdrawn, while docs/design/appserver/settings-service.md:125-126 says an unregistered source is unknown_source on every path.
Failure: a management caller sees a revision conflict and may re-read instead of dropping the retired handle.
Evidence: the file path checks the registration first; the native path checks it after the revision comparison (crates/dim-app-server/src/settings/native.rs:92-102).
Fix: check current_registration before the revision comparison, or state the native precedence in the document. This was already optional in review 5990866612 and no write occurs in either order.
Verification
Head 64b2284, worktree clean and detached, current origin/main 3d5749c. All commands used isolated HOME, TMPDIR, XDG and CARGO_TARGET_DIR with LC_ALL=en_US.UTF-8.
git diff --stat 39838ddfe..64b2284fa: three docs files, 7 insertions and 7 deletions. No code changed since the approval.git merge-tree --write-tree origin/main HEAD: exit 0, tree f776a4c11f214d21223a335ac3632e6541199ec3. GitHub reports MERGEABLE.node scripts/adr-check.mjs --base origin/main: ADR freeze passed, 44 changed files.cargo run --locked -p xtask -- check: module source boundaries (744 modules, 4574 edges), crate and module boundaries, plugin documents (26), service catalog, service declarations, plugin locks, comment links (97) and literal main (11) all pass.git diff --check origin/main...HEAD: pass.- CI at 64b2284:
changesanddependenciespass,verifyqueued,web,windows-cliandacp-registryskipped.
Cross-PR
- PR 1904 removes the same
settingsServiceregistration incrates/dim-app-server/src/lib.rsand conflicts with this head oncrates/dim-app-server/src/lib.rsandcrates/dim-app-server/src/agents.rs(merge-tree exit 1); it needs a rebase after this merges. - PR 1905 conflicts on
crates/dim-modality/src/engine.rsandcrates/dim-modality/src/lib.rs. - PR 1900 and PR 1906 conflict only in generated
docs/architecture/rust-agent/generated/files, and PR 1917 also conflicts on the removedmodules.jsonandmodules.mmd; regeneration resolves those. - PR 1941, 1907, 1908, 1909, 1916 and 1943 merge cleanly with this head.
Unverified
- The Node-gated settings tests and the strict
runtime/fixtures/settings-owner.tstype check were not rerun. The code is unchanged since 39838dd, where the same limitation was recorded, so the earlier author and CI evidence still applies. - No Settings or storage suite was rerun because the increment is docs only; main's two new commits touch
transport_flow/timeline_export.rs,.github/workflows/ci.yml, the root README anddocs/release/README.md, none of which this PR changes.
zerob13
left a comment
There was a problem hiding this comment.
The macOS native job fails to compile dim-app-server on merge commit bd632b97c1b7e15a20ed57bfde5a12891f8f4cbb. Rust reports seven E0533 errors because the new Settings and collaboration policy code still calls Error::Value(...) after the Rutis 0.23 upgrade. Use Error::value(message) at all seven sites and pass string literals directly. This follows the constructor migration already on main and preserves the existing error messages. CI log
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
The head fixes the seven rutis 0.23 constructor errors that broke the macOS native build at 43e29c0. Every site now calls Error::value, the string literals no longer use .into(), and all messages are unchanged.
The seven sites
crates/dim-app-server/src/collaboration_model_policy.rs:112usesError::value(format!("unknown collaborationModelPolicy method {method}"));:117usesError::value("expected one empty request").crates/dim-app-server/src/settings/document.rs:77usesError::value("expected a settings source declaration and a codec with decode and validate functions");:105and:117useError::value(error.to_string());:126usesError::value("expected a settings scope");:137usesError::value("expected scope, expectedRevision and document").
This follows ADR 025 D2. In rutis-bridge 0.23.0, Error::value(message: impl Into<String>) sets reason: None (src/session/mod.rs:153), and Error::Value still maps to the bad-value code (src/session/mod.rs:248), the same code the 0.19.3 tuple variant had (src/session/mod.rs:55 and :191). Error codes and messages stay the same for callers and tests.
git grep Error::Value HEAD finds no call site. git diff 43e29c08..HEAD changes only these two files, 9 insertions and 11 deletions.
The rest of the PR is unchanged
git diff origin/main...HEAD still lists the same 44 files. The merge at 43e29c0 combined main's rutis 0.23 upgrade with the approved content. The five PR files main also changed, crates/dim-agent-scheduler/src/methods.rs, crates/dim-app-server/README.md, crates/dim-app-server/src/hooks_settings.rs, crates/dim-app-server/src/settings/declared.rs and crates/dim-app-server/tests/transport_flow/collaboration.rs, keep the same PR hunks and carry main's Error::value migration. The settings registration, native replace, custom decoder outside the file lease, lease and withdraw behavior, generated files and docs are unchanged since the approved head 64b2284.
Verification
Head 6ae39cc, clean detached worktree, origin/main ffd3e11. Isolated HOME, TMPDIR, XDG and CARGO_TARGET_DIR under the review data dir, LC_ALL=en_US.UTF-8.
cargo check -p dim-app-server --all-targets --locked: pass.cargo check -p dim-agent-scheduler --all-targets --locked: pass.cargo fmt --all -- --checkandgit diff --check: pass.node scripts/adr-check.mjs --base origin/main: pass, 44 changed files.cargo run --locked -p xtask -- check: pass, including module source boundaries (744 modules, 4576 edges), crate and module boundaries, plugin documents, service catalog, service declarations, plugin locks and comment links.settings_flow: 16 passed, includingsources_appear_while_registered_and_names_are_exclusive.hooks_settings_flow: 4 passed.mcp_flow: 27 passed.transport_flow settings_methods::: 3 passed, 2 ignored (Node).transport_flow permission_rules::command_rules_written_by_the_client_apply_to_the_next_call: 1 passed.transport_flow collaboration::product_collaboration_adopts_profile_and_default_capabilities: 1 passed.- CI at head:
macos-native, the job that failed at 43e29c0, passes;changesanddependenciespass;verify (linux)is pending;web,windows-cliandacp-registryare skipped.
Unverified: the two Node-gated settings tests and the strict runtime/fixtures/settings-owner.ts type check need DIM_TEST_NODE, DIM_TEST_JS_RUNTIME and runtime/node_modules, which are absent here. The fixture and the declarations are unchanged by this delta, and CI verify is pending. Clippy and the full workspace suite were not rerun.
Cross-PR
- #1910 conflicts on
crates/dim-app-server/src/lib.rsandcrates/dim-app-server/src/mcp/publication.rs. - #1908 conflicts on
docs/architecture/rust-agent/generated/catalog.md.
Both merge cleanly with origin/main, so these are overlapping changes with this PR, and one side needs a rebase after the other merges. #1913, #1907, #1951, #1952 and #1949 merge cleanly.
Threads
zerob13's review 5993887376 and inline comments 4643352084 and 4643352098 are fixed at this head. All earlier threads are resolved, and their fixes still hold. My approval 5991639917 reviewed 64b2284 before this branch merged main, so it did not cover the rutis 0.23 merge; this review supersedes it.
Optional, not blocking
crates/dim-app-server/src/settings/native.rs:94 compares the revision before current_registration at :99, so a stale native handle whose revision no longer matches returns conflict, while docs/design/appserver/settings-service.md:125 says an unregistered source is unknown_source on every path. No write occurs in either order. Check the registration first or state the native precedence.
Refs #1292
Final calls and APIs
settings.register,declaredBy,projects,readandupdate.settings.authorizeProject({cwd})returns the root number and publishes the existing authorization notice.Settings::register_document::<D>and use its bound read and update operations.settings.registerDocument({source,userFile,projectFile?},codec)returnsread(scope)andupdate(scope,expectedRevision,document). Both return the revision and document. The codec suppliesdecode(bytes or null)andvalidate(document).commandRules.read({})reads the permission owner's registered document on each call.collaborationModelPolicy.read({}) → {revision,policy}when the local execution profile supplies the policy.hooksService.sources({cwd})returns the existing source snapshot.readUser,importUserIfAbsentandreplaceUseroperations.Source registrations end with the registering row. A later registration of the same name gets its own binding. Custom codecs run outside storage transactions. The public catalog exposes
settings; the Rust storage implementation stays inside its owner.