Skip to content

build(rutis): upgrade the plugin runtime to 0.23 - #1941

Merged
eric8810 merged 7 commits into
mainfrom
dim/1918-rutis-0-23
Nov 20, 2026
Merged

eric8810 merged 7 commits into
mainfrom
dim/1918-rutis-0-23

Conversation

@eric8810

@eric8810 eric8810 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Move Dim from rutis 0.19.3 to 0.23.0: the workspace crates, xtask's rutis-types, the bundled Node
runtime, the repository TypeScript plugins, the npm peer range and the Python SDK. rutis 0.23 speaks session
protocol 5 and refuses a protocol-4 end at the handshake, so every bundled end moves in this one change.

  • Pins and locks: rutis, rutis-loader, rutis-bridge, rutis-types, @arcships/rutis-runtime,
    @arcships/rutis, @arcships/rutis-host, the two shipped plugins, npm/package.json's peer range and
    runtime/python-requirements.txt.
  • Error::Value: 0.21 turned the tuple variant into a struct variant. The 83 constructors call
    Error::value; the 29 string-literal arguments drop the now-ambiguous .into().
  • Chunked frames: 0.23 carries a frame over the 16 MiB transport limit in chunk frames. The oversized
    notification case now crosses the session and meets Dim's own too_large frame limit; the test asserts that
    owner instead of rutis's old bad-value refusal.
  • pluginFiles text replace: the published 16 MiB admission limit now lives at Dim's boundary, because
    0.23 no longer refuses the call before it arrives. The serialized record must fit the 16 MiB frame; a larger
    text replace fails with a BindingError coded bad-value and leaves the previous contents intact.
    plugin_files_flow covers a near-limit success and the rejection; the Node fixture asserts the
    binding-visible error.
  • ADR: ADR 025 records the protocol-5 upgrade, the shared pin and the
    chunked transport boundary.
  • npm/branch-services.d.ts is regenerated; data objects become type aliases. modules.json is no longer
    committed (main xtask: stop committing modules.json and modules.mmd while keeping live boundary checks #1946); the merged branch uses xtask module-graph on demand.

Design rule checklist

  • Scope: n/a, no part is added, moved or re-scoped.
  • Commands and results: n/a, no command event or result changes.
  • Handover: n/a, no handover point changes.
  • Timeline before callbacks: n/a.
  • Infrastructure: n/a, the Timeline, Dispatcher, assembly and Session/branch contracts are unchanged; only
    the rutis release that carries them moves.
  • Core mechanisms and consumers gain no plugin-specific handling.
  • Batch: n/a.
  • Context: n/a, no new context path.
  • No reading another plugin's internal state or deciding for it.
  • Cross-language faces: existing data faces are unchanged; the upgrade updates the runtime that carries them
    and the generated declarations.
  • Business configuration stays out of loader rows; no configuration or language contract changes.
  • Missing mechanism capabilities: none raised; the upgrade adopts 0.23's existing forms.
  • Timeline holds only facts: n/a.

Documentation

  • No accepted ADR is modified. ADR 025 is new; ADR 015 is Proposed, and only its pinned rutis version and
    the reference to ADR 025 change.
  • No other module's design is changed; the architecture pages update the version they describe.
  • No delivery status is added to an ADR, index or roadmap.
  • The 0.19 upgrade document, its zh mirror, the checksum evidence and the research note remain snapshots.

Verification

Passed locally:

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo run --locked -p xtask -- check (module, crate, plugin documents, service catalog, declarations, plugin
    locks, comment links, literal-main)
  • cargo test --locked -p dim-app-server --test plugin_files_flow (9 passed; a near-limit text write succeeds,
    and the oversized one asserts bad-value and an unchanged file)
  • transport_flow node_public_plugin_files_session_only_configuration (Node fixture asserts the BindingError
    name, bad-value code and the unchanged file)
  • transport_flow missing_permission_state_refuses_a_committed_member_request_without_creating_a_member
    (the Permission shutdown poll now allows 30s; CI load had raced the old 10s poll)
  • node scripts/adr-check.mjs --base origin/main
  • node --test scripts/*.test.mjs (152 passed, 2 skipped)
  • node --test runtime/plugin-sdk.test.mjs runtime/light-ocr-*.test.mjs (22 passed)
  • tsc -p runtime/plugins/workflow/tsconfig.json
  • All 21 transport_flow node_session_typescript ignored flows, including
    node_session_typescript_oversized_notification_writes_nothing_and_keeps_the_connection (now asserts
    too_large and a live connection) and
    node_branch_typescript_create_takes_explicit_cancellation
  • Three of four transport_flow python_plugin_ ignored flows against a rutis==0.23.0 Python; the fourth
    (python_plugin_starts_after_runtime_install_and_daemon_restart) needs the runtime-install setup of CI
  • cargo test --workspace --locked: 152 test targets passed. Five targets failed in local environment or
    platform paths that this change does not touch:
    • dim-modality OCR flows report the PP-OCR helper unavailable on this Linux host (the Apple Vision path).
    • host_platform_flow::a_confined_helper_returns_when_an_escaped_descendant_holds_its_pipes fails its own
      escapee probe on this host.
    • dimcode cli_flow has six local TUI, provider and staged-update failures; the transport_flow timing case
      and the collaboration case passed when rerun alone.
    • xtask scenario_eval::the_run_list_is_the_probes_tool_set_and_the_product_serves_it_with_plugin fails at
      /tmp socket directory permissions.

cargo deny is not installed on this machine; CI runs it.

Fixes #1918

Pin rutis, rutis-loader, rutis-bridge and rutis-types at 0.23.0, with the bundled Node runtime, the repository TypeScript plugins, the npm peer range and the Python SDK. Session protocol 5 moves every bundled end together.

0.21 changed rutis_bridge::session::Error::Value to a struct variant, so the 83 constructors call Error::value; the 29 string-literal arguments drop the now-ambiguous .into().

0.23 chunks frames over 16 MiB, so the oversized notification case now meets Dim's own too_large frame limit instead of rutis's bad-value.

Fixes #1918
Add ADR 025 and update the current version pins and architecture history. Keep the 0.19 upgrade, its zh mirror and the evidence documents as snapshots.
@eric8810 eric8810 self-assigned this Nov 20, 2026
@eric8810
eric8810 marked this pull request as ready for review November 20, 2026 08:27

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a compatibility regression in the public pluginFiles text replacement path. Please preserve the existing oversized-write refusal before switching the bundled runtime to protocol 5. This finding is based on tracing the call path and the published rutis 0.23 behavior. The macOS verify job is still queued.

A 0.23 session keeps the 16 MiB transport message limit and adds the `chunk` frame: a larger frame is split
into chunks of at most 8 MiB and reassembled before dispatch. `max_transfer` is the ceiling for one frame
(256 MiB by default, `RUTIS_MAX_TRANSFER` for a deployment), not a default payload size. Dim keeps the
default ceiling and does not fragment payloads itself. A sender over its ceiling fails that call; a receiver

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Preserve the oversized text replacement refusal. The existing process-plugin contract promises that an oversized text replace fails with bad-value before the file changes. With chunking enabled, that call reaches the text replace arm, which serializes and commits the new contents without a size check. The underlying lease adds no limit. A write that was rejected under 0.19.3 can therefore overwrite an existing file and report success. Please enforce the published admission limit at the Dim boundary before committing the replacement, and add a flow assertion that the rejected write leaves the previous contents intact.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3c19363: pluginFiles now checks the serialized text record against the runtime frame before lease.replace, returns bad-value with the 16 MiB limit, and leaves the previous contents intact. plugin_files_flow::a_text_replace_over_the_frame_limit_leaves_the_file_unchanged covers it, and the process-typescript contract now says this boundary owns the refusal after 0.23 chunking.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified at 3c19363: the check returns bad-value before lease.replace, and plugin_files_flow::a_text_replace_over_the_frame_limit_leaves_the_file_unchanged passes with the previous contents intact (9 tests passed). Two follow-ups remain. Main now carries #1901's replace_text, and the merge conflict is exactly this arm, so the check must move there on rebase. Also, crates/dim-app-server/README.md:539 and docs/typescript-plugin-authoring.md:331-334 still attribute the refusal to the plugin runtime.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At 4d38ab5 the refusal code is unchanged and its flow test passes (9 tests, including a_text_replace_over_the_frame_limit_leaves_the_file_unchanged). The remaining risk is the rebase: current main 44af122 still has replace_text(lease, text, &cancel) at origin/main:crates/dim-app-server/src/plugin_files.rs:422-426, and that arm is the content conflict that can drop the check. Resolving toward main drops the check. ADR 026 merged as 44af122 also adds row conflicts at docs/INDEX.md and docs/adr/README.md; those are mechanical, but the plugin_files arm is the one that can drop the check. Rebase and carry the serialized-record check into replace_text, keeping bad-value and the unchanged file.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at fd70fae. The merge keeps the guard in the text replace arm at crates/dim-app-server/src/plugin_files.rs:428-444, before lease.replace at :440-443, so bad-value is returned at :434-439 and the file is not written. crates/dim-app-server/tests/plugin_files_flow.rs:376-424 passes (9/9), asserting bad-value and the previous contents. zerob13's two P2s at :32 and :435 are separate and remain open.

eric8810 added a commit that referenced this pull request Nov 20, 2026
Address all findings from PR #1940 review:
- Renumber from ADR 025 to ADR 026 across English/Chinese ADRs and
  indexes so PR #1941 retains 025 without collision.
- Split D2 automated checks into pure static L1 checks (zero business
  compilation) and runtime-assembled structural projections (workspace-
  coupled alongside L2), and scope the literal-scanner rule to
  introducing new scanners.
- Mark interactive terminal E2E in L3 as Retained (local-only), run
  locally on demand or before release and never invoked by CI workflows.
- Add asset-file edits (such as formal model changes) to D1's Retained
  definition and state that the tier table trigger column is authoritative.
- Clarify in Consequences that AGENTS.md and docs/architecture/ remain
  authoritative for current commands and committed snapshots until this
  ADR is accepted and follow-up tooling changes land.

Refs #1938
rutis 0.23 chunks a frame over the 16 MiB transport limit, so the runtime no longer refuses an oversized call before it arrives. Enforce the published admission limit at the pluginFiles boundary: a text record over the frame fails with bad-value and leaves the file unchanged.
@eric8810

Copy link
Copy Markdown
Collaborator Author

Addressed the pluginFiles finding in 3c19363: the text replace boundary now enforces the 16 MiB frame admission before lease.replace, returns bad-value, and leaves the file unchanged. Added plugin_files_flow coverage and updated the process-typescript contract. Ready for re-review.

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR moves every rutis surface from 0.19.3 to 0.23.0 (session protocol 5) and records the baseline in ADR 025. The pin set and the mechanical Error::value rewrite are consistent, and the 3c19363 text-replace refusal is correct: it returns bad-value before lease.replace, leaves the file unchanged, and its new flow test passes. The PR now has one merge conflict, one generated-artifact failure, and two contract texts that still describe the old runtime refusal.

[P1] The merge conflict is exactly the P1 fix; resolving it against main drops the refusal.

Problem: GitHub reports CONFLICTING and DIRTY. Main moved to 14cc130 and merged #1901, which replaced the text replace arm with replace_text(lease, text, &cancel) in crates/dim-app-server/src/plugin_files.rs. The only conflicted file and hunk is this PR's oversized-check arm at crates/dim-app-server/src/plugin_files.rs:454-473. Taking main's side of that hunk removes the size check and the bad-value return.

Failure scenario: the conflict is resolved in favor of main's replace_text, the new test is dropped with the arm or no longer compiles, and a text replace over 16 MiB again overwrites the file and reports success with no failing test.

Fix: rebase onto main and carry the serialized-record check into the replace_text path. Its current signature returns Result<(), FileStorageError>, which cannot express a bridge bad-value error, so either check the serialized record in the arm before the call or change the helper's error type. Keep plugin_files_flow::a_text_replace_over_the_frame_limit_leaves_the_file_unchanged and rerun the flow at the rebased head.

[P2] xtask check fails at 3c19363 because the generated graph is stale.

Problem: TEXT_REPLACE_FRAME_BYTES at crates/dim-app-server/src/plugin_files.rs:32 adds a crate::outbound::MAX_FRAME_BYTES reference, but docs/architecture/rust-agent/generated/modules.json and modules.mmd have no dim_app_server::plugin_files -> dim_app_server::outbound edge. cargo run --locked -p xtask -- check exits 1 with "generated architecture files are stale". CI runs target/debug/xtask check in the verify job (.github/workflows/ci.yml:194), so the queued verify will fail.

Failure scenario: the refusal test passes locally, but the PR cannot pass CI or merge.

Fix: run cargo run -p xtask -- graph, commit modules.json and modules.mmd, and rerun xtask check after the rebase. If #1946 lands first and stops committing these snapshots, adjust to its check.

[P2] The published contract still attributes the refusal to the plugin runtime.

Problem: crates/dim-app-server/README.md:539 and docs/typescript-plugin-authoring.md:331-334 still say any call argument over the 16 MiB frame is refused by the plugin's own runtime with RangeError bad-value "before it is sent", including a large text replace. After 0.23 a larger frame is chunked and crosses the session up to max_transfer (docs/adr/025-rutis-0-23.md:38-44). The 3c19363 update fixes docs/design/process-typescript.md but not these two texts.

Failure scenario: a plugin author bounds an argument to 16 MiB because the guide promises a refusal; a larger value crosses the session and the host allocates and dispatches it. For a text replace the refusal now comes from pluginFiles, not the runtime; for other arguments the runtime no longer refuses at the frame boundary, and only the limits each Dim API applies remain.

Fix: update both texts to the protocol-5 model: chunking up to the agreed max_transfer, then the limits and codes Dim's own faces enforce, including the text-replace boundary.

[P3] The text read arm is still unbounded while readBytes is capped.

Problem: crates/dim-app-server/src/plugin_files.rs:425-442 uses lease.read (whole file, no limit); readBytes at :443-453 uses read_limited(MAX_WHOLE_FILE_BYTES). With chunking, a text file written through writeStream and larger than 16 MiB can now be returned whole up to max_transfer (256 MiB by default).

Failure scenario: a plugin reads a 200 MiB text file and the App Server allocates and serializes it, defeating the 8 MiB whole-buffer bound and risking host memory exhaustion.

Fix: decide the text read policy. If text stays whole-buffer, use read_limited(MAX_WHOLE_FILE_BYTES) and return invalid_data; otherwise document the unbounded read and its memory cost.

[P3] Frame-based rationales are stale. docs/design/process-typescript.md:459-460 still says the 8 MiB byte cap sits "below the 12 MiB raw ceiling the base64-encoded runtime frame implies"; crates/dim-app-server/src/plugin_files.rs:22-26, runtime/plugins/workflow/definition.ts:8-9, docs/design/plugins/Workflow.md:472 and :646, and docs/design/p6-p7-bindings.md:173 also justify caps by the 16 MiB frame. Keep the caps; describe them as Dim's own allocation and payload policy.

Cross-PR checks: #1901 merged into main and caused the conflict above. #1946 is still open and itself CONFLICTING; it deletes modules.json and modules.mmd and changes xtask check, so the snapshot fix becomes unnecessary if it lands first, but this PR must pass the current check. #1940 uses ADR 026, so ADR 025 is free; both PRs insert a row at the same docs/adr/README.md and docs/INDEX.md anchor, so the second to merge places its row after the other.

Verified at 3c19363: git diff --check clean; cargo fmt --all -- --check --config error_on_line_overflow=true; node scripts/adr-check.mjs --base origin/main; cargo test -p dim-app-server --test plugin_files_flow 9 passed, including the new frame-limit test; the transport_flow and example targets compile. cargo run --locked -p xtask -- check fails on the stale graph above. git merge-tree against origin/main reports one conflict, crates/dim-app-server/src/plugin_files.rs. Pins: Cargo.lock is 0.23.0 for rutis, rutis-bridge, rutis-loader and rutis-macros; the PyPI 0.23.0 wheel sha256 matches runtime/python-requirements.txt; the rutis, rutis-host and rutis-runtime integrities and all five @arcships/rutis-host platform integrities match the npm locks. CI at 3c19363: changes, dependencies and web passed; windows-cli in progress; verify queued; acp-registry skipped.

Not run: the Node and Python ignored flows (no node_modules in this checkout), the tsc --strict claim, and the workspace suite.

)
.await
.map(|_| json!(null).into()),
("replace", LeaseArgument::Text(text)) => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1 regression risk] Main now carries #1901, which replaced this arm with replace_text(lease, text, &cancel), and this is the only merge conflict between the PR and main. Resolving in favor of main drops this check and reopens the oversized text replace. Rebase and put the check in the replace_text path, keeping the bad-value return and the unchanged-file behavior, then rerun plugin_files_flow::a_text_replace_over_the_frame_limit_leaves_the_file_unchanged.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still present at 4d38ab5 and against current main 44af122. The conflict hunk is unchanged, and main's replace_text is at origin/main:crates/dim-app-server/src/plugin_files.rs:422-426. The new ADR note does not affect it. Rebase and carry the check into replace_text; keep the flow test.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved at fd70fae. The merge keeps the serialized-record guard in the replace arm (crates/dim-app-server/src/plugin_files.rs:428-444) instead of adopting main's bare replace_text; the helper at :778-789 is now only used by transact_file at :754. plugin_files_flow passes 9/9, including a_text_replace_over_the_frame_limit_leaves_the_file_unchanged, and merge-tree against b623ac6 is clean.

/// the rest is the call envelope. rutis 0.23 chunks a frame over the transport
/// limit, so the plugin runtime no longer refuses this call before it arrives:
/// this boundary keeps the published refusal and leaves the file unchanged.
const TEXT_REPLACE_FRAME_BYTES: usize = crate::outbound::MAX_FRAME_BYTES - 64 * 1024;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] This new crate::outbound::MAX_FRAME_BYTES reference needs a generated-graph update. cargo run --locked -p xtask -- check fails at this head: docs/architecture/rust-agent/generated/modules.json and modules.mmd have no dim_app_server::plugin_files -> dim_app_server::outbound edge, and CI runs target/debug/xtask check in the verify job (.github/workflows/ci.yml:194). Run cargo run -p xtask -- graph and commit both snapshots, then rerun the check after the rebase.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Withdrawn as a required fix. #1946 merged into main as a43607b and deleted modules.json and modules.mmd; the new xtask check computes the module boundaries live (xtask/src/main.rs:409) and no longer compares the snapshots. The head still fails the old check, but the rebase should accept the deletion of both files instead of regenerating them. The crate::outbound::MAX_FRAME_BYTES reference passes the live boundary check.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Withdrawn. At fd70fae docs/architecture/rust-agent/generated/modules.json and modules.mmd are deleted, and cargo run --locked -p xtask -- check passes (743 modules, 4559 edges). No regeneration is needed.

Comment thread docs/design/process-typescript.md Outdated
`replace` included.
frame is refused before the file changes, failing only that call with `bad-value`
while the row and the file store stay up. Since rutis 0.23 chunks a larger frame,
the `pluginFiles` boundary now makes this refusal for a text `replace`; a rejected

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] This update covers pluginFiles, but the same published promise is still in crates/dim-app-server/README.md:539 and docs/typescript-plugin-authoring.md:331-334: both say the plugin's own runtime refuses any oversized call argument with bad-value before it is sent. Under 0.23 the runtime chunks instead. Update both texts and state which Dim boundary refuses which payload.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still present at 4d38ab5: crates/dim-app-server/README.md:539 and docs/typescript-plugin-authoring.md:331-334 are unchanged. The new ADR note at docs/adr/025-rutis-0-23.md:44-46 now states the boundary model, matching docs/design/process-typescript.md:461-465, so those two texts are the remaining contradiction. Update them to the protocol-5 model: chunking up to max_transfer, the pluginFiles text-replace bad-value limit, and the per-face limits for other arguments.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still present at fd70fae. crates/dim-app-server/README.md:539 and docs/typescript-plugin-authoring.md:331-334 are unchanged; both still say the plugin's own runtime refuses before sending, with a RangeError. docs/design/process-typescript.md:461-465 now says the boundary refuses a text replace. The new refusal is a bridge Error::value, which Node sees as a BindingError, so update the attribution, the type and the limit, or preserve RangeError at the binding.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at 0854481. crates/dim-app-server/README.md:539 and docs/typescript-plugin-authoring.md:331-335 now state the protocol-5 model: chunking up to max_transfer, the serialized-record admission for text replace, and the BindingError/bad-value refusal. docs/design/process-typescript.md:460-465 and docs/adr/025-rutis-0-23.md:44-47 agree. The Node flow asserts the name and code at crates/dim-app-server/tests/transport_flow/process_typescript.rs:280-293.

Record that a Dim boundary which published a 16 MiB admission limit enforces it itself after 0.23 chunking; pluginFiles text replace is the first case.
eric8810 added a commit that referenced this pull request Nov 20, 2026
…1940)

* docs(adr): propose ADR 025 for verification tiers and CI governance

Add proposed ADR 025 defining the five verification tiers (L0–L4,
including event-driven formal model verification), test coverage and
placement discipline, and CI governance rules, along with its mirrored
Chinese translation, index entries and a routing pointer in AGENTS.md.

Refs #1938

* docs(adr): refine ADR 025 with three operational states and form-only doc checks

Incorporate review feedback from #1940:
- Frame D1 around three operational test states (Active gate, Retained
  on-demand/sweep, Dev/exploratory) with L0–L4 mapped onto them, keeping
  ADR freeze checks in L1, splitting L0 triggers into model-file changes
  and review checklists, scoping L2 to reverse-dependency closures, and
  distinguishing L4 execution from L4 harness self-checks.
- Add D2 stating that documentation guides and carries semantic contracts
  while automated checks enforce deterministic form and structural
  invariants without business compilation or prose/literal guessing.
- Reconcile D3 with AGENTS.md Testing (lowest flow or contract layer) and
  add a release-unreachability bound for runtime test injection.
- Move numeric latency budgets out of the immutable ADR (D4) and require
  an active scheduled sweep with triage/bisection ownership before
  narrowing main pushes (D5).
- Revert the AGENTS.md edit until ADR 025 is accepted.

Refs #1938

* docs(adr): add generated-snapshot restraint rule to ADR 025 D2

Clarify under D2 that generated files are committed and freshness-checked
only when downstream code consumes them or when they serve as concise,
actively referenced public summaries; fine-grained internal graphs used
for boundary enforcement are verified live in memory and generated on
demand instead of committed to Git.

Refs #1938

* docs(adr): renumber to ADR 026 and resolve second-round review findings

Address all findings from PR #1940 review:
- Renumber from ADR 025 to ADR 026 across English/Chinese ADRs and
  indexes so PR #1941 retains 025 without collision.
- Split D2 automated checks into pure static L1 checks (zero business
  compilation) and runtime-assembled structural projections (workspace-
  coupled alongside L2), and scope the literal-scanner rule to
  introducing new scanners.
- Mark interactive terminal E2E in L3 as Retained (local-only), run
  locally on demand or before release and never invoked by CI workflows.
- Add asset-file edits (such as formal model changes) to D1's Retained
  definition and state that the tier table trigger column is authoritative.
- Clarify in Consequences that AGENTS.md and docs/architecture/ remain
  authoritative for current commands and committed snapshots until this
  ADR is accepted and follow-up tooling changes land.

Refs #1938

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At 4d38ab5 the PR still moves every rutis surface from 0.19.3 to 0.23.0 (session protocol 5) and records the baseline in ADR 025. The new commit only adds the ADR 025 D3 admission note. That note is accurate for the pluginFiles boundary, but the code conflict and the two stale contract texts remain. Main also moved during this review: #1946 merged as a43607b6, #1948 as 6f5bab6a3, and #1940 as 44af122c. #1946 supersedes the generated-snapshot finding and makes modules.json a modify/delete conflict; #1940 adds ADR 026 at the same docs/INDEX.md and docs/adr/README.md insertion points as ADR 025, so both index rows now conflict too.

[P1] The merge conflict still drops the oversized text replace check.

Problem: GitHub reported the PR CONFLICTING and DIRTY at 4d38ab5, and git merge-tree against current main 44af122c still reports conflicts. The content conflict is the text replace arm at crates/dim-app-server/src/plugin_files.rs:454-470. Main has replace_text(lease, text, &cancel) at origin/main:crates/dim-app-server/src/plugin_files.rs:422-426, and the helper at :760-771 serializes and commits the record without a size check. The merged ADR 026 rows now also conflict at docs/INDEX.md and docs/adr/README.md, and modules.json is modify/delete after #1946; those are mechanical, but the rebase must resolve all of them. The new ADR line does not change the text-replace risk: it is documentation only and does not touch the arm.

Failure scenario: The conflict is resolved in favor of main's replace_text; the TEXT_REPLACE_FRAME_BYTES check and its bad-value return disappear, and a text replace over the limit again overwrites the file and reports success. The new test is dropped with the arm or no longer exercises the check.

Fix: Rebase onto 44af122c, order the ADR 025 rows after ADR 026, accept the snapshot deletions, and carry the serialized-record check into the replace_text path. Its current signature returns Result<(), FileStorageError>, which cannot express a bridge bad-value error, so check the serialized record in the arm before the call or change the helper's error type. Keep plugin_files_flow::a_text_replace_over_the_frame_limit_leaves_the_file_unchanged and rerun it at the rebased head.

[P2] The published contract still attributes the refusal to the plugin runtime.

Problem: crates/dim-app-server/README.md:539 says any call argument over the 16 MiB frame is refused by the plugin's own runtime before sending, including a large text replace, with RangeError bad-value. docs/typescript-plugin-authoring.md:331-334 says the same. After 0.23 the runtime chunks a larger frame up to max_transfer; the text-replace refusal is now the pluginFiles boundary's, as docs/design/process-typescript.md:461-465 and the new ADR note at docs/adr/025-rutis-0-23.md:44-46 now say. The two published texts are the remaining contradiction.

Failure scenario: A plugin author bounds an argument to 16 MiB because the guide promises a runtime refusal; a larger value crosses the session and the host allocates and dispatches it. For text replace the refusal comes from pluginFiles as bad-value; for other arguments the runtime no longer refuses at the frame boundary, and only the limits each Dim face applies remain.

Fix: Update both texts to the protocol-5 model: chunking up to the agreed max_transfer, then the limits and codes Dim's own faces enforce, including the pluginFiles text-replace bad-value limit.

[P3 optional] The text read arm is still unbounded while readBytes is capped.

Problem: crates/dim-app-server/src/plugin_files.rs:425-442 uses lease.read (whole file, no limit); readBytes at :443-453 uses read_limited(MAX_WHOLE_FILE_BYTES). With chunking, a text file written through writeStream and larger than 16 MiB can be returned whole up to max_transfer (256 MiB by default). The rebase does not remove it: main's read_text at origin/main:crates/dim-app-server/src/plugin_files.rs:743-758 still calls unbounded lease.read.

Failure scenario: A plugin reads a 200 MiB text file and the App Server allocates and serializes it, defeating the 8 MiB whole-buffer bound and risking host memory exhaustion.

Fix: Decide the text read policy. If text stays whole-buffer, use read_limited(MAX_WHOLE_FILE_BYTES) and return invalid_data; otherwise document the unbounded read and its memory cost.

[P3 optional] Frame-based rationales remain.

docs/design/process-typescript.md:459-460 still says the 8 MiB byte cap is "below the 12 MiB raw ceiling the base64-encoded runtime frame implies". crates/dim-app-server/src/plugin_files.rs:22-26, runtime/plugins/workflow/definition.ts:8-9, docs/design/plugins/Workflow.md:472 and :646, and docs/design/p6-p7-bindings.md:173 also justify caps by the 16 MiB frame. Keep the caps; describe them as Dim's own allocation and payload policy.

[P3 optional] The new ADR note's "first such case" is ambiguous.

docs/adr/025-rutis-0-23.md:44-46 says the boundary enforces a published 16 MiB admission limit and pluginFiles text replace is the first such case. sessionFiles already publishes and enforces its own 16 MiB too_large limit before writing (docs/design/appserver/session-files.md:471 and :480). Scope the sentence to this upgrade: the first case where a limit the runtime used to refuse before chunking is now enforced by the Dim boundary.

Withdrawn: the previous [P2] that asked to regenerate modules.json and modules.mmd (inline 4640554751). #1946 merged as a43607b6: main deletes both snapshots and xtask check now computes the module boundaries live (xtask/src/main.rs:405-409, xtask/src/modules.rs:60) without comparing them. The head as committed still fails the old check; I reproduced generated architecture files are stale for both files with isolated env. The rebase should accept the deletion of both files and not run xtask graph. The inline note on docs/architecture/rust-agent/generated/modules.json:56407 covers the modify/delete conflict. While rebasing, also adjust ADR 025's Consequences bullet at docs/adr/025-rutis-0-23.md:76-77: the committed graph no longer records Error::value, so the "generated service graphs" claim is stale; npm/branch-services.d.ts remains.

Cross-PR checks: #1901 merged as 14cc130 and caused the plugin_files conflict. #1946 merged as a43607b and superseded the snapshot finding. #1940 merged as 44af122c; its ADR 026 rows collide with this PR's ADR 025 rows at docs/INDEX.md and docs/adr/README.md, so the rebase places the 025 rows after 026. ADR 025 is otherwise free.

Verified at 4d38ab5 with isolated HOME/TMPDIR/XDG/CARGO_TARGET_DIR and LC_ALL=en_US.UTF-8: git diff --check origin/main...HEAD clean; cargo fmt --all -- --check --config error_on_line_overflow=true passed; node scripts/adr-check.mjs --base origin/main passed; cargo test -p dim-app-server --test plugin_files_flow --locked 9 passed, 0 failed, including a_text_replace_over_the_frame_limit_leaves_the_file_unchanged. xtask check built from the head exits 1 on the stale modules.json and modules.mmd; after #1946 the new check no longer compares them (not run against a rebased head). Pins: Cargo.lock has rutis, rutis-bridge, rutis-loader, rutis-macros and rutis-types at 0.23.0; Cargo.toml, xtask/Cargo.toml, runtime/package.json, both plugin manifests and the npm peer dependency are 0.23.0; runtime/python-requirements.txt pins rutis 0.23.0 with the sha256 previously verified. Merge-tree against current main 44af122c: content conflicts in crates/dim-app-server/src/plugin_files.rs, docs/INDEX.md and docs/adr/README.md, plus docs/architecture/rust-agent/generated/modules.json modify/delete; modules.mmd is deleted cleanly.

CI at 4d38ab5: changes, dependencies, web, windows-cli and acp-registry passed; verify was still in progress at the last check. GitHub's mergeable state was CONFLICTING and DIRTY before main moved; git merge-tree against 44af122c reports the three content conflicts and the modify/delete above. Head is unchanged at 4d38ab5.

Not run: the Node and Python ignored flows (no node_modules in this checkout), the tsc --strict claim, the workspace suite, and xtask check against a rebased head.

{
"module": "dim_agent_capabilities::session_files",
"path": "Error::Value"
"path": "Error::value"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] #1946 merged as a43607b and deleted this file together with modules.mmd; the new xtask check computes the module boundaries live (xtask/src/main.rs:409, xtask/src/modules.rs:60) and does not compare the snapshot. This one-line update therefore conflicts (modify/delete) with main and is no longer needed. Rebase, accept the deletion of both files, and do not run xtask graph to commit them. The crate::outbound::MAX_FRAME_BYTES reference at crates/dim-app-server/src/plugin_files.rs:32 passes the live boundary check.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Withdrawn; modules.json is deleted at this head. The related stale consequence at docs/adr/025-rutis-0-23.md:76-77 is covered by the new inline and body.

Comment thread docs/adr/025-rutis-0-23.md Outdated
default ceiling and does not fragment payloads itself. A sender over its ceiling fails that call; a receiver
whose ceiling is smaller ends the session, so both ends of a deployment must agree on the limit. Where Dim
published a 16 MiB admission limit of its own, the boundary enforces it before the write; `pluginFiles` text
`replace` is the first such case.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3 optional] "first such case" is ambiguous. sessionFiles already publishes and enforces its own 16 MiB admission limit with too_large before writing (docs/design/appserver/session-files.md:471 and :480). Scope this note to this upgrade: the first case where a limit the runtime used to refuse before chunking is now enforced by the Dim boundary, or drop "first".

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still as written at fd70fae. docs/adr/025-rutis-0-23.md:44-46 still says "first such case" while sessionFiles already enforces a 16 MiB too_large limit at docs/design/appserver/session-files.md:471 and :480. Optional: scope it to this upgrade or drop "first".

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at 0854481. docs/adr/025-rutis-0-23.md:44-47 now says pluginFiles text replace "admits a serialized record up to the 16 MiB frame and is the first case in this upgrade", so the sentence is scoped to this upgrade.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The merged head carries the pre-write guard. Both built-in PluginFiles checks passed on Linux, covering normal writes and preservation of the previous contents after rejection. Two caller-visible compatibility gaps remain in the text replacement contract. The macOS verify job is queued.

})
.expect("text records contain only serializable fields");
if bytes.len() > TEXT_REPLACE_FRAME_BYTES {
return Err(Error::value(format!(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Preserve the documented Node error type. Error::value carries bad-value across the bridge as BindingError. Node decodes that as an Error named BindingError. The old sender raised a native RangeError, which the public authoring guide still promises. A caller that uses instanceof RangeError to select a smaller write now skips that fallback. Preserve the documented error type and size details at the binding, or get agreement on a contract change. The in-process Rust test verifies the code and file contents. A binding-level assertion should cover the error visible to Node. Authoring contract · Old sender · Rust error encoding · Node error decoding

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Verified at fd70fae: Error::value at crates/dim-app-server/src/plugin_files.rs:435 crosses as BindingError (rutis v0.23.0 crates/rutis-bridge/src/session/protocol.rs:100-126), and Node decodes an unknown name to a plain Error named BindingError (node/rutis-runtime/src/errors.mjs:131-147), so instanceof RangeError is false. The flow test at crates/dim-app-server/tests/plugin_files_flow.rs:409 only asserts the Rust code. The published guide still promises RangeError at docs/typescript-plugin-authoring.md:331-334 and crates/dim-app-server/README.md:539. Preserve the type at the binding or update the contract, and add a binding-level assertion.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed at 0854481. The fixture calls file.replace with 16 MiB from Node (runtime/fixtures/files-session.ts:36-45), and crates/dim-app-server/tests/transport_flow/process_typescript.rs:280-293 asserts name BindingError, code bad-value, a message containing 16 MiB, and unchanged contents. crates/dim-app-server/README.md:539 and docs/typescript-plugin-authoring.md:331-335 now document the same Node-visible behavior. The bridge encoding is rutis v0.23.0 crates/rutis-bridge/src/session/protocol.rs:88-131 and node/rutis-runtime/src/errors.mjs:133-169.

/// the rest is the call envelope. rutis 0.23 chunks a frame over the transport
/// limit, so the plugin runtime no longer refuses this call before it arrives:
/// this boundary keeps the published refusal and leaves the file unchanged.
const TEXT_REPLACE_FRAME_BYTES: usize = crate::outbound::MAX_FRAME_BYTES - 64 * 1024;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Keep previously admitted text writes within the supported range. This threshold subtracts a fixed 64 KiB from 16 MiB and applies it to the stored JSON record. The old runtime counted the encoded call itself. For an ordinary one-argument lease call, its envelope uses much less than 64 KiB, so some text records that previously fit now fail with a message saying they exceed 16 MiB. This can block saving a near-limit file that an existing installation already wrote. Match the prior admission rule, or explicitly agree and document a smaller independent limit. Cover a formerly accepted near-limit write as well as the existing rejection case. Old frame-size check

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Verified: the check compares the stored JSON record (text plus 23 bytes) against 16 MiB - 64 KiB at crates/dim-app-server/src/plugin_files.rs:32 and :434, while 0.19.3 refused only when the encoded call frame exceeded 16 MiB (rutis v0.19.3 node/rutis-runtime/src/session.mjs:540-548, with MAX_MESSAGE at session.mjs:99). A 16 MiB - 40 KiB text (16,736,256 bytes) was under the old frame limit; its stored record is 16,736,279 bytes and now exceeds 16,711,680. Match the old rule or document the smaller limit, test a formerly accepted near-limit write, and fix the message at :436, which still says the runtime's 16 MiB frame.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed at 0854481. TEXT_REPLACE_FRAME_BYTES is now the full 16 MiB (crates/dim-app-server/src/plugin_files.rs:31, crates/dim-app-server/src/outbound.rs:6), and the guard compares the serialized stored record at crates/dim-app-server/src/plugin_files.rs:428-433 before lease.replace. crates/dim-app-server/tests/plugin_files_flow.rs:395-406 now admits a 16 MiB minus 40 KiB text, a 16,736,279 byte record that the old 16 MiB minus 64 KiB threshold would have rejected, and reads it back. The 16 MiB refusal at :414-433 still returns bad-value with the previous contents intact. plugin_files_flow passes 9/9 locally.

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At fd70fae the PR still moves every rutis surface from 0.19.3 to 0.23.0 (session protocol 5) and records the baseline in ADR 025. The merge of origin/main 44af122 resolves the previous conflict by keeping the serialized-record guard in the text replace arm, and git merge-tree against current main b623ac6 is clean. The guard now blocks the oversized write without writing. The remaining blockers are contract-level: the new refusal has a different Node-visible error type and a narrower admission threshold than 0.19.3, and the two published texts still describe the old runtime refusal.

Resolved from the previous round:

  • The P1 conflict risk is gone. The merge keeps the guard in the replace arm at crates/dim-app-server/src/plugin_files.rs:428-444, serializing at :429-433, refusing at :434-439, and calling lease.replace at :440-443, instead of adopting main's bare replace_text(lease, text, &cancel). It returns bad-value and does not write. plugin_files_flow::a_text_replace_over_the_frame_limit_leaves_the_file_unchanged at crates/dim-app-server/tests/plugin_files_flow.rs:376-424 asserts the code and the unchanged contents; the suite passes 9/9. The helper at :778-789 remains unchecked, but its only caller is transact_file at :754, which is the host-side lock path, not the plugin replace call.
  • The snapshot P2 is withdrawn. docs/architecture/rust-agent/generated/modules.json and modules.mmd are deleted at this head, and cargo run --locked -p xtask -- check passes (743 modules, 4559 edges).
  • My previous placement instruction ("put the ADR 025 rows after ADR 026") was wrong, and I withdraw it. Numeric order is the convention in both files, and the head has ADR 025 before 026 at docs/INDEX.md:52-53 and docs/adr/README.md:35-36, which is correct.

[P2] The public contract still says the runtime refuses and promises a RangeError.

Problem: crates/dim-app-server/README.md:539 and docs/typescript-plugin-authoring.md:331-334 are unchanged. Both say the plugin's own runtime refuses an oversized call before sending it, with a RangeError coded bad-value naming the argument and the limit. Under 0.23 the runtime chunks up to max_transfer, and the refusal now comes from pluginFiles as a bridge Error::value, which Node sees as an Error named BindingError, not a RangeError (rutis v0.23.0 crates/rutis-bridge/src/session/protocol.rs:100-126 and node/rutis-runtime/src/errors.mjs:131-147). docs/design/process-typescript.md:461-465 was updated, so these two texts are the remaining contradiction.

Failure scenario: A plugin author relies on the guide and does not bound a call argument; under 0.23 the runtime chunks up to max_transfer (256 MiB by default), so a payload larger than 16 MiB now crosses the session and is allocated or dispatched by the host, or fails later with a different code. For a text replace, the rejection is a BindingError, so a RangeError fallback is skipped.

Fix: Update both texts to the protocol-5 model: chunking up to the agreed max_transfer, then the limits and codes Dim's own faces enforce, including the pluginFiles text-replace refusal. State the error name and code and the actual limit, or preserve RangeError at the binding and add a Node-level assertion. crates/dim-app-server/tests/plugin_files_flow.rs:409 only checks the Rust code.

[P2] I agree with zerob13 on the two caller-visible gaps at crates/dim-app-server/src/plugin_files.rs:32 and :435: the guard changes the Node-visible error type and narrows the admission threshold below the rule 0.19.3 enforced. I verified both against rutis v0.19.3 node/rutis-runtime/src/session.mjs:540-548 and v0.23.0 crates/rutis-bridge/src/session/protocol.rs:100-126 and node/rutis-runtime/src/errors.mjs:131-147. A 16 MiB - 40 KiB text (16,736,256 bytes) was under the old encoded-frame limit; its stored record is 16,736,279 bytes and now exceeds 16,711,680 (16 MiB - 64 KiB), so a near-limit write an existing installation accepted can now fail. Matching the old rule or explicitly documenting the smaller bound, plus the near-limit and binding-level tests zerob13 asked for, closes both.

[P3 optional] The ADR 025 Consequences line is stale.

Problem: docs/adr/025-rutis-0-23.md:76-77 says the generated service graphs change and "the graph records Error::value". #1946 (a43607b) deleted docs/architecture/rust-agent/generated/modules.json and modules.mmd, no remaining file under docs/architecture/rust-agent/generated/ records Error::value, and this PR changes no generated graph. Only npm/branch-services.d.ts changes, and its change is the interface to type rewrite.

Failure scenario: A reader uses the ADR to expect a committed graph diff that is not in the PR and cannot tell which generated artifact this upgrade touched.

Fix: Drop the graph clause or say #1946 retired the module snapshot; keep the branch-services type-alias change.

[P3 optional] "First such case" is still ambiguous.

docs/adr/025-rutis-0-23.md:44-46 still calls the pluginFiles text replace the first case where Dim enforces a published 16 MiB admission limit. sessionFiles already publishes and enforces a 16 MiB too_large limit before writing (docs/design/appserver/session-files.md:471 and :480). Scope the sentence to this upgrade, or drop "first".

[P3 optional] Text read remains unbounded and frame rationales remain.

crates/dim-app-server/src/plugin_files.rs:765 still calls unbounded lease.read while readBytes at :418 uses read_limited(MAX_WHOLE_FILE_BYTES). With chunking, a text file written through writeStream can be returned whole up to max_transfer. The frame-based rationales also remain at crates/dim-app-server/src/plugin_files.rs:22-26, docs/design/process-typescript.md:459-460, docs/design/plugins/Workflow.md:472 and :646, docs/design/p6-p7-bindings.md:173, and runtime/plugins/workflow/definition.ts:8-9. Keep the caps; decide whether text read is bounded, and describe the caps as Dim's own allocation policy rather than the runtime frame.

Cross-PR checks: #1901 merged as 14cc130 caused the old plugin_files conflict; #1946 merged as a43607b deleted the module snapshots; #1940 merged as 44af122 added ADR 026; #1925 merged as b623ac6 changes scripts/ci-changes.mjs and docs/release/README.md and does not conflict. git merge-tree --write-tree origin/main HEAD exits 0 at 5ff4dfce261c6e450976bd5957916890dc93a858.

Verified at fd70fae with isolated HOME/TMPDIR/XDG/CARGO_TARGET_DIR and LC_ALL=en_US.UTF-8: git diff --check origin/main...HEAD clean; git merge-tree --write-tree origin/main HEAD clean; cargo fmt --all -- --check --config error_on_line_overflow=true passed; node scripts/adr-check.mjs --base origin/main passed (58 changed files); cargo test -p dim-app-server --test plugin_files_flow --locked 9 passed, 0 failed, including the new test; cargo run --locked -p xtask -- check passed (743 modules, 4559 edges, 26 plugin documents). Pins: Cargo.lock has rutis, rutis-bridge, rutis-loader, rutis-macros and rutis-types at 0.23.0; Cargo.toml, xtask/Cargo.toml, runtime/package.json, both plugin manifests and the npm peer dependency are 0.23.0; runtime/python-requirements.txt pins rutis 0.23.0 with its hash.

CI at fd70fae: changes, dependencies, web and windows-cli passed; verify is pending; acp-registry is skipped. GitHub reports MERGEABLE and UNSTABLE, head unchanged at fd70fae1, base main at b623ac69, PR open and not draft.

Not run: the Node and Python ignored flows (no node_modules in this checkout), the tsc --strict claim, the workspace suite, and a Node-level assertion for the new error, which is exactly the gap in the [P2] above.

Verdict: REQUEST_CHANGES. The remaining [P2] contract texts and zerob13's two [P2] compatibility gaps are blockers; the [P3] items are optional.

Comment thread docs/adr/025-rutis-0-23.md Outdated
updated only where they describe a behavior Dim owns.
- Cancelled calls are acknowledged by the callee; queued writes and close semantics change; event order around
a row ending or unloading changes. The upgrade verifies these flows rather than adding new mechanisms.
- Generated service graphs and `npm/branch-services.d.ts` change: the graph records `Error::value`, and data

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3 optional] Problem: this consequence says the generated service graphs change and "the graph records Error::value", but #1946 (a43607b) deleted docs/architecture/rust-agent/generated/modules.json and modules.mmd, no remaining file under docs/architecture/rust-agent/generated/ records Error::value, and this PR changes no generated graph. Only npm/branch-services.d.ts changes. Failure: a reader expects a committed graph diff that is not in the PR. Fix: drop the graph clause or say #1946 retired the module snapshot; keep the branch-services interface to type change.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at 0854481. docs/adr/025-rutis-0-23.md:77-78 now says only npm/branch-services.d.ts changes and that #1946 retired the module graph snapshots; no generated graph records Error::value. Withdrawn.

@codoggy codoggy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

[Blocking] Preserve valid near-limit writes and the Node error contract

When a plugin replaces a text file with a payload that was valid under the previous call-size admission rule, crates/dim-app-server/src/plugin_files.rs:28-32 reserves a fixed 64 KiB and crates/dim-app-server/src/plugin_files.rs:428-443 compares the reduced limit with the serialized stored record size. This can reject previously valid writes and report that they exceeded 16 MiB even though the prior sender measured the encoded call; callers that retry smaller payloads can therefore fail earlier than before.

Evidence: Static inspection of the merge-base diff shows the new 64 KiB reservation and the changed text-replacement admission path. The current regression test covers an obviously oversized write and unchanged contents, but not a successful near-limit write. Tests not run locally.

Requested change: Preserve the previous admission rule or explicitly document and version the smaller effective limit, and add a successful near-limit write regression test alongside the oversized rejection case.

[Blocking] Preserve the binding-visible error type for oversized writes

When a plugin sends an oversized replacement, the new Rust-side guard returns Error::value, whereas the authoring contract at docs/typescript-plugin-authoring.md:331-334 promises a RangeError with code bad-value. Moving the rejection before the Node sender changes the exception type seen by a plugin, so code that handles err instanceof RangeError no longer follows its documented recovery path.

Evidence: Static inspection of the merge-base diff shows the admission check moved into the Rust pluginFiles path while the TypeScript authoring contract still specifies the native RangeError behavior. The Rust flow test checks the error code and unchanged contents but does not assert the exception observed through the Node binding. Tests not run locally.

Requested change: Preserve the binding-visible RangeError/bad-value contract, or explicitly revise the compatibility contract and add a Node binding regression test for the exception type.

Admit a text record up to the full 16 MiB frame, so a near-limit write that 0.19.3 accepted still succeeds, and cover both the near-limit success and the oversized rejection. The Node fixture asserts the binding-visible BindingError and bad-value code. Update the app-server README, authoring guide and process-typescript design to the protocol-5 model, and scope ADR 025's consequences to the artifacts this upgrade changes.
@eric8810

Copy link
Copy Markdown
Collaborator Author

Addressed the remaining blockers in 0854481:

  • Admission threshold: the guard now admits a serialized record up to the full 16 MiB frame (no 64 KiB reservation), so the near-limit write that 0.19.3 accepted still succeeds. plugin_files_flow now covers a 16 MiB - 40 KiB write that succeeds and a 16 MiB text that is refused with the previous contents intact.
  • Binding-visible error: the Node fixture now asserts the oversized replace is a BindingError with code bad-value, and the file is unchanged. crates/dim-app-server/README.md and docs/typescript-plugin-authoring.md now state the protocol-5 model: chunking up to max_transfer, then the limits Dim's faces enforce, with the text-replace BindingError/bad-value limit.
  • ADR 025: the stale generated-graph consequence is removed and the admission sentence is scoped to this upgrade.

Verified locally: plugin_files_flow 9/9, the Node node_public_plugin_files_session_only_configuration flow, cargo fmt --check, cargo clippy -p dim-app-server --all-targets --locked -- -D warnings, xtask check and adr-check.

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At 0854481 the PR still moves every rutis surface from 0.19.3 to 0.23.0 (session protocol 5) and records the baseline in ADR 025. The previous two P2s are resolved, and nothing in the upgrade, the pin set or the earlier text-replace fix regressed. Merge-tree against current main b15bc92 is clean.

Resolved from the previous round:

  • Admission threshold. TEXT_REPLACE_FRAME_BYTES is now crate::outbound::MAX_FRAME_BYTES, 16 MiB (crates/dim-app-server/src/plugin_files.rs:31, crates/dim-app-server/src/outbound.rs:6). The guard serializes StoredFile {version, text} at :428-432 and compares that stored-record length at :433 before lease.replace at :439-442, so it measures the serialized record, not the call frame. The near-limit text is 16 MiB minus 40 KiB, which serializes to a 16,736,279 byte record and was under 0.19.3's encoded-frame ceiling; crates/dim-app-server/tests/plugin_files_flow.rs:395-406 writes it, reads the exact text back, and restores "original". A 16 MiB text (:414) is still refused with bad-value (:428), and the file reads "original" after the refusal (:430-433). The suite passes 9/9 locally.
  • Binding-visible error. Error::value crosses the bridge as BindingError with code bad-value (rutis v0.23.0 crates/rutis-bridge/src/session/protocol.rs:88-131 and node/rutis-runtime/src/errors.mjs:133-169). The fixture performs the 16 MiB replace from Node (runtime/fixtures/files-session.ts:36-45), and the ignored Node flow asserts name BindingError, code bad-value, a message containing 16 MiB, and the unchanged contents (crates/dim-app-server/tests/transport_flow/process_typescript.rs:280-293). This is the binding-level assertion the previous round asked for.
  • Published texts. crates/dim-app-server/README.md:539 and docs/typescript-plugin-authoring.md:331-335 now state the protocol-5 model: chunking up to max_transfer, the serialized-record admission, and the BindingError/bad-value refusal. docs/design/process-typescript.md:460-465 and docs/adr/025-rutis-0-23.md:44-47 agree.
  • ADR 025. Consequences at docs/adr/025-rutis-0-23.md:77-78 no longer claim that a generated graph records Error::value and say #1946 retired the module snapshots. D3 at :44-47 scopes the admission sentence to this upgrade with "the first case in this upgrade".

Optional and unchanged since the previous round:

  • Text read remains unbounded at crates/dim-app-server/src/plugin_files.rs:764, while readBytes uses read_limited(MAX_WHOLE_FILE_BYTES) at :417. With chunking, a text file written through writeStream can be returned whole up to max_transfer.
  • Frame-based cap rationales remain at runtime/plugins/workflow/definition.ts:8-9, docs/design/plugins/Workflow.md:472 and :646, and docs/design/p6-p7-bindings.md:173. Neither item blocks this PR.

Cross-PR checks: #1946 (a43607b) retired the module snapshots; #1937 (b15bc92) touches timeline_export and CI scripts only. Open PRs #1949, #1920 and #1921 change ci.yml outside this PR's hunk, and #1904 changes docs/typescript-plugin-authoring.md:40, not the file section.

Verified at 0854481 with isolated HOME/TMPDIR/XDG/CARGO_TARGET_DIR and LC_ALL=en_US.UTF-8: git diff --check origin/main...HEAD clean; git merge-tree --write-tree origin/main HEAD exits 0 at 62fcc26101a29bf158068e660ecd8b9bbee06d85; cargo fmt --all -- --check --config error_on_line_overflow=true passed; node scripts/adr-check.mjs --base origin/main passed (61 changed files); cargo test -p dim-app-server --test plugin_files_flow --locked 9 passed, 0 failed, including the updated frame-limit test; the transport_flow target compiles; cargo run --locked -p xtask -- check passed (743 modules, 4559 edges, 26 plugin documents). Pins: Cargo.lock has rutis, rutis-bridge, rutis-loader, rutis-macros and rutis-types at 0.23.0; Cargo.toml, xtask/Cargo.toml, runtime/package.json and its lock, both plugin manifests and the npm peer dependency are 0.23.0; runtime/python-requirements.txt pins rutis 0.23.0 with its hash.

CI at 0854481: changes, dependencies, web and windows-cli passed; verify is queued; acp-registry is skipped. GitHub reports MERGEABLE and UNSTABLE; head is unchanged at 08544819, the PR base is 44af122c and current main is b15bc92a. The Node-backed ignored flow was not run locally because this checkout has no node_modules; CI's verify job runs transport_flow node_ --ignored once it starts.

Verdict: APPROVE. The remaining items are optional P3s.

The 10s poll raced the Permission part shutdown under the CI load; the outer deadline was 15s. Allow 30s for the state to disappear and 45s for the test.

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At 5dc83cf the PR still moves every rutis surface from 0.19.3 to 0.23.0 (session protocol 5) and records the baseline in ADR 025. Since the approval at 0854481 the only new commit is test(collaboration): give permission shutdown a longer deadline, which changes only crates/dim-app-server/tests/transport_flow/collaboration.rs (12 insertions, 4 deletions). The upgrade, the pin set, the pluginFiles admission guard and the published texts are unchanged. Merge-tree against current main 2537795 is clean (82183f719844cea3be2f8141ca5e229f0107c3ef).

The longer deadline is justified, not a masked hang:

  • The verify job at 0854481 failed in its workspace test step; the transport_flow binary reported exactly one failure, collaboration::missing_permission_state_refuses_a_committed_member_request_without_creating_a_member, panicking in the old 10 s poll with deadline: permission state is unavailable (584 passed, 1 failed, 98 ignored).
  • The poll waits for the Permission part's StateCell to be withdrawn, which happens after the rutis fiber unload. FiberInner::wait_events bounds that wait with shutdown_deadline(), 10 s by default (rutis 0.23.0 src/fiber.rs:622-626 and :1344-1351). The test deliberately holds a dispatch through DispatchGate (collaboration.rs:6044-6146), so the state disappears only after that bound. The old 10 s poll deadline was equal to it.
  • At this head the targeted test passes in 10.11 s end to end, consistent with the state disappearing at the fiber's 10 s bound rather than earlier. A 10 s poll loses that race. Rerunning with RUTIS_SHUTDOWN_TIMEOUT=2 passes in 2.26 s, so the wait tracks shutdown_deadline() rather than a fixed delay.
  • Negative control: rerunning with RUTIS_SHUTDOWN_TIMEOUT=60 keeps the held event from being dropped, and the test fails at 30.06 s at collaboration.rs:1341 with the same deadline message. The assertion still catches a shutdown that never withdraws the state; the longer limit tolerates a bounded wait, it does not hide an unbounded one.
  • closing.await.unwrap().unwrap() at collaboration.rs:8382 still fails the test on a shutdown error, and the 45 s outer timeout still bounds the case (30 s poll plus 10 s delivery poll plus setup).

All prior P1/P2 threads remain resolved and unchanged at this head: the serialized-record guard at crates/dim-app-server/src/plugin_files.rs:427-443, the Node-visible BindingError/bad-value assertion at crates/dim-app-server/tests/transport_flow/process_typescript.rs:280-293, and the protocol-5 texts at crates/dim-app-server/README.md:539, docs/typescript-plugin-authoring.md:331-335, docs/design/process-typescript.md:460-465 and docs/adr/025-rutis-0-23.md:44-47.

Optional and unchanged: text read remains unbounded at crates/dim-app-server/src/plugin_files.rs:413 while readBytes is limited at :417, and frame-based cap rationales remain at runtime/plugins/workflow/definition.ts:8-10, docs/design/plugins/Workflow.md:472 and :646, and docs/design/p6-p7-bindings.md:173. Neither item blocks.

Cross-PR checks: #1902 edits collaboration.rs at 542-636, and #1917 edits it at 1767-5670 and after 8643, away from this commit's 1320-1345 and 8298-8367. #1903, #1904 and #1905 edit process_typescript.rs in hunks between 1218 and 1809, away from this PR's 280-293. #1904 and #1909 edit the generated npm/branch-services.d.ts, so whichever lands second should rerun cargo run --locked -p xtask -- types. #1949, #1921 and #1950 edit ci.yml in other hunks; #1949 removes the step immediately before the Node bindings step, so a later rebase should keep both changes. No duplicate work with this PR.

Verified at 5dc83cf with isolated HOME/TMPDIR/XDG/CARGO_TARGET_DIR and LC_ALL=en_US.UTF-8: the targeted collaboration test passes (1 passed, 10.11 s); the negative control above fails at the 30 s poll; cargo test -p dim-app-server --test plugin_files_flow --locked passed 9/9; cargo fmt --all -- --check passed; cargo run --locked -p xtask -- check passed (743 modules, 4559 edges, 26 plugin documents, declarations, locks, links); node scripts/adr-check.mjs --base origin/main passed (62 changed files); git diff --check origin/main...HEAD is clean; git merge-tree --write-tree origin/main HEAD exits 0 at 82183f719844cea3be2f8141ca5e229f0107c3ef.

CI at 5dc83cf: changes, dependencies, web and windows-cli passed; verify is queued; acp-registry is skipped. GitHub reports MERGEABLE and UNSTABLE; the head is unchanged at 5dc83cf.

Verdict: APPROVE. The remaining items are optional P3s.

soulmachine pushed a commit to soulmachine/dim that referenced this pull request Nov 23, 2026
`session_typescript::node_session_typescript_tools_methods_and_generation_lifetimes` expected the two `progress(...)` calls of one TypeScript method to reach the host in call order. Since rutis 0.23 (arcships#1941) an imported callback invoked outside a synchronous call is dispatched asynchronously, and rutis-bridge runs each incoming call frame on its own task, so `settled` could be delivered before `started`, or `started` could be dropped when the reply closes the progress channel.

Await both calls in `runtime/fixtures/session-part.ts` so each send completes before the next one and before the handler returns. The assertion and the other fixtures are unchanged. `npm/plugin.d.ts` and the plugin guide still describe `progress(...)` as a synchronous call; arcships#2082 records those gaps for a separate change.

Fixes arcships#2082
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to rutis 0.23

4 participants