Skip to content

build(ci): replace DIM_RELEASE_BUILD recompile loop with release-safe runtime injection - #1949

Merged
eric8810 merged 6 commits into
mainfrom
eric/1932-release-build-runtime-injection
Nov 21, 2026
Merged

eric8810 merged 6 commits into
mainfrom
eric/1932-release-build-runtime-injection

Conversation

@eric8810

@eric8810 eric8810 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Implements ADR 026 D3 (release-safe runtime injection instead of recompiling). Fixes #1932. Refs #1919.

Problem

Every Rust PR spent 2.1–2.4 minutes recompiling 56 crates (~1.7 GiB of duplicate mbx cache objects) in Verify startup recovery and Update now in a release-stamped CLI just to execute 5 staged_update tests, because crates/dim-agent-capabilities/src/build.rs read option_env!("DIM_RELEASE_BUILD") in a foundational crate and ci.yml invoked a package-scoped DIM_RELEASE_BUILD=1 cargo test -p dimcode build with a mismatched feature set.

Changes

  • crates/dim-agent-capabilities/src/build.rs:
    • Remove pub const RELEASE: bool = stamped(option_env!("DIM_RELEASE_BUILD")) so nothing in dim-agent-capabilities reads build environment variables.
    • Extend build::install(commit, build_id, release) to install the release flag into a OnceLock<bool> read via build::release().
    • Add a #[cfg(debug_assertions)]-only runtime override DIM_TEST_RELEASE_BUILD (empty or "0" = source build, any other non-empty value = release build), mirroring DIM_TEST_BUILD_ID. In --release builds, the override branch is compiled out and unreachable (ADR 026 D3 production-safety bound).
  • crates/dimcode/build.rs & crates/dimcode/src/main.rs:
    • Forward DIM_RELEASE_BUILD through dimcode/build.rs into dimcode alone and pass RELEASE to dim_agent_capabilities::build::install(...). Toggling DIM_RELEASE_BUILD now recompiles only dimcode (~2s), zero upstream crates.
  • crates/dim-cli/src/{client,lib,update}.rs & crates/dim-app-server/tests/mcp_http_flow.rs:
    • Update all dim_agent_capabilities::build::RELEASE reads to dim_agent_capabilities::build::release().
  • crates/dimcode/tests/cli_flow/{staged_update,daemon_replace}.rs:
    • Run staged_update::recovery::* and staged_update::tui_update::* in debug builds via DIM_TEST_RELEASE_BUILD=1 against the already-compiled cli_flow + dimcode binaries.
    • Split the sequential multi-case loops (a_newer_store_recovers_only_with_a_compatible_staged_release, update_now_stops_an_idle_daemon_and_restarts_or_refuses_a_busy_or_old_one, update_now_survives_a_history_write_that_waits_for_its_lock) into 11 parallel tests (13 total across both modules).
    • Add daemon_replace::build_identity::release_override_controls_version_identity_in_debug_builds verifying DIM_TEST_RELEASE_BUILD on dimcode --version.
  • crates/dim-cli/README.md: document DIM_TEST_RELEASE_BUILD alongside DIM_TEST_BUILD_ID.
  • .github/workflows/ci.yml: remove the redundant Verify startup recovery and Update now in a release-stamped CLI step now that Run compiled workspace tests executes all 13 staged_update::{recovery,tui_update} tests directly without a second build pass. (Compile-time DIM_RELEASE_BUILD=1 continues to be exercised by release.yml and local packaging, and toggling it now recompiles dimcode alone.)

Design rule checklist

All plugin/runtime design rules are n/a: this change only moves build-identity flag installation to the final binary crate, adds a debug-only test override matching DIM_TEST_BUILD_ID, splits existing CLI flow tests, and removes the redundant CI recompile step.

  • Scope: n/a — build identity and CLI test harness only.
  • Commands and results: n/a — no Timeline or command changes.
  • Handover: n/a — no handover changes.
  • Timeline before callbacks: n/a — no Timeline callbacks touched.
  • Infrastructure: n/a — no runtime/Timeline/Dispatcher changes.
  • Core mechanisms and consumers: n/a — no plugin/core changes.
  • Batch: n/a — no event batches touched.
  • Context: n/a — no model context changes.
  • No reading another plugin's internal state: n/a.
  • Cross-language faces: n/a — build::release() is an internal Rust build-identity helper alongside build::current() / build::build_id().
  • Business configuration: n/a.
  • Missing mechanism capabilities: n/a.
  • Timeline holds only facts later decisions use: n/a.

Documentation

  • No accepted ADR is modified or deleted (ADR 008).
  • No other module's design is changed.
  • Delivery status is not added to an ADR, index or roadmap.

Verification

  • cargo fmt --all -- --check --config error_on_line_overflow=true — passed.
  • cargo clippy --locked -p dim-agent-capabilities -p dim-cli -p dimcode -p dim-app-server --all-targets -- -D warnings — passed.
  • cargo clippy --release --locked -p dim-agent-capabilities -p dim-cli -p dimcode --all-targets -- -D warnings — passed (verifying release builds compile out DIM_TEST_RELEASE_BUILD with zero warnings).
  • cargo test --locked -p dim-agent-capabilities --lib build:: — 2 passed.
  • cargo test --locked -p dimcode --test cli_flow daemon_replace::build_identity:: — 6 passed (including release_override_controls_version_identity_in_debug_builds).
  • cargo test --locked -p dimcode --test cli_flow staged_update::recovery:: — 7 passed (parallel, via DIM_TEST_RELEASE_BUILD=1).
  • cargo test --locked -p dimcode --test cli_flow staged_update::tui_update:: — 6 passed (parallel, via DIM_TEST_RELEASE_BUILD=1).
  • Toggling DIM_RELEASE_BUILD=1 cargo build --locked -p dimcode --bin dimcode vs unset recompiled only dimcode (1 crate in ~2.1s instead of 56 crates), printing dimcode 0.1.0-alpha.27 vs dimcode 0.1.0-alpha.27-source+<sha>.
  • node scripts/adr-check.mjs --base origin/main — passed.

@eric8810
eric8810 force-pushed the eric/1932-release-build-runtime-injection branch from 5787ce8 to 834959b Compare November 20, 2026 09:59
@eric8810
eric8810 marked this pull request as ready for review November 20, 2026 09:59

@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.

Review: runtime release injection (ADR 026 D3)

The PR moves the release mark out of dim-agent-capabilities into the final dimcode binary, installs it once at startup, adds the debug-only DIM_TEST_RELEASE_BUILD override, migrates the dim-cli callers and removes the package-scoped recompile step from CI. The code side matches ADR 026 D3: the shipped dimcode behavior is unchanged, the override is compiled out of release builds, and toggling DIM_RELEASE_BUILD recompiles dimcode alone.

P2, blocking: docs/architecture/tui-e2e.md still describes the removed release-stamped step and the old test names

Problem. The routing inventory still says the staged_update TUI cases run through a "release-stamped step" (docs/architecture/tui-e2e.md:316-318), that they "pass trivially in an unstamped build, so only that step exercises them" (docs/architecture/tui-e2e.md:428-431), and it lists the two combined test names this PR split. That step is gone from .github/workflows/ci.yml, where the ordinary workspace run is now the only selection (.github/workflows/ci.yml:195-201). The new tests are the six update_now_* cases at crates/dimcode/tests/cli_flow/staged_update.rs:1407-1425 and :1547-1555, in modules now selected by the ordinary debug workspace run (crates/dimcode/tests/cli_flow/staged_update.rs:857, :1221). The "2 cases" count in the staged_update section and the totals at docs/architecture/tui-e2e.md:369-381 are stale too: the split turns five test functions into thirteen, so the cli_flow default selection gains eight cases and the staged_update TUI section goes from two names to six.

Failure scenario. A maintainer or the #1810 follow-up reads this inventory to see what CI covers, or tries to run the listed names: the step no longer exists, the names do not resolve, and the document understates the tests that now run in every workspace run. The document's own rule requires the commit that changes a case's routing to update the inventory (docs/architecture/tui-e2e.md:458-460).

Evidence. .github/workflows/ci.yml:195-201; crates/dimcode/tests/cli_flow/staged_update.rs:857, :1221, :1407-1425, :1547-1555; docs/architecture/tui-e2e.md:316-318, :369-381, :428-431, :458-460.

Fix. Update the staged_update section with the six new names and the ordinary selection, replace the release-stamped bullet in the CI list, and recompute the module and case totals.

P3, optional: release()'s doc does not mention the debug override

crates/dim-agent-capabilities/src/build.rs:66 says "Whether the release flow produced this build", but in a debug build the value comes from DIM_TEST_RELEASE_BUILD (crates/dim-agent-capabilities/src/build.rs:52-64), so it can be true when the release flow did not produce the build and false when it did. Callers gate auto-update and Update now on it (crates/dim-cli/src/update.rs:307, crates/dim-cli/src/update.rs:378, crates/dim-cli/src/lib.rs:865). Failure scenario: a reader auditing release-gated behavior trusts the doc and misses the override. Fix: say it reports whether the process behaves as a released build and name the debug-only override. This is also the inline comment.

P3, optional: the standalone dim-app-server binary no longer reports a release identity

crates/dimcode/src/main.rs:77 is the only build::install call. crates/dim-app-server/src/main.rs:1-15 serves the same App Server from a standalone binary but never installs, and it is a supported --server target (docs/design/cli-commands.md:1895-1898). A local build with DIM_RELEASE_BUILD=1 cargo build -p dim-app-server used to report the bare version through build::current() (the removed const in crates/dim-agent-capabilities/src/build.rs); it now reports <version>-source in its MCP clientInfo (crates/dim-app-server/src/mcp/server.rs:231) and in reports. The shipped dimcode is unaffected. Failure scenario: a maintainer using a release-stamped standalone App Server sees a source label where the previous behavior reported the release version, which makes the MCP identity and report labels disagree with the build. Fix if that binary is meant to carry the release identity: install the same value there, or state that only dimcode carries it.

Verification

macOS ARM64, isolated HOME, TMPDIR, XDG_* and CARGO_TARGET_DIR.

  • git diff --check clean; git merge-tree --write-tree origin/main HEAD against current main b15bc92a is clean (2a064431); GitHub reports the PR MERGEABLE at head 834959b3.
  • cargo fmt --all -- --check --config error_on_line_overflow=true and node scripts/adr-check.mjs --base origin/main pass.
  • cargo build --locked -p dim-agent-capabilities -p dimcode passes. DIM_RELEASE_BUILD=1 cargo build -p dimcode recompiled only dimcode (2.2s), and --version changed from ...-source+834959b3 to the bare version; rebuilding without the flag took 3.5s.
  • cargo build --release -p dim-agent-capabilities: the release rlib has zero occurrences of DIM_TEST_RELEASE_BUILD (the debug rlib has one), so the override is compiled out of release builds.
  • cargo test -p dim-agent-capabilities --lib build::: 2 passed.
  • cargo test -p dimcode --test cli_flow daemon_replace::build_identity:: -- --test-threads=3: 6 passed, and the new override test also passes when the test binary and child are compiled with DIM_RELEASE_BUILD=1.
  • staged_update::recovery:: 7 passed and staged_update::tui_update:: 6 passed with --test-threads=3; their assertions are the same as before, only split out of the loops.
  • CI at review time: changes, dependencies, web and windows-cli passed; verify was queued; acp-registry skipped.

Verdict

REQUEST_CHANGES for the P2 routing inventory only. Once docs/architecture/tui-e2e.md matches the new routing and names, I would approve.

release
}

/// Whether the release flow produced this build.

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 doc says the value can only come from the release flow, but release_flag above (crates/dim-agent-capabilities/src/build.rs:52-64) lets a debug build override it with DIM_TEST_RELEASE_BUILD, including 0 to turn a stamped build back into a source build. Callers gate auto-update and Update now on this value (crates/dim-cli/src/update.rs:307, crates/dim-cli/src/update.rs:378), so the caller-visible contract should say "whether this process behaves as a released build" and name the debug-only override. Reword the doc; behavior is fine.

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 in dfe07ad.

eric8810 added a commit that referenced this pull request Nov 20, 2026
- Update `docs/architecture/tui-e2e.md` with the six split
  `staged_update::tui_update::update_now_*` names, updated case counts
  (305 TUI / 287 `cli_flow` + 4 `ui_leaf` = 291; 417 non-TUI / 405
  default), and removal of the obsolete release-stamped CI step bullet.
- Clarify `dim_agent_capabilities::build::release()` doc comment to
  mention the debug-only `DIM_TEST_RELEASE_BUILD` override.
- Install `RELEASE` in standalone `crates/dim-app-server/src/main.rs` so
  release-stamped standalone `dim-app-server` builds retain their release
  identity without recompiling `dim-app-server`'s library or upstream crates.

Refs #1932
@eric8810

Copy link
Copy Markdown
Collaborator Author

Thanks @yyhhyyyyyy for the thorough review and verification — addressed the P2 and both optional P3 items in the new commit:

  1. docs/architecture/tui-e2e.md inventory & routing (P2):
    • Replaced the two old combined staged_update::tui_update names with all six split update_now_* names under the ordinary CI selection.
    • Removed the obsolete release-stamped CI step bullet and updated the staged_update (2 → 6), TUI total (301 → 305; CI selected 283/287 → 287/291), and non-TUI cli_flow (412/400 → 417/405) counts to match.
  2. build::release() doc comment (P3):
    • Clarified in crates/dim-agent-capabilities/src/build.rs that release() reports whether the process behaves as a released build and names the debug-only DIM_TEST_RELEASE_BUILD override (ignored in release builds).
  3. Standalone dim-app-server binary identity (P3):
    • Installed RELEASE in crates/dim-app-server/src/main.rs so standalone DIM_RELEASE_BUILD=1 cargo build -p dim-app-server preserves its release label without causing dim-app-server lib or upstream crates to recompile when toggling DIM_RELEASE_BUILD.

Ready for re-review!

@eric8810
eric8810 requested a review from yyhhyyyyyy November 20, 2026 10:34

@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.

Re-review: runtime release injection (ADR 026 D3)

The PR moves the release mark out of dim-agent-capabilities into the final binaries, installs it once at startup, adds the debug-only DIM_TEST_RELEASE_BUILD override, splits the staged_update tests, and removes the release-stamped CI step. Head dfe07ade adds the inventory update, the release() doc rewording, and a release install in the standalone dim-app-server.

Prior findings resolved

P2, tui-e2e inventory: Fixed in dfe07ad. The staged_update section names the six update_now_* tests (docs/architecture/tui-e2e.md:316-318); the CI list puts staged_update::recovery:: in the ordinary workspace selection and explains that the six TUI cases use the override (:420-427); the release-stamped bullet is gone (:428-431); and the recomputed counts match the tests. The module headers sum to 305 (staged_update alone moves from 2 to 6), the summary says 305 with 287 selected in cli_flow plus the 4 ui_leaf cases (291), and the non-TUI block moves from 412 to 417 with 405 default. The +9 test delta is exactly the split (recovery 3 to 7, tui_update 2 to 6) plus the new daemon_replace::build_identity case.

P3, release() doc: Fixed in dfe07ad. crates/dim-agent-capabilities/src/build.rs:66-69 now says the value reports whether this process behaves as a released build and names the debug-only DIM_TEST_RELEASE_BUILD override read during install. The inline thread can be resolved.

P3, standalone dim-app-server: Fixed in dfe07ad. crates/dim-app-server/src/main.rs:1-4 installs RELEASE before process_entry, so a build with DIM_RELEASE_BUILD=1 reports the bare version again. Toggling the variable recompiles only dim-app-server (cargo tracks option_env! through dep-info), so the fix keeps the no-upstream-recompile property.

P3, optional: the inventory's opening count still says 299 TUI cases

Problem. docs/architecture/tui-e2e.md:225-232 still says the cli_flow*.rs targets hold 299 TUI cases and that 281 stay selected by CI. The section's own module headers sum to 305, and the summary at :369-375 now says 305 cases with 287 selected in cli_flow.

Failure scenario. A maintainer adding the per-module counts, or checking why CI selects 287, gets 299 and 281 from the same page and cannot tell which is authoritative. The six staged_update::tui_update:: cases are listed in the inventory but missing from the opening count.

Evidence. docs/architecture/tui-e2e.md:225-232, :316 (6 cases), :369-375; the 22 plural module headers sum to 301 and the 4 singular ones add 4, for 305.

Fix. Change 299 to 305 and 281 to 287 (305 - 10 - 8 = 287), matching the summary. The 299 already lagged the headline by 2 before this PR, but this PR rewrites these counts, so the two totals should agree.

P3, optional: an orphaned parenthetical in the CI list

Problem. docs/architecture/tui-e2e.md:426-427 ends the TUI sentence with "staged_update::recovery:: and local_execution do not drive the UI", a fragment kept from the removed release-stamped bullet. staged_update::recovery:: is already listed as a non-TUI case one line above (:422), and local_execution is a separate integration target (tests/integration/tests/local_execution.rs:2292) run by its own CI step (.github/workflows/ci.yml:202-204), not a cli_flow case.

Failure scenario. A maintainer tracing local_execution from this sentence looks for it in cli_flow and the TUI inventory and does not find it, because the reference belonged to the step this PR removed.

Evidence. docs/architecture/tui-e2e.md:420-427; .github/workflows/ci.yml:202-204; tests/integration/tests/local_execution.rs:2292.

Fix. Delete the clause "; staged_update::recovery:: and local_execution do not drive the UI".

Verification

macOS ARM64, isolated HOME, TMPDIR, XDG_* and CARGO_TARGET_DIR.

  • Head dfe07ade; git merge-tree --write-tree origin/main HEAD against b15bc92a is clean; GitHub reports the PR MERGEABLE.
  • cargo fmt --all -- --check --config error_on_line_overflow=true and git diff --check pass.
  • cargo check --locked -p dim-app-server --bin dim-app-server passes at head, and re-running it with DIM_RELEASE_BUILD=1 re-checks only that package (0.24 s), not upstream crates.
  • A probe with the same shape as crates/dim-app-server/build.rs (a build script that never names the variable) showed cargo recompiles and the option_env! value changes when the variable changes, so the standalone app-server install is not stale.
  • Code inspection: release_flag keeps the #[cfg(debug_assertions)] guard, so the override branch and its environment read are compiled out of release builds; the six update_now_* and recovery tests set DIM_TEST_RELEASE_BUILD=1 on the copied debug dimcode child, and their module gates keep them out of release test builds.
  • Not rerun here: the cli_flow test target. The new commit does not change test code, and the prior pass at 834959b3 ran the 7 recovery, 6 tui_update and 6 build_identity cases.
  • CI at review time: changes, dependencies and windows-cli passed; verify queued; web failed (the job touches no file this PR changes, and its log was not available while the run was in progress); acp-registry skipped.

Verdict

APPROVE. The P2 inventory finding and both P3 findings are fixed. The two remaining items are optional count and wording cleanups in the same document.

Comment thread docs/architecture/tui-e2e.md Outdated
and the scripted daemon flows), and the 291 TUI cases #1810 still tracks
(including the 6 `staged_update::tui_update::` cases, which use the debug-only
`DIM_TEST_RELEASE_BUILD=1` override instead of a separate release-stamped
build step; `staged_update::recovery::` and `local_execution` do not drive the

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.

Problem. This clause is a fragment of the removed release-stamped bullet. staged_update::recovery:: is already listed as a non-TUI case on line 422, and local_execution is not a cli_flow case at all: it is the separate integration target at tests/integration/tests/local_execution.rs:2292, run by its own step (.github/workflows/ci.yml:202-204).

Failure scenario. A maintainer tracing local_execution from this sentence looks for it in cli_flow and the TUI inventory and does not find it, because the reference belonged to the step this PR removed.

Evidence. docs/architecture/tui-e2e.md:422, :426-427; .github/workflows/ci.yml:202-204; tests/integration/tests/local_execution.rs:2292.

Fix. Delete "; staged_update::recovery:: and local_execution do not drive the UI".

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 in 6b0c4d4.

… runtime injection

Stop reading `option_env!("DIM_RELEASE_BUILD")` in the foundational
`dim-agent-capabilities` crate and move release-flag wiring to the final
`dimcode` binary crate, matching `GIT_COMMIT` and `BUILD_ID` (ADR 026 D3):

- `crates/dim-agent-capabilities/src/build.rs`: replace `pub const RELEASE`
  with a `OnceLock<bool>` installed via `build::install(commit, build_id, release)`
  and read through `build::release()`. Support a `#[cfg(debug_assertions)]`-only
  `DIM_TEST_RELEASE_BUILD` runtime override (unreachable in release builds).
- `crates/dimcode/build.rs` & `crates/dimcode/src/main.rs`: forward
  `DIM_RELEASE_BUILD` into `dimcode` alone and install it at startup, so
  toggling `DIM_RELEASE_BUILD` recompiles only `dimcode` (~2s) instead of
  56 upstream crates.
- `crates/dim-cli` & `crates/dim-app-server`: switch `build::RELEASE` reads
  to `build::release()` and document `DIM_TEST_RELEASE_BUILD` in
  `crates/dim-cli/README.md`.
- `crates/dimcode/tests/cli_flow/{staged_update,daemon_replace}.rs`: drive
  `staged_update::recovery::*` and `staged_update::tui_update::*` via
  `DIM_TEST_RELEASE_BUILD=1` in debug builds, split the sequential multi-case
  loops into parallel tests, and verify `--version` override behavior.
- `.github/workflows/ci.yml`: drop the redundant `DIM_RELEASE_BUILD=1`
  `cargo test -p dimcode` step that recompiled 56 crates (~2.1-2.4 min and
  ~1.7 GiB of `mbx` cache writes) on every Rust PR, since those tests now
  run directly inside `Run compiled workspace tests`.

Fixes #1932
Refs #1919
- Update `docs/architecture/tui-e2e.md` with the six split
  `staged_update::tui_update::update_now_*` names, updated case counts
  (305 TUI / 287 `cli_flow` + 4 `ui_leaf` = 291; 417 non-TUI / 405
  default), and removal of the obsolete release-stamped CI step bullet.
- Clarify `dim_agent_capabilities::build::release()` doc comment to
  mention the debug-only `DIM_TEST_RELEASE_BUILD` override.
- Install `RELEASE` in standalone `crates/dim-app-server/src/main.rs` so
  release-stamped standalone `dim-app-server` builds retain their release
  identity without recompiling `dim-app-server`'s library or upstream crates.

Refs #1932

@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.

Re-review: runtime release injection (ADR 026 D3)

The PR moves the release mark out of dim-agent-capabilities into the final binaries, installs it once at startup, adds the debug-only DIM_TEST_RELEASE_BUILD override, splits the staged_update tests, and removes the release-stamped CI step. Head 6b0c4d42 is the approved content rebased onto ffd3e116, with the two round-2 P3 fixes.

Prior findings resolved

P2, inventory routing: fixed in dfe07ad and unchanged here. The six split update_now_* names, the ordinary CI selection and the removal of the release-stamped bullet are unchanged at this head.

P3, opening count: Fixed in 6b0c4d4. docs/architecture/tui-e2e.md:226-232 now reads 305 cases with 287 selected. The 26 module headers sum to 305, 305 - 10 tmux-ignored - 8 production-ignored = 287, and 287 + 4 ui_leaf cases = 291. The 305 inventory names resolve to test functions in the built cli_flow target, and the six names at :319 are the six tui_update tests.

P3, orphaned parenthetical: Fixed in 6b0c4d4. The clause at the old :426-427 is gone; the inline thread can be resolved.

P3, release() doc and standalone dim-app-server: fixed in dfe07ad, unchanged here. crates/dim-agent-capabilities/src/build.rs:66-70 names the debug-only override, and crates/dim-app-server/src/main.rs:1-4 installs RELEASE.

Verification

  • Head 6b0c4d42, base ffd3e116. git merge-tree --write-tree origin/main HEAD is clean (tree c4a52c80); GitHub reports the PR MERGEABLE.
  • Rebase: the approved content is preserved. Nine files are identical to dfe07ade; ci.yml, crates/dim-cli/README.md and staged_update.rs differ only by the main commits merged in between, and tui-e2e.md differs by the two fixes above plus the main composer_borders_match_in_scrollback_and_fullscreen scenario row. The diff against ffd3e116 still removes only the release-stamped CI step from ci.yml.
  • cargo fmt --all -- --check --config error_on_line_overflow=true, git diff --check, node scripts/adr-check.mjs --base origin/main (13 changed files) and cargo run --locked -p xtask -- check pass.
  • node --test scripts/release.test.mjs passes 42 tests; node --test scripts/tui-tmux.test.mjs passes 6, including the inventory and ignored-selection guards.
  • Release injection: toggling DIM_RELEASE_BUILD=1 on cargo build --locked -p dimcode --bin dimcode recompiled only dimcode (1.82 s) and changed --version from 0.1.0-alpha.27-source+6b0c4d42 to 0.1.0-alpha.27; rebuilding without it recompiled only dimcode (1.80 s) and restored the source label. The standalone dim-app-server recompiled only itself on the same toggle (2.32 s and 1.56 s).
  • Test rewrite: all 166 assert strings in staged_update.rs are identical to origin/main. The five old test functions become thirteen: the five store-recovery cases, four Update now cases and two history-lock cases each become a named test. CI at this head ran all 13 plus daemon_replace::build_identity::release_override_controls_version_identity_in_debug_builds in the ordinary workspace selection, and all passed.
  • Local macOS: 23 of the 25 staged_update tests passed and the override test passed in 0.06 s. The two Update now cases that wait for the panel did not finish under an env -i harness without TERM and were stopped, so those two rely on the CI run and the earlier macOS pass.
  • CI at this head: verify (linux) failed in Run compiled workspace tests on goal::tui_goal_shows_the_state_and_marks_the_status_area and tui_models_picker_edits_only_the_subagent_model_policy (707 passed, 30 ignored). Both are untouched tests, and #1958 reworks exactly those waits. macos-native, web, dependencies, windows-cli and changes passed; acp-registry skipped; ci-ok failed because verify did.

Conflicts

  • #1951 conflicts with this head in docs/architecture/tui-e2e.md in three hunks: the selected counts at :376 (287/291 against 283/287), the non-TUI block at :378-380 (417/405 against 412/400, and the cli_flow* target names) and the CI bullet at :421-427 (405/291 against 400/287). The other files auto-merge, and #1951 keeps mod staged_update in cli_flow, so these tests keep running after the split. Whoever merges second must reconcile the counts and the target names.
  • #1952, #1950, #1881 and #1958 merge cleanly with this head.

Verdict

APPROVE. The round-2 P3s are fixed, the rebase kept the approved content, and release behavior is unchanged: only the final binary recompiles on a flag change, and a release build still reports the bare version.

@eric8810

Copy link
Copy Markdown
Collaborator Author

Merged main to pick up #1958, which fixes the three scrollback TUI tests that failed verify (linux). No other changes; CI rerun is queued.

@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.

Re-review: runtime release injection (ADR 026 D3)

The PR moves the release mark out of dim-agent-capabilities into the final binaries, installs it once at startup, adds the debug-only DIM_TEST_RELEASE_BUILD override, splits the staged_update tests, and removes the release-stamped CI step. Head 948591a3 merges origin/main dbbd7079 into the approved 6b0c4d42; all 13 PR files are byte-identical to the approved head, and the merge only adds main's scheduler, docs and #1958 test-wait changes. The two earlier threads stay resolved.

Findings

P2, the promoted tui_update tests are flaky in the active gate. The head CI run failed verify (linux) in Run compiled workspace tests on staged_update::tui_update::update_now_cancels_cleanly_on_sigint_while_stopping_daemon, with 708 passed, 1 failed and 30 ignored (run 44845424404, job 136669193122). The panic is Terminal did not show "Update now" at crates/dimcode/tests/cli_flow.rs:3942 after the 300 s HANG_GUARD; the transcript shows the welcome screen and the resumed session with no update dialog. The other five tui_update cases passed in the same run.

The offer is a one-shot automatic check at startup (crates/dim-cli/src/session_host.rs:440-449) with a 4 s registry timeout (crates/dim-cli/src/update.rs:22). available() returns None on any error (crates/dim-cli/src/update.rs:306-315), so one slow or failed request leaves no offer, no notice and no retry, and the wait at crates/dimcode/tests/cli_flow/staged_update.rs:1375 spends its full bound. The same test content passed the round 3 run at 6b0c4d42, failed once in a local harness, and passed locally on rerun, so the failure is intermittent rather than deterministic. This PR is what promotes the six tests from the dedicated release-stamped step into the parallel workspace selection, so the flake now blocks every PR.

Fix: make the wait deterministic. Send /update and wait for the dialog (the command at crates/dim-cli/src/session_host.rs:1653 starts a fresh check), retrying once when the automatic offer is absent; or have the test wait for the registry fixture to accept before launching the child; or keep the six in a dedicated serial step, which no longer needs a release-stamp recompile.

P2, the non-TUI cli_flow counts do not match the target and contradict the same section. At this head the cli_flow target has 737 tests on macOS (30 ignored, 707 default) and 739 on Linux (30 ignored, 709 default; the head CI log shows 708 passed, 1 failed, 30 ignored). The 305 inventory cases leave 432 non-TUI cases on macOS (420 default, 12 ignored) and 434 on Linux (422 default, 12 ignored). docs/architecture/tui-e2e.md:379 says 417 cases, 405 default, 12 ignored, and docs/architecture/tui-e2e.md:422 calls 405 the non-TUI count and adds the 291 TUI cases beside it, so the same section says the target's default is 405 and counts 405 plus 291.

The four new staged_update::tui_update cases are counted twice: once in the 305 inventory at docs/architecture/tui-e2e.md:370-376 and once in the 412 to 417 bump, although the only new non-TUI case is daemon_replace::build_identity::release_override_controls_version_identity_in_debug_builds (crates/dimcode/tests/cli_flow/daemon_replace.rs:649). The aggregate was already stale at main, where it said 412 against 433, and incrementing it by this PR's additions keeps the drift.

Fix: recompute from the built target (Linux 434 total, 422 default, 12 ignored) or drop the numeric aggregate and name the built target. If the CI bullet keeps numbers, say the 291 TUI cases are a subset of the default selection.

Verification

  • Rebase: git diff 6b0c4d42 HEAD contains only main's 13 files; every PR file has the same blob as the approved head. No conflict resolution touched the PR content.
  • Target at head: 737 macOS tests, 30 ignored, 707 default; all 305 inventory names resolve; 18 inventory cases are ignored (10 tmux, 8 production), 287 default, plus the 4 ui_leaf cases. The 13 staged_update::recovery:: and staged_update::tui_update:: tests and the release override test are non-ignored and selected by the ordinary workspace run.
  • Rust: the release override test passes; staged_update::recovery:: 7 of 7 and staged_update::tui_update:: 6 of 6 pass locally (the first local run failed the idle case on the same missing offer and passed on rerun).
  • Node: node --test scripts/release.test.mjs 42 of 42; node --test scripts/tui-tmux.test.mjs 6 of 6.
  • Release injection: toggling DIM_RELEASE_BUILD=1 recompiles only dimcode (1.82 s) and changes --version from 0.1.0-alpha.27-source+948591a3 to 0.1.0-alpha.27; rebuilding without it recompiles only dimcode (1.77 s) and restores the source label. dim-app-server recompiles only itself on the same toggle (2.17 s and 1.29 s).
  • cargo fmt --all -- --check --config error_on_line_overflow=true, git diff --check, node scripts/adr-check.mjs --base origin/main (13 files) and cargo run --locked -p xtask -- check pass.
  • CI at 948591a3: verify (linux) failed on the test above; changes, dependencies, macos-native, web and windows-cli passed; acp-registry skipped; ci-ok failed with verify.

Cross-PR

  • git merge-tree HEAD origin/main is clean; GitHub reports the PR MERGEABLE.
  • #1950 and #1952 merge cleanly.
  • #1951 conflicts in docs/architecture/tui-e2e.md in four hunks: the selected counts, the target paragraph, the other-TUI-cases paragraph, and the CI bullet. #1951 keeps mod staged_update in cli_flow and moves daemon_replace to cli_daemon_flow, so the 13 tests keep running. That branch still has the 2-case staged_update inventory and the release-stamped bullet, so whoever merges second must apply the 305/287/291 counts, the cli_flow* names and this PR's removal.
  • #1953 conflicts in .github/workflows/ci.yml: its --test-threads="$cli_threads" change sits next to the removed release-stamped step. Resolve by keeping the threads change and deleting the step. #1953 also raises workspace parallelism, so the offer test will run under more load.
  • #1958 is merged in main: it only reorders two TUI waits and does not change the counts.

Verdict

REQUEST_CHANGES. The rebase preserved the approved implementation and the release behavior, but the head CI is red on a test this PR promotes into the active gate, and the non-TUI counts in the changed section are wrong and self-contradictory.

assert!(!installed.home.0.join("install-args").exists());
return;
}
terminal.until_plain("Update now");

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.

Problem. This wait reads a single automatic update check at startup (crates/dim-cli/src/session_host.rs:440-449) with a 4 s registry timeout (crates/dim-cli/src/update.rs:22). available() returns None on any error (crates/dim-cli/src/update.rs:306-315), and the check does not retry, so one slow request leaves no offer and this wait spends its 300 s HANG_GUARD (crates/dimcode/tests/cli_flow.rs:198).

Failure scenario. The head 948591a3 run failed here: staged_update::tui_update::update_now_cancels_cleanly_on_sigint_while_stopping_daemon panicked at cli_flow.rs:3942 with Terminal did not show "Update now" after 300 s (verify (linux) job 136669193122; 708 passed, 1 failed, 30 ignored). The other five tui_update cases passed in the same run, and the same content passed at 6b0c4d42 and on a local rerun, so this is intermittent. Once merged, the test runs in the ordinary workspace selection and can block any PR.

Fix. Send /update and wait for the dialog (the command at crates/dim-cli/src/session_host.rs:1653 starts a fresh check), retrying once if the automatic offer is absent; or wait for the fake registry to accept before launching the child; or keep the six cases in a dedicated serial step, which needs no release-stamp recompile.

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.

Not fixed in be92c36d. The retry adds a second channel_version call (crates/dim-cli/src/update.rs:309-312), but both attempts keep the same 4 s total timeout (crates/dim-cli/src/update.rs:22), so both can miss under load. The head CI run 44850114947 (job 136679317256) still failed this wait: update_now_falls_back_to_manual_command_for_an_old_daemon and update_now_stops_an_idle_daemon_and_restarts_on_the_same_session panicked at crates/dimcode/tests/cli_flow.rs:3942 after 300 s, with 707 passed, 2 failed and 30 ignored. The 300 s guard tolerates two attempts and the spawned check is abandoned with the runtime, so the guard and cancellation are not the blocker. There is also no test for the retry, including a failure-then-success fixture.

What is still missing: a deterministic wait. The six tests need a debug-only update-timeout override (like DIM_TEST_DAEMON_START_TIMEOUT_MS), or a test-driven /update after the interface is idle that retries on the visible failure status. A second attempt inside the same 4 s deadline does not cover both attempts missing. If the retry stays, limit it to transient transport errors (is_timeout, is_connect) and test it.

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 c1bb5258. The retry is gone; the startup check makes one channel_version call (crates/dim-cli/src/update.rs:321) and its deadline comes from a debug-only DIM_TEST_UPDATE_TIMEOUT_MS override (crates/dim-cli/src/update.rs:24-34, used at :362). The TUI update helper sets 60 s on the child (crates/dimcode/tests/cli_flow/staged_update.rs:1347-1348) and the history-lock helper does too (:1500-1501). staged_update::tui_update:: passed 6 of 6 serially and 6 of 6 at --test-threads=6, including both head failures from be92c36d.

Comment thread docs/architecture/tui-e2e.md Outdated

The `cli_flow` target also holds the line-mode, ACP, daemon and production flows
that CI keeps: 412 cases, of which 400 run by default and 12 are `--ignored`
that CI keeps: 417 cases, of which 405 run by default and 12 are `--ignored`

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.

Problem. These counts do not match the built target. At 948591a3 the cli_flow target has 737 tests on macOS (30 ignored, 707 default) and 739 on Linux (30 ignored, 709 default). The 305 inventory cases leave 432 non-TUI cases on macOS (420 default, 12 ignored) and 434 on Linux (422 default, 12 ignored), not 417 and 405. Line 422 then calls 405 the non-TUI count and adds the 291 TUI cases beside it, so the section both says the target's default is 405 and counts 405 plus 291.

Failure scenario. The four new staged_update::tui_update cases are counted twice: in the 305 inventory at lines 370-376 and in the 412 to 417 bump, while the only new non-TUI case is daemon_replace::build_identity::release_override_controls_version_identity_in_debug_builds at crates/dimcode/tests/cli_flow/daemon_replace.rs:649. The aggregate was already stale at main (412 against 433), so the increment keeps the drift and the doc cannot be used to check what CI runs.

Fix. Recompute from the built target (Linux 434 total, 422 default, 12 ignored) or drop the aggregate and name the built target. If the CI bullet keeps numbers, say the 291 TUI cases are a subset of the default selection.

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.

Not fixed in be92c36d; the docs are unchanged from the round 4 head. The built cli_flow target has 737 tests on macOS (30 ignored, 707 default) and 739 on Linux (30 ignored, 709 default). The 305 inventory cases leave 432 non-TUI cases on macOS (420 default, 12 ignored) and 434 on Linux (422 default, 12 ignored), not 417 and 405. Line 379 still says 417/405, and line 422 still calls 405 the non-TUI count, so the default selection is 15 short on macOS and 17 short on Linux, and line 422 adds the 4 ui_leaf cases from a separate target into the cli_flow count.

One correction to my round 4 detail: the +5 bump is the five new non-TUI test functions (four staged_update::recovery:: splits and crates/dimcode/tests/cli_flow/daemon_replace.rs:649), not the TUI split, so the specific double counting claim was wrong. The stale aggregate is the open problem: it was already 15 low on macOS and 17 low on Linux at main, and the +5 bump keeps that drift.

Fix: recompute from the built target and state it once (Linux 434 total, 422 default, 12 ignored), keep the cli_flow TUI subset as 287 selected, and keep the 4 ui_leaf cases out of that total.

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 c1bb5258. The four targets hold 737 tests on macOS (cli_flow 242, cli_tui_flow 212, cli_session_flow 119, cli_daemon_flow 164), 30 ignored and 707 default; the 305 inventory cases leave 432 total, 420 default and 12 ignored. Linux adds three platform-specific cases and drops one macOS-only case, giving 739 total and 709 default with the same 434 non-TUI total, 422 non-TUI default and 12 ignored. docs/architecture/tui-e2e.md:376 keeps the 4 ui_leaf cases in their own target and :425 states the 422 non-TUI plus 287 TUI partition. One non-blocking leftover: :226 still names cli_flow*.rs, which now holds 70 of the 305 TUI cases.

A loaded runner can miss the four-second registry deadline, which used to
hide the update dialog for the whole session; retry once on the background
startup path so a transient miss still offers the update.
@eric8810

Copy link
Copy Markdown
Collaborator Author

Merged main (includes #1958) and added one fix for the remaining red: the four-second startup registry deadline can be missed on a loaded runner, which used to hide the update dialog for the whole session and made the release-stamped Update now tests wait for 300 seconds. update::available now retries the lookup once on the background startup path; /update keeps its single attempt so a user-initiated check still fails fast. cargo check -p dim-cli passes. Re-review requested.

@eric8810
eric8810 requested a review from yyhhyyyyyy November 21, 2026 01:26

@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.

Re-review: runtime release injection (ADR 026 D3)

The PR moves the release mark out of dim-agent-capabilities into the final binaries, installs it once at startup, adds the debug-only DIM_TEST_RELEASE_BUILD override, splits the staged_update tests, and removes the release-stamped CI step. Head be92c36d adds one commit over the round 4 head 948591a34: available() now retries channel_version once. The other 12 PR files are unchanged, so the approved implementation and the test split still hold.

Findings

P2, the promoted tui_update tests still fail in the active gate, and one retry does not make the wait deterministic. The head CI run 44850114947 failed verify (linux) (job 136679317256) in the ordinary workspace selection with 707 passed, 2 failed and 30 ignored. Both failures panicked at crates/dimcode/tests/cli_flow.rs:3942 after the 300 s HANG_GUARD (crates/dimcode/tests/cli_flow.rs:198): update_now_falls_back_to_manual_command_for_an_old_daemon waited for the manual command, update_now_stops_an_idle_daemon_and_restarts_on_the_same_session waited for Update now, and neither offer arrived. The retry at crates/dim-cli/src/update.rs:309-312 calls the same channel_version, which builds a client with the same 4 s total timeout (crates/dim-cli/src/update.rs:22), so both attempts can miss under the same load. The 300 s guard tolerates two attempts (8 s at most) and the spawned check is abandoned with the runtime, so neither the guard nor cancellation is the blocker; the offer never arrived at all. The retry also runs for permanent errors (404, invalid tag, malformed JSON) and doubles the wait to about 8 s for an unreachable registry, and no test covers it, including the failure-then-success case it is meant to fix.

Fix: make the wait deterministic instead of retrying a wall-clock deadline. A debug-only update-timeout override, alongside DIM_TEST_DAEMON_START_TIMEOUT_MS in crates/dim-cli/README.md, removes the 4 s bound from the test; alternatively, have the test drive /update after the interface is idle and retry on the visible failure status. If the retry stays, limit it to transient transport errors (is_timeout, is_connect) and add a failure-then-success test.

P2, the non-TUI cli_flow counts still do not match the built target and still contradict the same section. At this head the cli_flow target has 737 tests on macOS (30 ignored, 707 default) and 739 on Linux (30 ignored, 709 default). The 305 inventory cases leave 432 non-TUI cases on macOS (420 default, 12 ignored) and 434 on Linux (422 default, 12 ignored). docs/architecture/tui-e2e.md:379 says 417 cases, 405 default and 12 ignored. docs/architecture/tui-e2e.md:422 then calls 405 the non-TUI count and adds the 291 TUI cases beside it, so the default selection is 15 short on macOS and 17 short on Linux, and the 291 mixes the 4 ui_leaf cases from a separate target into the cli_flow count.

The round 4 detail that the TUI split was counted twice in the non-TUI bump was wrong: the +5 bump is the five new non-TUI test functions, four staged_update::recovery:: splits and daemon_replace::build_identity::release_override_controls_version_identity_in_debug_builds at crates/dimcode/tests/cli_flow/daemon_replace.rs:649. The aggregate was already 15 low on macOS and 17 low on Linux at main, and the +5 bump keeps that drift.

Fix: recompute from the built target (Linux 434 total, 422 default, 12 ignored) or drop the aggregate and name the built target. State the cli_flow TUI subset as 287 selected, and keep the 4 ui_leaf cases out of the same total.

Verification

  • Delta: git diff 948591a34 HEAD touches only crates/dim-cli/src/update.rs (5 insertions, 2 deletions); the rest of the PR and the staged_update split are unchanged from the round 4 head.
  • Target at head: 737 cli_flow tests on macOS, 30 ignored, 707 default. staged_update::tui_update:: passed 6 of 6 serially and 6 of 6 in two --test-threads=3 runs, so the two CI failures do not reproduce locally, which matches the round 4 finding that the failure depends on the runner.
  • CI at be92c36d: verify (linux) failed on the two tests above; changes, dependencies, macos-native, web and windows-cli passed; acp-registry skipped; ci-ok failed with verify. The seven staged_update::recovery:: tests all passed in the same run, and the job reached the test step, so fmt and clippy passed.
  • Release injection at head: toggling DIM_RELEASE_BUILD=1 recompiles only dimcode (1.87 s) and changes --version from 0.1.0-alpha.27-source+be92c36d to 0.1.0-alpha.27; rebuilding without it recompiles only dimcode (1.76 s) and restores the source label. dim-app-server recompiles only itself on the same toggle (2.11 s and 1.28 s).
  • cargo fmt --all -- --check --config error_on_line_overflow=true and git diff --check pass.
  • node scripts/adr-check.mjs --base origin/main (13 files), node --test scripts/release.test.mjs scripts/tui-tmux.test.mjs (48 pass) and cargo run --locked -p xtask -- check pass. The head does not touch the scripts, ADRs or assembly.

Cross-PR

  • git merge-tree HEAD origin/main is clean; GitHub reports the PR MERGEABLE.
  • #1950 and #1952 merge cleanly.
  • #1951 conflicts in docs/architecture/tui-e2e.md in three hunks: the selected counts, the other-TUI-cases paragraph and the CI bullet. Its branch keeps mod staged_update in cli_flow and moves daemon_replace to cli_daemon_flow, so the 13 tests keep running, but its counts still say 283 and 412, and whoever merges second must apply this PR's 305/287/291 counts and the removal of the release-stamped bullet. The command-line hunk at the top of the same document auto-merges.
  • #1953 conflicts in .github/workflows/ci.yml: its --test-threads="$cli_threads" change sits next to the removed release-stamped step. Resolve by keeping the threads change and deleting the step.

Verdict

REQUEST_CHANGES. The retry does not fix the flaky promoted tests, which are red in the head CI, and the non-TUI counts remain wrong and self-contradictory.

Comment thread crates/dim-cli/src/update.rs Outdated
let version = channel_version(&package, tag).await.ok()?;
let version = match channel_version(&package, tag).await {
Ok(version) => version,
Err(_) => channel_version(&package, tag).await.ok()?,

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.

Problem. One retry does not make the startup offer deterministic. Both attempts call the same channel_version, which builds a client with the same 4 s total timeout (crates/dim-cli/src/update.rs:22), so both can miss under the same load. The retry also runs for permanent errors (404, invalid tag, malformed JSON), doubles the wait to about 8 s for an unreachable registry, and has no test, including the failure-then-success case it is meant to cover.

Failure scenario. At head be92c36d, verify (linux) (run 44850114947, job 136679317256) still failed staged_update::tui_update::update_now_falls_back_to_manual_command_for_an_old_daemon and update_now_stops_an_idle_daemon_and_restarts_on_the_same_session: 707 passed, 2 failed, 30 ignored, and both panicked at crates/dimcode/tests/cli_flow.rs:3942 after the 300 s HANG_GUARD (crates/dimcode/tests/cli_flow.rs:198) because the offer never arrived. This retry was the head commit's fix for that failure, so both attempts missed. The 300 s guard tolerates two 4 s attempts and the spawned check is abandoned with the runtime, so the guard and cancellation are not the blocker.

Fix. Make the wait deterministic instead of retrying a wall-clock deadline: give the test a debug-only update-timeout override, like DIM_TEST_DAEMON_START_TIMEOUT_MS in crates/dim-cli/README.md, or drive /update from the test after the interface is idle and retry on the visible failure status. If the retry stays, restrict it to transient transport errors (is_timeout, is_connect) and add a failure-then-success 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.

Fixed at c1bb5258, differently from the retry: available() calls channel_version once (crates/dim-cli/src/update.rs:321) and channel_version uses a debug-only deadline (crates/dim-cli/src/update.rs:24-34, applied at :362), set to 60 s in the TUI update helper (crates/dimcode/tests/cli_flow/staged_update.rs:1347-1348). The two tests that failed at be92c36d pass serially and at --test-threads=6; the retry concerns are moot because it is removed.

…ld-runtime-injection

# Conflicts:
#	docs/architecture/tui-e2e.md
Replace the one-shot retry with a debug-only DIM_TEST_UPDATE_TIMEOUT_MS
override and set it in the update flows, so a loaded runner's scheduling
delay cannot hide the offer, and correct the cli_flow counts in the
terminal E2E inventory.
@eric8810

Copy link
Copy Markdown
Collaborator Author

Addressed both P2s and merged main (includes #1951):

  • Update deadline: replaced the one-shot retry with a debug-only DIM_TEST_UPDATE_TIMEOUT_MS override next to the other test hooks, documented in crates/dim-cli/README.md, and set to 60 s in the update flows. cargo test -p dimcode --test cli_flow -- staged_update:: --test-threads=3 passes 25/25 locally.
  • Counts: recomputed from the built split targets. On macOS cli_flow* has 737 tests (30 ignored, 707 default); the 305 inventory cases leave 432 non-TUI (420 default, 12 ignored), 434/422/12 on Linux. The TUI subset is 287 selected; the 4 ui_leaf cases are stated as their own target and are no longer summed into 291.
  • Merge: docs/architecture/tui-e2e.md resolved against test(ci): consolidate integration test binaries and split monolithic cli_flow #1951 with those numbers; cargo fmt and adr-check pass.

CI is running once at the new head.

@eric8810
eric8810 requested a review from yyhhyyyyyy November 21, 2026 03:21

@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.

Re-review: runtime release injection (ADR 026 D3)

The PR moves the release mark out of dim-agent-capabilities into the final binaries, installs it once at startup, adds the debug-only DIM_TEST_RELEASE_BUILD override, splits the staged_update tests, and removes the release-stamped CI step so toggling DIM_RELEASE_BUILD recompiles only the final binary. Head c1bb5258 adds one commit over round 5's be92c36d (a test-only update deadline plus the E2E counts) and merges main 4f1fe204, which includes #1951's test target split.

Resolved findings

P2 (round 5): the promoted tui_update tests. Fixed. available() now makes one channel_version call (crates/dim-cli/src/update.rs:321), and channel_version takes its deadline from timeout() (crates/dim-cli/src/update.rs:24-34, used at :362), which reads DIM_TEST_UPDATE_TIMEOUT_MS only under #[cfg(debug_assertions)]; a release build keeps the 4 s TIMEOUT (:22). The TUI update helper sets 60 s on the child (crates/dimcode/tests/cli_flow/staged_update.rs:1347-1348), the history-lock helper does too (:1500-1501), and the recovery helpers set it as well (:945-946, :1090-1091, :1179-1180). The tests still assert the real offer and update outcome; only the wait bound changes. Locally staged_update::tui_update:: passed 6 of 6 serially and 6 of 6 at --test-threads=6, including the two head failures update_now_falls_back_to_manual_command_for_an_old_daemon and update_now_stops_an_idle_daemon_and_restarts_on_the_same_session; both are in the default cli_flow selection (--list confirms). Round 5's retry concerns are withdrawn because the retry is gone.

P2 (round 5): the cli_flow counts. Fixed. At head the four targets hold 737 tests on macOS (242 cli_flow + 212 cli_tui_flow + 119 cli_session_flow + 164 cli_daemon_flow), 30 ignored and 707 default. The 305 inventory cases match the built target (305 matched, 287 default, 18 ignored), leaving 432 total, 420 default and 12 ignored; Linux adds three target-specific cases and drops one macOS-only case, giving 739 total, 709 default and the documented 434 / 422 / 12. docs/architecture/tui-e2e.md:376 keeps the 4 ui_leaf cases in their own target (ui_leaf --list shows exactly 4), and :425-427 now states the 422 non-TUI plus 287 TUI partition of the default selection instead of counting the TUI cases twice.

Optional note (P3)

Problem. docs/architecture/tui-e2e.md:226 still says crates/dimcode/tests/cli_flow*.rs holds the 305 TUI cases. After #1951 split the targets, that glob matches only the cli_flow target, which holds 70 of the 305 inventory cases; the other 235 are in cli_tui_flow, cli_session_flow and cli_daemon_flow.

Failure scenario. A maintainer following #1810 from this sentence looks only in cli_flow.rs and misses 235 TUI cases.

Evidence. docs/architecture/tui-e2e.md:226 and :379-380; ls crates/dimcode/tests/cli_flow*.rs returns only cli_flow.rs; the four target lists hold 70 / 130 / 58 / 47 inventory cases.

Fix. Name the four targets or use crates/dimcode/tests/cli_*flow*.rs. This does not block.

Merge and cross-PR

git merge-tree --write-tree HEAD origin/main is clean, and the merge 41fe1e75 left the implementation files byte-identical to be92c36d (git diff be92c36d c1bb5258 is empty for crates/dim-agent-capabilities/src/build.rs, crates/dimcode/build.rs, crates/dimcode/src/main.rs, crates/dim-app-server/src/main.rs, crates/dim-cli/src/lib.rs and crates/dim-cli/src/client.rs). The tui-e2e.md conflict was resolved to the four-target wording and the counts above. #1950, #1961 and #1966 merge cleanly. #1952 and #1953 already conflict with origin/main alone; #1953's ci.yml conflict region contains the release-stamped step, resolved by keeping its --test-threads change and dropping the step. #1963's conflicts are in files this PR does not touch; its crates/dim-cli/README.md change auto-merges.

Verification

  • Diff: git diff origin/main...HEAD touches 13 files; git diff be92c36d c1bb5258 adds only the deadline, the five env lines and the merge of main.
  • Built the four targets at head: 737 macOS tests, 30 ignored, 707 default; ui_leaf 4.
  • staged_update::tui_update:: 6 passed serially (40.42 s) and 6 passed at --test-threads=6 (14.84 s).
  • staged_update::recovery:: 7 passed serially (46.78 s); daemon_replace::build_identity:: 6 passed (3.47 s); update_entry:: 1 passed (20.63 s).
  • dimcode --version reports 0.1.0-alpha.27-source+c1bb5258 by default, the bare version with DIM_TEST_RELEASE_BUILD=1, and the source label with 0.
  • After the first dev-profile build, toggling DIM_RELEASE_BUILD=1 rebuilt only dimcode (1.76 s) and reported the bare version; toggling it off rebuilt only dimcode (1.78 s) and restored the source label.
  • cargo check --locked --release -p dim-cli passes, so the #[cfg(debug_assertions)] branch compiles out in release.
  • cargo fmt --all -- --check --config error_on_line_overflow=true and git diff --check pass; node --test scripts/tui-tmux.test.mjs scripts/release.test.mjs passes 48 of 48; node scripts/adr-check.mjs --base origin/main passes with 13 files.
  • CI at c1bb5258: run 44860675408 has changes, dependencies, macos-native, web and windows-cli passing; verify (linux) was still in Run compiled workspace tests when this review was written; acp-registry skipped.
  • Unverified: the Linux counts are derived from the OS-gated test set and round 5's Linux 739 measurement, not from a local Linux run; the head verify (linux) job is still pending.

Verdict

APPROVE. Both blocking P2s are fixed, the merge kept the approved implementation intact, and only an optional doc path note remains.

@eric8810
eric8810 merged commit cfeccad into main Nov 21, 2026
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.

build/ci: stop DIM_RELEASE_BUILD from recompiling 56 crates in every Rust PR

2 participants