Skip to content

test(ci): isolate debug-only CLI acceptances - #2223

Merged
eric8810 merged 5 commits into
mainfrom
dim/2218-debug-only-tests
Nov 26, 2026
Merged

eric8810 merged 5 commits into
mainfrom
dim/2218-debug-only-tests

Conversation

@eric8810

@eric8810 eric8810 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Move the 39 debug-build CLI acceptances out of ordinary workspace verification:

  • crates/dimcode gains a dev-tests feature.
  • daemon_startup_progress (20), daemon_replace::build_identity (6), staged_update::recovery (7) and staged_update::tui_update (6) compile only with --features dev-tests; their debug_assertions guards stay.
  • cargo test --workspace no longer compiles or runs them.
  • ci.yml gets a debug path group and a dedicated step. The group covers the owning test files and the production paths that implement the behaviors they assert: dim-cli/src/client.rs, dim-cli/src/lib.rs, dim-cli/src/update.rs, dim-cli/src/update/staged.rs, dim-cli/src/plugins.rs, dim-cli/src/session_host.rs, dim-cli/src/ui/, dim-agent-capabilities/src/build.rs, dim-app-server/src/cli.rs, dim-app-server/src/transport.rs, dim-app-server/src/storage/sqlite.rs, dimcode/src/main.rs; the owning test files, dimcode/tests/support/cli_harness.rs, dimcode/tests/support/daemon.rs and dimcode/Cargo.toml also select it.
  • The dedicated step builds only cli_daemon_flow and cli_flow with the feature, then runs the four filters through scripts/run-rust-test.mjs with DIM_TEST_TIMEOUT_MS=600000, so its per-target timeout and process-tree cleanup apply. It also runs cargo clippy -p dimcode --all-targets --features dev-tests.
  • Build, TUI-E2E and release docs record the split, the complete local command set, and the qualified 422/287 totals.

This is the first PR for #2218. The 4 measurement harnesses remain #[ignore] and are not part of ordinary CI; this PR only adds the debug-only routing.

Fixes #2218.

Design rule checklist

  • Scope: n/a — test and CI routing only; no new plugin part or process/Session/branch state.
  • Commands and results: n/a — no module state changes.
  • Handover: n/a — no handover points.
  • Timeline before callbacks: n/a — no Timeline writes.
  • Infrastructure: n/a — Timeline, Dispatcher, assembly, Session and branch facades unchanged.
  • Core mechanisms: n/a — no plugin-specific handling.
  • Batch: n/a — no facts are written.
  • Context: n/a — no context inputs.
  • No reading another plugin's internal state: n/a.
  • Cross-language faces: n/a — no service or face changes.
  • Business configuration: n/a — no loader rows or configuration contracts.
  • Missing mechanism capabilities: n/a — no mechanism gap.
  • Timeline facts: n/a — no Timeline changes.

Documentation

  • No accepted ADR is modified or deleted.
  • No other module's design is changed; docs/architecture/build.md, docs/architecture/tui-e2e.md and docs/release/README.md describe the test routing they own.
  • No delivery status is added to an ADR, index or roadmap.

Verification

  • cargo test --locked -p dimcode --test cli_daemon_flow --test cli_flow --no-run — ordinary targets compile without the gated modules.
  • cargo test --locked -p dimcode --test cli_daemon_flow -- --list — no daemon_startup_progress or daemon_replace::build_identity entries.
  • cargo test --locked -p dimcode --features dev-tests --test cli_daemon_flow -- --list — 26 gated entries (20 + 6).
  • cargo test --locked -p dimcode --test cli_flow -- --list — no staged_update::recovery or staged_update::tui_update entries.
  • cargo test --locked -p dimcode --features dev-tests --test cli_flow -- --list — 13 gated entries (7 + 6).
  • node --test scripts/ci-changes.test.mjs — 12 passed, including the production-path rules.
  • cargo build --locked -p dimcode --features dev-tests --test cli_daemon_flow --test cli_flow --message-format=json then the four scripts/run-rust-test.mjs filters:
    • daemon_startup_progress — 20 passed (48 s)
    • daemon_replace::build_identity — 6 passed (4.4 s)
    • staged_update::recovery — 7 passed (0.6 s)
    • staged_update::tui_update — 6 passed (8.1 s)
  • cargo clippy --locked -p dimcode --all-targets --features dev-tests -- -D warnings — passed.
  • cargo clippy --locked -p dimcode --all-targets -- -D warnings — passed.
  • cargo fmt --all -- --check — passed.
  • node --test scripts/*.test.mjs — 163 tests, 161 passed, 2 skipped.
  • cargo run --locked -p xtask-check — all static checks passed.

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

Reviewed 4ce2dd7f3e619595bc4c81cbcf17e0fac16a9b35. Exact Linux CI excludes the 39 cases from ordinary verification and passes all 39 through the dedicated filters. Two regressions remain:

  1. Keep acceptance coverage on changes to the behavior it protects. The new router selects the dedicated group for test files and a manifest, but leaves it off for production paths such as dim-cli/src/client.rs, dim-cli/src/update.rs and dim-app-server/src/storage/sqlite.rs. A PR changing startup waits, same-version replacement or store recovery can therefore pass without the tests that previously ran. Verify that production changes to those behaviors select the affected checks before ci-ok passes, without returning the 39 cases to every ordinary workspace run.
  2. Bound hangs and clean up their child processes. The dedicated step sets DIM_TEST_TIMEOUT_MS but bypasses the runner that reads it. A test stuck reading child output can hold the self-hosted job until the 75-minute backstop. Verify that a hung dedicated test fails within an explicit test budget and that descendants are cleaned up on timeout or cancellation.

Non-blocking: provide a single documented command or complete set of commands for all 39 and reconcile the older TUI test totals.

@eric8810

Copy link
Copy Markdown
Collaborator Author

Addressed both blockers in 1a558067e.

  1. scripts/ci-changes.mjs now selects the debug group for dim-cli/src/client.rs, dim-cli/src/update.rs, dim-app-server/src/cli.rs and dim-app-server/src/storage/sqlite.rs, with router tests for each.
  2. The dedicated step now builds --features dev-tests --tests artifacts and runs all four filters through scripts/run-rust-test.mjs with DIM_TEST_TIMEOUT_MS=600000, so its timeout and process-tree cleanup apply. Direct cargo test is gone.

Non-blocking items: docs/architecture/build.md lists all four commands, and docs/architecture/tui-e2e.md now states that the ordinary and dedicated runs together keep the original 422 non-TUI and 287 TUI totals.

Local check through the same runner: 20 startup + 6 build-identity + 7 recovery + 6 tui-update all passed (51 s, 11 s, 0.7 s, 8 s). Router tests and xtask-check passed.

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

Verdict: REQUEST_CHANGES

Scope: move the 39 debug-only CLI acceptances out of ordinary workspace verification into a dedicated debug CI step. The feature gating, the four test filters and the rerun-based step work; one routing gap remains.

P2

The debug step still misses production paths these acceptances assert

File: scripts/ci-changes.mjs:53-54; docs/architecture/build.md:375.

Problem: the new rule selects debug for crates/dim-cli/src/client.rs and exactly crates/dim-cli/src/update.rs. The behavior behind staged_update::recovery and staged_update::tui_update also lives in crates/dim-cli/src/update/staged.rs: verify_recovery (:227) and verify_store_format (:438) produce the refusal messages asserted at crates/dimcode/tests/cli_flow/staged_update.rs:1069 and :1076. classify(['crates/dim-cli/src/update/staged.rs']) returns rust,windows, without debug. crates/dim-agent-capabilities/src/build.rs reads DIM_TEST_BUILD_ID (:43) and DIM_TEST_RELEASE_BUILD (:58), which 19 of the 39 cases depend on, and classifies as rust,node. crates/dim-app-server/src/transport.rs:776 reports the build id that daemon_replace::build_identity asserts, and crates/dimcode/src/main.rs:79 installs it; neither selects debug. The harness rule at scripts/ci-changes.mjs:62 also stops at cli_harness.rs and does not cover the crates/dimcode/tests/support/daemon.rs it embeds. The comment at scripts/ci-changes.mjs:58-59 still says only the owning test files select the step, so a later maintainer is not pointed at these paths.

Failure scenario: a PR changes verify_store_format (staged.rs:438) to accept a staged release whose store_formats omit the running store. The 7 recovery tests would fail, but classify returns debug=false, the ordinary workspace run compiles cli_flow without dev-tests, and the dedicated step is skipped; CI is green. A release_flag change in build.rs:58 has the same effect on the 13 recovery and tui_update cases that set DIM_TEST_RELEASE_BUILD=1. Only a scheduled sweep or a manual run would catch either, after merge.

Fix: add the implementing paths to the rules: match ^crates/dim-cli/src/update(?:\.rs|/) at :54, add crates/dim-agent-capabilities/src/build.rs and crates/dim-app-server/src/transport.rs (consider crates/dimcode/src/main.rs and crates/dim-cli/src/ui/ for the identity install and Update now), assert each in scripts/ci-changes.test.mjs, and correct the closed list at build.md:375. If keeping that list complete is not practical, select debug whenever rust is selected.

P3

The preserved-total claim does not hold for unselected paths

File: docs/architecture/tui-e2e.md:440-441. "Together with the ordinary run, CI keeps the original 422 non-TUI and 287 TUI cli_flow* cases" is true only when the dedicated step is selected. A Rust change outside the rule list (for example crates/dim-agent-runtime/src/lib.rs) runs the ordinary 389/281 and skips the dedicated step, so neither original total is kept. Qualify the sentence with "when the dedicated step is selected" or drop it.

The step rebuilds four unused test targets

File: .github/workflows/ci.yml:369. cargo build --tests builds all six dimcode test targets with dev-tests, but the four runs use only cli_flow and cli_daemon_flow. On a self-hosted runner this recompiles cli_tui_flow, cli_session_flow, ui_leaf and ocr_helper_flow under the feature. --test cli_daemon_flow --test cli_flow produces the same artifacts file without that rebuild.

Stale routing comment

File: scripts/ci-changes.mjs:58-59. "Only the files that own them select the dedicated debug step" contradicts the production-path rules at :54, :66 and :67. Reword to "the owning files and the production paths they protect".

PR body is stale

The body still says the step is selected by the owning test files, cli_flow.rs, cli_daemon_flow.rs, tests/support/cli_harness.rs and crates/dimcode/Cargo.toml, and its verification list uses direct cargo test lines that the second commit replaced with the build and run-rust-test.mjs step. Update it so the merge record matches CI.

Verification

  • node --test scripts/ci-changes.test.mjs: 12 pass at 1a55806. The new assertions are sensitive: removing a rule falls through to rust or rust,node and fails.
  • Gating exactness: cargo test -p dimcode --test cli_daemon_flow -- --list is 161 tests without the feature and 187 with it (26 gated); --test cli_flow is 262 and 275 (13 gated). The no-feature lists contain zero daemon_startup_progress, build_identity, staged_update::recovery or staged_update::tui_update names; the feature adds 20 + 6 + 7 + 6. No non-gated test in those files depends on a gated helper (the no-feature build and clippy pass).
  • cargo clippy -p dimcode --all-targets -- -D warnings and the same with --features dev-tests: both pass.
  • Dedicated-step reproduction: cargo build -p dimcode --features dev-tests --tests --message-format=json yields exactly one cli_daemon_flow and one cli_flow test artifact, also on a fresh rerun; node scripts/run-rust-test.mjs <artifacts> cli_daemon_flow daemon_replace::build_identity --test-threads=2 passes 6/6 and cli_flow staged_update::recovery passes 7/7.
  • Timeout and cleanup: DIM_TEST_TIMEOUT_MS is read at scripts/run-rust-test.mjs:11, and the runner kills the child and its descendants on timeout and on signals (:41-70). The direct cargo test lines that ignored the variable are gone.
  • Counters: the measured deltas are 33 non-TUI (20 + 6 + 7) and 6 TUI, so 422 - 33 = 389 and 287 - 6 = 281. I could not reproduce the absolute 422/287 values from --list (446 default-run in cli_flow plus cli_daemon_flow, 771 across the four cli_flow* targets); that counting convention predates this PR, so I report it as unverified rather than a finding.
  • CI at 1a55806: changes passed and printed debug=true; verify (linux) was still running when this review was written, and the other jobs passed. mergeable=MERGEABLE; git merge-tree --write-tree origin/main HEAD is clean.

Comment thread scripts/ci-changes.mjs Outdated
[/^scripts\//,['scripts']],
[/^docker\//,['scripts']],
// The startup, replacement and update paths these acceptances protect.
[/^crates\/dim-cli\/src\/(?:client|update)\.rs$/,['rust','windows','debug']],

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 rule matches only client.rs and the exact update.rs. crates/dim-cli/src/update/staged.rs holds verify_recovery (:227) and verify_store_format (:438), whose refusal messages the 7 recovery tests assert (staged_update.rs:1069, :1076), and it classifies as rust,windows, so those tests are skipped. The same gap covers crates/dim-agent-capabilities/src/build.rs (DIM_TEST_BUILD_ID at :43, DIM_TEST_RELEASE_BUILD at :58) and crates/dim-app-server/src/transport.rs:776. Match ^crates/dim-cli/src/update(?:\.rs|/) and add the other paths, with assertions in ci-changes.test.mjs.

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 for the paths named in this thread at 14d96cf: crates/dim-cli/src/update/staged.rs matches the update rule at scripts/ci-changes.mjs:54, crates/dim-agent-capabilities/src/build.rs and crates/dim-app-server/src/transport.rs select debug at :66-67, crates/dimcode/src/main.rs at :64, and crates/dimcode/tests/support/daemon.rs at :63; crates/dim-cli/src/lib.rs, plugins.rs and ui/ were added at :55. One adjacent production path on the same acceptances remains: crates/dim-cli/src/session_host.rs still classifies rust,windows, and the old-daemon tui_update case asserts the offer logic it owns. The new inline comment on scripts/ci-changes.mjs:55 has the failure scenario and the one-line fix.

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 remaining adjacent path is fixed in 2b8392a. crates/dim-cli/src/session_host.rs now matches the rule at scripts/ci-changes.mjs:55, scripts/ci-changes.test.mjs:139 expects rust,windows,debug, and docs/architecture/build.md:375 and the PR body list the path. Nothing remains in this thread.

Comment thread scripts/ci-changes.mjs Outdated
[/^crates\/dim-cli\//,['rust','windows']],
[/^crates\/dim-client\//,['rust','windows','node']],
[/^crates\/dim-agent-types\//,['rust','windows','node']],
// Debug-build acceptances (#2218) leave ordinary workspace tests. Only 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.

[P3] This comment still says only the owning files select the debug step, but the rules at :54, :66 and :67 now select it for production paths. Reword it so the next protected path is not missed.

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 14d96cf. The comment at scripts/ci-changes.mjs:59-60 now says the owning test files and the production paths they protect select the dedicated step, matching the rules at :54-70.

Comment thread .github/workflows/ci.yml Outdated
run: |
set -euo pipefail
cargo clippy --locked -p dimcode --all-targets --features dev-tests -- -D warnings
cargo build --locked -p dimcode --features dev-tests --tests --message-format=json > target/debug-test-artifacts.jsonl

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] --tests builds all six dimcode test targets with dev-tests, but the four runs below use only cli_daemon_flow and cli_flow; cli_tui_flow, cli_session_flow, ui_leaf and ocr_helper_flow are rebuilt under the feature only to be ignored. --test cli_daemon_flow --test cli_flow writes the same artifacts file without that 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.

Fixed at 14d96cf. .github/workflows/ci.yml:369 now builds only --test cli_daemon_flow --test cli_flow; the JSONL has exactly one test artifact per target, also on a fresh rerun, and the four filters pass 20/6/7/6.

Comment thread docs/architecture/tui-e2e.md Outdated
the production paths they protect change. The `tui_update` cases use the
debug-only `DIM_TEST_RELEASE_BUILD=1` override instead of a separate
release-stamped build step. Together with the ordinary run, CI keeps the
original 422 non-TUI and 287 TUI `cli_flow*` cases.

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] This holds only when the dedicated step is selected. A Rust change outside the rule list (for example crates/dim-agent-runtime/src/lib.rs) runs the ordinary 389/281 and skips the dedicated step, so CI keeps neither 422 nor 287. Qualify the sentence or drop 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 14d96cf. docs/architecture/tui-e2e.md:440-441 now says When the dedicated step is selected before the 422/287 claim.

@eric8810

Copy link
Copy Markdown
Collaborator Author

Addressed the P2/P3 items in 6ed72934d.

P2 routing:

  • ^crates/dim-cli/src/update(?:\.rs|/) now covers update/staged.rs (verify_recovery, verify_store_format); ui/ and plugins.rs cover Update now.
  • Added dim-agent-capabilities/src/build.rs (DIM_TEST_BUILD_ID, DIM_TEST_RELEASE_BUILD), dim-app-server/src/transport.rs (build-id hello), dimcode/src/main.rs (identity install), and tests/support/daemon.rs.
  • The routing comment now says "the owning test files and the production paths they protect".
  • Each path has a ci-changes.test.mjs assertion that fails if the rule falls through to rust/rust,node.

P3:

  • The 422/287 sentence is qualified with "When the dedicated step is selected".
  • The step now builds only --test cli_daemon_flow --test cli_flow, not --tests; the artifact file was reproduced locally with exactly those two targets.
  • The stale routing comment is reworded.
  • The PR body was rewritten to match the final path list, the runner-based step, and the current verification commands.

Verification at 6ed72934d: node --test scripts/ci-changes.test.mjs 12 pass; all four filters through run-rust-test.mjs pass (20 + 6 + 7 + 6); xtask-check passes. I did not independently reproduce the absolute 422/287 counting convention, so the docs now state it conditionally instead of asserting it for every path.

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

Reviewed 6ed72934d2328b930d705d9825032486b9d1f475. The dedicated runner now gives each filter a bounded timeout and cleans up descendants, and the amended router selects the relevant checks for most of the production paths identified earlier. All 39 cases passed in the superseded run before cancellation; current CI is still separate.

Remaining coverage acceptance: a change confined to the Update now entry point still classifies as debug=false. That entry point controls what happens if the user interrupts daemon shutdown, including exit status and resume instructions, as well as restart into the same Session. Verify that a PR modifying only that path runs the relevant TUI update cases before ci-ok, without re-enabling the suite for unrelated ordinary Rust changes. Router · Acceptance cases

@eric8810

Copy link
Copy Markdown
Collaborator Author

Added the remaining Update now entry point in 14d96cf9c: crates/dim-cli/src/lib.rs now selects debug (alongside plugins.rs and ui/), with a router assertion. docs/architecture/build.md lists it with the other protected paths.

The web job failure on the previous run is unrelated: web/src/chat-ui/web-chat-timeline.test.ts:567 expected 64 and received 2464. This branch changes only CI routing, docs and test gating. The push starts a fresh run; if web repeats the same failure I will rerun it and record it separately.

@eric8810

Copy link
Copy Markdown
Collaborator Author

@yyhhyyyyyy @zerob13 CI is green at 14d96cf9c: verify (linux) 16m31s, ci-ok pass, all other checks pass. The remaining lib.rs Update now entry point is now routed with a router assertion, and the earlier P2/P3 items are in 6ed72934d. Both requested-change reviews should now be addressed; could you re-review when you have a moment?

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

Reviewed 14d96cf9c4d9a63fbc0f9d74e884908a75b75d8a. The last routing condition is closed: a PR changing only the Update now entry point in dim-cli/src/lib.rs selects the debug suite; an unrelated CLI path still skips it. The bounded test runner remains in place. Exact-head CI passed all 39 dedicated cases, including interrupt during daemon shutdown and restarting into the same Session, plus macOS native, Windows CLI and ci-ok.

CI tested the synthetic merge with main at 3b0f013f6c19150745a900236331873427e130ca. The newer main added an unrelated Hooks fixture change and merges cleanly; I did not run CI on that newer combination. This supersedes my prior change request.

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

Verdict: REQUEST_CHANGES

Scope: keep the 39 debug-build CLI acceptances out of ordinary workspace runs and run them in a dedicated debug CI step selected by the owning test files and the production paths they assert. The three P3 threads from round 1 are fixed, and the routing P2 is fixed for the paths it names; one adjacent production path that the TUI update cases assert still does not select the step. The ci.yml artifacts and timeout work.

P2

The TUI update offer path still does not select the debug step

File: scripts/ci-changes.mjs:55; docs/architecture/build.md:375.

Problem: the new rules select debug for client.rs, lib.rs, plugins.rs, ui/, the update modules, dim-agent-capabilities/src/build.rs, transport.rs, storage/sqlite.rs, app-server/src/cli.rs, dimcode/src/main.rs and tests/support/daemon.rs, but not crates/dim-cli/src/session_host.rs. session_host.rs:457 computes managed = options.server.is_none() && client.offers("daemon.shutdown.ifIdle") and :460 clears offer.direct with offer.direct &= managed; the on-demand check repeats this at :1963-1968. offer.direct is what puts Update now in the dialog (crates/dim-cli/src/ui/upgrade_dialog.rs:82-87), and staged_update::tui_update::update_now_falls_back_to_manual_command_for_an_old_daemon asserts that an old daemon gets the manual command and no Update now (crates/dimcode/tests/cli_flow/staged_update.rs:1502-1504, assertions at :1440-1448). classify(['crates/dim-cli/src/session_host.rs']) returns rust,windows, and scripts/ci-changes.test.mjs:139 pins that.

Failure scenario: a PR restoring the pre-8c14d85d54 condition let managed = options.server.is_none(); (that commit changed this exact line on 2026-11-19 and updated the old-daemon case in the same commit) fails update_now_falls_back_to_manual_command_for_an_old_daemon, one of the 6 tui_update cases. debug is false, so the dedicated step is skipped; the ordinary workspace run compiles cli_flow without dev-tests, where the module does not exist, and no ordinary cli_tui_flow test opens the update dialog. CI is green.

Evidence: session_host.rs:457, :460, :1963-1968; upgrade_dialog.rs:82-87; staged_update.rs:1440-1448 and :1502-1504; the classify probe in Verification; commit 8c14d85.

Fix: add session_host(?:\.rs|\/) to the rule at scripts/ci-changes.mjs:55 (or give it its own rule), change the assertion at scripts/ci-changes.test.mjs:139 to rust,windows,debug, add dim-cli/src/session_host.rs to docs/architecture/build.md:375, and list it in the PR body.

P3

build.md's path list does not match the router

File: docs/architecture/build.md:375.

Problem: the list presents the paths that select the dedicated step, but it omits dimcode/tests/support/cli_harness.rs, which scripts/ci-changes.mjs:63 selects, and dimcode/Cargo.toml, which :64 selects. It includes dimcode/tests/support/daemon.rs, so the shorter set reads as an oversight rather than a production-path-only scope.

Failure scenario: a maintainer edits the harness or the manifest, reads this list, and concludes the dedicated step is not selected, although it is. The router itself is correct; this is documentation only.

Fix: add both entries, or state that the list names production paths and that the owning test files and harnesses also select the step.

Round 1 threads

  • 4704649525: fixed for every path named in the thread; one adjacent path remains, the P2 above.
  • 4704649531: fixed at scripts/ci-changes.mjs:59-60.
  • 4704649533: fixed at .github/workflows/ci.yml:369; the two-target build writes exactly one test artifact per target and the four filters pass 20/6/7/6.
  • 4704649542: fixed at docs/architecture/tui-e2e.md:440-441.

Verification

  • node --test scripts/ci-changes.test.mjs: 12 pass. Sensitivity: deleting each of the ten new or changed debug rule lines in a copy makes the test fail, so a missing rule is caught.
  • Classify probes: every path named in round 1 now returns debug (update/staged.rs, dim-agent-capabilities/src/build.rs, transport.rs, dimcode/src/main.rs, tests/support/daemon.rs, plus lib.rs, plugins.rs, ui/tui.rs). crates/dim-cli/src/session_host.rs, locale.rs and display.rs return rust,windows; cli_harness.rs and daemon.rs return rust,node,debug.
  • No-feature --list at 14d96cf: cli_daemon_flow 161 tests and cli_flow 262 tests, with zero daemon_startup_progress, build_identity, staged_update::recovery or staged_update::tui_update names. With dev-tests, this host lists 187 and 275; CI Linux lists 188 for cli_daemon_flow, one platform-only test more, and 275 for cli_flow.
  • Dedicated step: cargo build -p dimcode --features dev-tests --test cli_daemon_flow --test cli_flow --message-format=json writes exactly two test artifacts, also on a fresh rerun. The four run-rust-test.mjs filters pass 20/20, 6/6, 7/7 and 6/6. DIM_TEST_TIMEOUT_MS is read at scripts/run-rust-test.mjs:11, and the timeout path kills the child and its descendants at :41-70.
  • node --test scripts/*.test.mjs: 163 tests, 159 pass, 4 skipped on this macOS host (the Linux and Windows layout tests); no failures. The PR body's 161 passed and 2 skipped come from Linux, which skips fewer platform cases.
  • CI at 14d96cf: all jobs pass, including ci-ok and verify (linux). The changes job printed debug=true, and the dedicated step ran on Linux and passed 20/6/7/6, so the routing and the two-target build work in CI. mergeable=true; the API state is blocked only by the review.
  • Merge-tree is clean against origin/main 3b0f013 and against the current main 3edabc0 (PR #2224 merged during the review), and against #2197 49c14ad, #2211 ee8dcae, #2206 c8d5276, #2214 74d5df0, #2174 01f9a70 and #2224 82085a3. The brief's #2206 bed9408, #2214 2bbbb18 and #2174 3914eaa also merge clean; those PRs have since moved. #2224 is closed and merged. Only #2211 also edits tui-e2e.md, in the table near :105, away from this PR's :431-441.
  • Worktree clean at 14d96cf; no residual processes or /tmp test homes after the runs.

Unverified: the absolute 422/287 totals rely on the round-1 counting convention; I reproduced the 33 non-TUI and 6 TUI deltas from the filter runs. The PR body's "161 passed, 2 skipped" for scripts differs from this host's 159 and 4, which are platform-only skips.

Comment thread scripts/ci-changes.mjs Outdated
[/^docker\//,['scripts']],
// The startup, replacement and update paths these acceptances protect.
[/^crates\/dim-cli\/src\/(?:client\.rs|update(?:\.rs|\/))/,['rust','windows','debug']],
[/^crates\/dim-cli\/src\/(?:lib\.rs|plugins\.rs|ui\/)/,['rust','windows','debug']],

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 rule selects lib.rs, plugins.rs and ui/, but leaves out crates/dim-cli/src/session_host.rs, which is the code that clears the direct update offer: session_host.rs:457 computes managed = options.server.is_none() && client.offers("daemon.shutdown.ifIdle"), :460 does offer.direct &= managed, and :1963-1968 repeats the condition for the on-demand check. offer.direct is what adds Update now to the dialog (crates/dim-cli/src/ui/upgrade_dialog.rs:82-87), and staged_update::tui_update::update_now_falls_back_to_manual_command_for_an_old_daemon asserts that an old daemon gets the manual command and no Update now (crates/dimcode/tests/cli_flow/staged_update.rs:1502-1504, assertions at :1440-1448). classify(['crates/dim-cli/src/session_host.rs']) is rust,windows, and scripts/ci-changes.test.mjs:139 pins that. A PR restoring the pre-8c14d85d54 condition let managed = options.server.is_none(); (that commit changed this exact line on 2026-11-19 and updated the old-daemon case in the same commit) would fail update_now_falls_back_to_manual_command_for_an_old_daemon, one of the 6 tui_update cases, but debug=false skips the dedicated step and the ordinary cli_flow run compiles without dev-tests, so CI stays green. Add session_host(?:\.rs|\/) to this rule, change the assertion at ci-changes.test.mjs:139 to rust,windows,debug, add dim-cli/src/session_host.rs to docs/architecture/build.md:375, and list it in the PR body.

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 2b8392a. The rule at scripts/ci-changes.mjs:55 now matches session_host.rs and the session_host/ directory, classify(['crates/dim-cli/src/session_host.rs']) returns rust,windows,debug, scripts/ci-changes.test.mjs:139 pins it, and docs/architecture/build.md:375 and the PR body list the path. The offer logic at session_host.rs:457, :460 and :1963-1968 now selects the dedicated step.

Comment thread docs/architecture/build.md Outdated
cargo test --locked -p dimcode --features dev-tests --test cli_flow staged_update::tui_update
```

Ordinary workspace tests compile without `dev-tests`; CI selects the dedicated step for changes to those owning test files and to the production paths that implement the behaviors they assert: `dim-cli/src/client.rs`, `dim-cli/src/lib.rs`, `dim-cli/src/update.rs`, `dim-cli/src/update/staged.rs`, `dim-cli/src/plugins.rs`, `dim-cli/src/ui/`, `dim-agent-capabilities/src/build.rs`, `dim-app-server/src/cli.rs`, `dim-app-server/src/transport.rs`, `dim-app-server/src/storage/sqlite.rs`, `dimcode/src/main.rs` and `dimcode/tests/support/daemon.rs`. The real 30-second background handoff is also opt-in locally: `cargo test --locked -p dim-agent-integration-tests --test integration_flow local_execution::a_long_foreground_command_moves_to_the_background_after_30_seconds -- --ignored --exact`; CI runs it for execution-related paths, main pushes, scheduled sweeps and manual runs. Ordinary workspace tests retain execution cancellation, cleanup and recovery flows.

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] This list presents the paths that select the dedicated step, but it omits dimcode/tests/support/cli_harness.rs, which scripts/ci-changes.mjs:63 selects, and dimcode/Cargo.toml, which :64 selects. It includes dimcode/tests/support/daemon.rs, so the shorter set reads as an oversight rather than a production-path-only scope. A maintainer editing the harness or the manifest would read this list and conclude the step is not selected, although it is. Add both entries, or state that the list names production paths and that the owning test files and harnesses also select the step.

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 2b8392a. docs/architecture/build.md:375 now names dim-cli/src/session_host.rs and states that the owning test files, dimcode/tests/support/cli_harness.rs, dimcode/tests/support/daemon.rs and dimcode/Cargo.toml also select the step, matching scripts/ci-changes.mjs:61-64.

@eric8810
eric8810 requested a review from yyhhyyyyyy November 26, 2026 07:05
@eric8810

Copy link
Copy Markdown
Collaborator Author

Addressed the new P2/P3 in 2b8392a9d:

  • ^crates/dim-cli/src/(?:lib\.rs|plugins\.rs|session_host(?:\.rs|/)|ui/) now selects debug, so the managed = ... && client.offers("daemon.shutdown.ifIdle") / offer.direct &= managed path is covered.
  • scripts/ci-changes.test.mjs now asserts crates/dim-cli/src/session_host.rs -> rust,windows,debug.
  • docs/architecture/build.md lists session_host.rs and states that the owning test files, cli_harness.rs, daemon.rs and Cargo.toml also select the step.
  • The PR body is updated with the same path set.

node --test scripts/ci-changes.test.mjs 12 pass and xtask-check passes. The new push triggers CI; this only changes routing and docs.

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

Verdict: APPROVE

Scope: keep the 39 debug-build CLI acceptances out of ordinary workspace verification and run them in a dedicated debug CI step selected by the owning test files and the production paths they assert. This round adds the update offer path and closes the round 2 P2 and P3; no blocking finding remains.

Round 2

  • P2, session_host.rs: fixed in 2b8392a9. scripts/ci-changes.mjs:55 matches session_host(?:\.rs|\/); classify(['crates/dim-cli/src/session_host.rs']) is rust,windows,debug; scripts/ci-changes.test.mjs:139 pins it; docs/architecture/build.md:375 and the PR body list the path. The offer logic at crates/dim-cli/src/session_host.rs:457, :460 and :1963-1968 now selects the dedicated step.
  • P3, build.md: fixed in the same commit. docs/architecture/build.md:375 now names the path and states that the owning test files, dimcode/tests/support/cli_harness.rs, dimcode/tests/support/daemon.rs and dimcode/Cargo.toml also select the step, matching scripts/ci-changes.mjs:61-64.

Whole-diff check

  • No overreach: the rule matches only lib.rs, plugins.rs, session_host.rs, session_host/ and ui/ under crates/dim-cli/src; locale.rs, session.rs, args.rs and maintenance.rs still classify as rust,windows.
  • No other unrouted production path behind the 39 cases was found. Startup waits and their messages are in client.rs; the locale text is under ui/; store diagnostics and startup notes are in storage/sqlite.rs; update refusal, staging and restart are in update.rs, update/staged.rs and lib.rs; the history lock is in ui/composer/history.rs plus lib.rs; the daemon.shutdown.ifIdle offer is in session_host.rs and client.rs. All select debug. Shared paths such as args.rs, session.rs and locale.rs are covered by ordinary cli_flow* tests for the same flows.
  • The step still builds only --test cli_daemon_flow --test cli_flow, writes two test artifacts, runs the four filters under DIM_TEST_TIMEOUT_MS=600000, and scripts/run-rust-test.mjs kills descendants on timeout and signals.
  • The gating is exact; the PR body, routing comment, build document and workflow agree on the path set and the runner-based commands.

Verification at 2b8392a

  • node --test scripts/ci-changes.test.mjs: 12 pass. Mutation: removing session_host(?:\.rs|\/) from a copy falls back to rust,windows and fails scripts/ci-changes.test.mjs:139.
  • node --test scripts/*.test.mjs: 163 tests, 159 pass, 4 platform skips on this macOS host, 0 fail.
  • --list: 161 cli_daemon_flow and 262 cli_flow without the feature, 187 and 275 with it; zero gated names without the feature; 20 + 6 + 7 + 6 added.
  • The four filters through scripts/run-rust-test.mjs pass 20/20, 6/6, 7/7 and 6/6. The feature binaries come from the previous round and the delta touches no Rust source, so they are source-identical to this head. The previous build wrote exactly one artifact per target, also on a rerun.
  • I did not rerun cargo build or clippy this round because the delta changes only scripts/, docs and one router assertion.

CI and merge state

  • changes selected debug=true from this PR's own files. scripts, static-checks, windows-cli, web, macos-native and dependencies pass.
  • verify (linux) failed in branch_flow::an_ended_line_wakes_the_wait_of_the_main_that_opened_it at crates/dim-agent-capabilities/tests/branch_flow.rs:8056 ("the wait is still waiting"). That test is outside the diff, every other target passed, and the same gated Rust selection passed Linux verification at 14d96cf9, so it reads as an unrelated flake. The step failure skipped the dedicated debug step, so CI has not run it at this head; a rerun is needed before merge for a green record.
  • mergeable=true, mergeable_state=blocked. git merge-tree --write-tree is clean against current main 35c99ab6 and against #2197 12a70b74, #2225 a9116c4a and #2202 08b73bfa. Main advanced from 3edabc0b to 35c99ab6 during the review; its changes do not touch this PR's sections.

Unverified

  • The absolute 422/287 totals still rely on the earlier counting convention; the 33 non-TUI and 6 TUI deltas are reproduced.
  • CI has not run on the current main 35c99ab6 combination.

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

Reviewed 2b8392a9d4a5ed7d8fa3330b99e2207fce41c895. Changes limited to either Update now entry point now select the debug suite, while an unrelated CLI path still skips it. Timeout and cancellation cleanup passed targeted runner checks. The previously tested 39 cases and runner are unchanged.

The independent Linux CI gate is red: ordinary workspace verification failed in an_ended_line_wakes_the_wait_of_the_main_that_opened_it, before the dedicated step. The failing test and implementation are unchanged by this PR; the cause is unverified and the current head still needs the gate.

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.

ci: separate debug-only and measurement tests from ordinary workspace verification

3 participants