Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
outputs:
rust: ${{ steps.groups.outputs.rust }}
windows: ${{ steps.groups.outputs.windows }}
static: ${{ steps.groups.outputs.static }}
xtask: ${{ steps.groups.outputs.xtask }}
node: ${{ steps.groups.outputs.node }}
eval: ${{ steps.groups.outputs.eval }}
Expand Down Expand Up @@ -71,6 +72,29 @@ jobs:
run: cargo install --jobs 2 --locked cargo-deny --version '=0.20.2'
- name: Check dependency advisories and licenses
run: cargo deny --locked check advisories licenses
static-checks:
needs: changes
if: needs.changes.outputs.static == 'true'
runs-on: [self-hosted, linux, x64]
timeout-minutes: 10
env:
CARGO_INCREMENTAL: "0"
CARGO_TARGET_DIR: ${{ github.workspace }}/target
RUSTC_WRAPPER: ""
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@c8ff772090ab9d00f7f7bd7b388f3c3032282e3b
with:
cache: false
build-warnings: ""
- name: Run pure static repository checks
run: |
cargo fmt --all -- --check --config error_on_line_overflow=true
cargo clippy --locked -p xtask-check --all-targets -- -D warnings

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: xtask/check/** changes bypass the format gate.

Problem: scripts/ci-changes.mjs:27 routes these files to static and xtask, so needs.changes.outputs.rust is false. The only format check, cargo fmt --all -- --check --config error_on_line_overflow=true at .github/workflows/ci.yml:202, is guarded by if: needs.changes.outputs.rust == 'true' at line 198. This job does not run it.

Failure scenario: a PR edits only xtask/check/src/boundaries.rs and leaves an unformatted line. All PR checks pass. After merge, the main push selects every group for the non-documentation path, verify runs the format step, and main turns red.

Evidence: .github/workflows/ci.yml:198, :202, :95-99; scripts/ci-changes.mjs:27; docs/architecture/build.md:320.

Fix: add cargo fmt --all -- --check --config error_on_line_overflow=true to this run block. Keeping xtask/check on rust would also restore it, but reintroduces the heavy workspace 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.

Fixed in cf331c5.

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 d50b2be. The static-checks run block still starts with the format gate at .github/workflows/ci.yml:94, scripts/ci-changes.mjs:30 still selects static for xtask/check/**, and ci-ok still needs static-checks at .github/workflows/ci.yml:411.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Still fixed at ab9ea4c. The static-checks run block still starts with the format gate at .github/workflows/ci.yml:94, scripts/ci-changes.mjs:30 still selects static for xtask/check/**, and ci-ok still needs static-checks at .github/workflows/ci.yml:404 (the line moved from 411 after #1949 and #1951 removed ci.yml lines).

cargo test --locked -p xtask-check
cargo run --locked -p xtask-check
windows-cli:
needs: changes
if: needs.changes.outputs.windows == 'true'
Expand Down Expand Up @@ -377,7 +401,7 @@ jobs:
retention-days: 1
ci-ok:
# The one check to require: it passes when every selected job passed and skipped jobs were not needed.
needs: [changes, dependencies, windows-cli, web, verify, macos-native, acp-registry]
needs: [changes, dependencies, static-checks, windows-cli, web, verify, macos-native, acp-registry]
if: always()
runs-on: self-hosted
timeout-minutes: 5
Expand Down
6 changes: 4 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ Run at the workspace root:
| `./dev check` | Daily: formatting and Clippy for the CLI and App Server |
| `cargo clippy --workspace --all-targets --locked -- -D warnings` | Before merging |
| `cargo test --workspace --locked` | Before merging |
| `cargo run --locked -p xtask -- check` | After changing capabilities, assembly or crate dependencies |
| `cargo run --locked -p xtask-check` | Pure static repository checks only (crate/module boundaries, plugin docs, `npm/branch-services.d.ts`, plugin locks, comment links, `literal_main`), without compiling business crates |
| `cargo run --locked -p xtask -- check` | After changing capabilities, assembly or crate dependencies (runs `xtask-check` plus runtime-assembled `catalog.md`) |
| `node --test scripts/*.test.mjs` | After changing development or release scripts |
| `cargo build --locked -p dimcode -p dim-app-server && node scripts/tui-tmux/run.mjs` | Before and after changing terminal UI behavior; local only, never in CI ([suite](docs/architecture/tui-e2e.md)) |

Expand All @@ -94,7 +95,8 @@ Assembly graphs and crate dependencies are computed from the actual code by `xta
| --- | --- |
| `cargo run --locked -p xtask -- graph` | Regenerate `docs/architecture/rust-agent/generated/`: `services.mmd` / `services.md` (service assembly), `instances.mmd` (instance keys), `crates.mmd` (crate dependencies) and their `.json` snapshots, and `catalog.md` (the service catalog and the parts that are Capabilities) |
| `cargo run --locked -p xtask -- module-graph DIR` | Emit `modules.json` and `modules.mmd` into `DIR` on demand for local inspection without committing them |
| `cargo run --locked -p xtask -- check` | Verify crate and module source boundaries live from code, that `crates.*` under `generated/` match the code (read-only: a stale file fails and names it; only `graph` writes them), that `catalog.md` matches the real assembly, and that `npm/branch-services.d.ts` matches the services marked `#[rutis::service]` |
| `cargo run --locked -p xtask-check` | Run the pure static checks without compiling workspace runtime crates (crate/module boundaries, `crates.*` freshness, plugin pages, `npm/branch-services.d.ts`, plugin locks, comment links, `literal_main`); also supports `module-graph DIR` and `types` |
| `cargo run --locked -p xtask -- check` | Run `xtask-check` plus the runtime-assembled `catalog.md` check against the real App Server assembly |
| `cargo run --locked -p xtask -- types` | Regenerate `npm/branch-services.d.ts`, the TypeScript declarations of the services marked `#[rutis::service]`, after changing one of them or a type it uses |
| `cargo run --release --locked -p xtask -- measure` | Resource measurement; pass `--model-config PATH` (e.g. `crates/dim-agent-aimux/examples/offline.json`) |
| `cargo run --release --locked -p xtask -- context-replay` | Opt-in context memory baseline: 100 mock turns against a temporary SQLite store |
Expand Down
14 changes: 11 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["crates/dim-agent-types", "crates/dim-agent-runtime", "crates/dim-agent-capabilities", "crates/dim-agent-aimux", "crates/dim-agent-attachments", "crates/dim-agent-questions", "crates/dim-agent-scheduler", "crates/dim-event-hub", "crates/dim-app-server", "crates/dim-client", "crates/dim-acp", "crates/dim-cli", "crates/dim-oauth", "crates/dim-session-title", "crates/dim-goal", "crates/dim-report", "crates/dim-codemode", "crates/dim-modality", "crates/dim-image-understanding", "crates/dim-ocr", "crates/dim-modality-aimux", "crates/dimcode", "crates/dim-migration", "xtask", "tests/extension-a", "tests/extension-b", "tests/integration"]
members = ["crates/dim-agent-types", "crates/dim-agent-runtime", "crates/dim-agent-capabilities", "crates/dim-agent-aimux", "crates/dim-agent-attachments", "crates/dim-agent-questions", "crates/dim-agent-scheduler", "crates/dim-event-hub", "crates/dim-app-server", "crates/dim-client", "crates/dim-acp", "crates/dim-cli", "crates/dim-oauth", "crates/dim-session-title", "crates/dim-goal", "crates/dim-report", "crates/dim-codemode", "crates/dim-modality", "crates/dim-image-understanding", "crates/dim-ocr", "crates/dim-modality-aimux", "crates/dimcode", "crates/dim-migration", "xtask", "xtask/check", "tests/extension-a", "tests/extension-b", "tests/integration"]
exclude = ["vendor/grok-build"]

[workspace.package]
Expand Down
4 changes: 2 additions & 2 deletions docs/design/branch-typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ closures stay as they are for Rust callers:
part write, so the branch `Timeline` is exported as is.

Native serde forms stay authoritative (`InputMessageData`, `BranchOptions`, `TimelineInfo`,
`AgentEvent`). `AgentEvent`'s TypeScript is declared in [`xtask types`](../../xtask/src/types.rs) with the `npm/plugin.d.ts` shape,
`AgentEvent`). `AgentEvent`'s TypeScript is declared in [`xtask types`](../../xtask/check/src/types.rs) with the `npm/plugin.d.ts` shape,
because its sequence fields use custom serde. Sequences cross as `number | bigint`; do not coerce
them through `Number`.

Expand Down Expand Up @@ -203,5 +203,5 @@ Existing C4 tools, methods, observation and Settings flows keep their own `node_
- [Dispatcher](../../crates/dim-agent-runtime/src/core/dispatcher.rs), [Timeline](../../crates/dim-agent-runtime/src/core/timeline.rs), [TimelineIdentity and BranchLifecycle](../../crates/dim-agent-runtime/src/config.rs)
- [TimelineTree / TreeCommands](../../crates/dim-agent-capabilities/src/timeline_tree.rs)
- [InputQueue rebuild](../../crates/dim-agent-capabilities/src/input_queue.rs)
- [Declaration generator](../../xtask/src/types.rs) and [row placement](../../crates/dim-app-server/src/session_typescript.rs)
- [Declaration generator](../../xtask/check/src/types.rs) and [row placement](../../crates/dim-app-server/src/session_typescript.rs)
- [Goal consumer contracts](plugins/Goal.md)
2 changes: 1 addition & 1 deletion docs/release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ release packages use the ordinary Cargo executable.

`ci.yml` runs on pull requests, pushes to `main`, and manual dispatch. A pull request runs the groups its changed paths need, as decided by `scripts/ci-changes.mjs`. A push to `main` runs only `changes` and `ci-ok` when its entire push range changes only documentation paths that select no check group. Architecture pages checked by `xtask` and the native storage format document retain the full main run, as do mixed pushes and pushes whose base cannot be compared. Manual dispatch selects every group. Every push to `main` runs its selected jobs to completion: a later push does not cancel them, so each merge has its own result and the `main CI` badge in the [README](../../README.md) reports the latest finished one.

CI builds the workspace, checks formatting and Clippy, runs workspace tests and boundary checks, runs the packaging/development script tests, and exercises the ignored actual CLI profile and public Node-backed flows. `ci-ok` passes when every selected gating job passes, so it is the check to require. CI builds without debug info (`CARGO_PROFILE_DEV_DEBUG=0`). The [build environment](../architecture/build.md) describes test artifact reuse, concurrency limits, and target deadlines. Cargo runs documentation tests with the same features, and ignored CLI and Node flows reuse the recorded binaries without package-scoped recompilation. Web source changes also run the `xtask` check, which reads them for branch id literals. Node-backed checks run for runtime, binding and service-contract paths, and CLI-only changes retain their ordinary and actual-profile flows. Evaluation tests use `xtask/eval-tests` for `xtask/` changes, and the wall-clock handoff runs for execution-related changes. PRs run `verify (linux)` for the selected groups. Rust changes also run `macos-native` on Apple Silicon, and changes affecting native packaging or code layout select its macOS script checks. Both jobs feed `ci-ok`. Full `main` pushes run `verify (macos)`, and manual dispatch runs full verification on both Linux and macOS. The `web` job runs on self-hosted Windows x64. It stages the frontend package, verifies generated declarations and bundled dependency notices, and runs the Web tests.
CI builds the workspace, checks formatting and Clippy, runs workspace tests and boundary checks, runs the packaging/development script tests, and exercises the ignored actual CLI profile and public Node-backed flows. `ci-ok` passes when every selected gating job passes, so it is the check to require. CI builds without debug info (`CARGO_PROFILE_DEV_DEBUG=0`). The [build environment](../architecture/build.md) describes test artifact reuse, concurrency limits, and target deadlines. Cargo runs documentation tests with the same features, and ignored CLI and Node flows reuse the recorded binaries without package-scoped recompilation. Web source changes, plugin pages and static generated graphs run the lightweight `static-checks` job (`xtask-check`) on Linux x64 without compiling business runtime crates, while `catalog.md` changes retain the runtime-assembled `xtask` check. Node-backed checks run for runtime, binding and service-contract paths, and CLI-only changes retain their ordinary and actual-profile flows. Evaluation tests use `xtask/eval-tests` for `xtask/` changes, and the wall-clock handoff runs for execution-related changes. PRs run `verify (linux)` for the selected groups. Rust changes also run `macos-native` on Apple Silicon, and changes affecting native packaging or code layout select its macOS script checks. Both jobs feed `ci-ok`. Full `main` pushes run `verify (macos)`, and manual dispatch runs full verification on both Linux and macOS. The `web` job runs on self-hosted Windows x64. It stages the frontend package, verifies generated declarations and bundled dependency notices, and runs the Web tests.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

P3 (optional): the preceding sentence at line 181 still says "Architecture pages checked by xtask", but this sentence now sends plugin pages and static generated graphs to static-checks (xtask-check), leaving only catalog.md to the runtime-assembled xtask check.

Failure scenario: a maintainer reading this guide to find the job that failed for a plugin-page PR follows line 181 and inspects verify instead of static-checks.

Evidence: docs/release/README.md:181; scripts/ci-changes.mjs:5-6 (plugins|generated maps to static); .github/workflows/ci.yml:75-97.

Fix: say "Architecture pages that select a check group" or "Architecture pages checked by xtask or xtask-check".

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Still present at d50b2be. docs/release/README.md:181 still says architecture pages are checked by xtask; the merge of main did not change this paragraph. Optional P3, not blocking.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Still present at ab9ea4c, optional P3. docs/release/README.md:181 still says architecture pages are checked by xtask, while :183 sends plugin pages and static generated graphs to static-checks on pull requests. The sentence is scoped to pushes to main, where the full run still executes the xtask step, so it is not false. Non-blocking; naming both jobs would be clearer, and this can be closed if the current split is intended.


The `Verify Python plugins` step is off by default. When a Python plugin ships, set the repository Actions variable `DIM_CI_PYTHON_PLUGINS` to `true` to run it whenever the Node check group is selected. It prepares CPython for the `python_plugin_` flows and reuses the App Server test binary from the workspace build. See the [App Server verification commands](../../crates/dim-app-server/README.md#verification) to run the suites locally.

Expand Down
8 changes: 5 additions & 3 deletions scripts/ci-changes.mjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import {execFileSync,spawnSync} from 'node:child_process';
import {appendFileSync} from 'node:fs';

export const groups=['rust','windows','xtask','node','eval','execution','web','scripts','macos_scripts','dependencies'];
export const groups=['rust','windows','static','xtask','node','eval','execution','web','scripts','macos_scripts','dependencies'];
const everything=Object.fromEntries(groups.map(group=>[group,true]));
const documentation=/^docs\/|^[^/]+\.md$/;

const rules=[
[/^benchmarks\/baselines\/[^/]+\.json$/,[]],
[/^docs\/architecture\/rust-agent\/(plugins|generated)\//,['xtask']],
[/^docs\/architecture\/rust-agent\/generated\/catalog\.md$/,['xtask']],
[/^docs\/architecture\/rust-agent\/(plugins|generated)\//,['static']],
[/^docs\/design\/appserver\/native-storage-format\.md$/,['rust']],
// The ADR check runs in the changes job; docs alone need no build group.
[documentation,[]],
[/^deny\.toml$|^LICENSE$/,['dependencies']],
[/^web\/src\/features\/chat\/quote-cases\.json$/,['web','rust','windows']],
[/^web\/src\/.*\.(ts|vue|mjs|js)$/,['web','xtask']],
[/^web\/src\/.*\.(ts|vue|mjs|js)$/,['web','static']],
[/^web\//,['web']],
[/^scripts\/run-rust-test\.mjs$/,groups],
[/^scripts\/test-macos-native(?:\.test)?\.mjs$/,['rust','scripts','web']],
Expand All @@ -26,6 +27,7 @@ const rules=[
[/^crates\/dimcode\//,['rust']],
[/^crates\/dim-agent-capabilities\/src\/(background_exec|workspace_tools\/exec|host_platform)/,['rust','node','execution']],
[/^tests\/integration\/tests\/(local_execution|local_support|minimal_execution)/,['rust','node','execution']],
[/^xtask\/check\//,['static','xtask']],
[/^xtask\//,['rust','node','eval']],
[/^(crates|tests|vendor|runtime|npm)\//,['rust','node']],
];
Expand Down
9 changes: 6 additions & 3 deletions scripts/ci-changes.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ test('documentation-only changes need no build group',()=>{
});

test('documents that code reads keep their checks',()=>{
assert.deepEqual(classify(['docs/architecture/rust-agent/plugins/goal.md']),only('xtask'));
assert.deepEqual(classify(['docs/architecture/rust-agent/plugins/goal.md']),only('static'));
assert.deepEqual(classify(['docs/architecture/rust-agent/generated/crates.mmd']),only('static'));
assert.deepEqual(classify(['docs/architecture/rust-agent/generated/catalog.md']),only('xtask'));
assert.deepEqual(classify(['docs/design/appserver/native-storage-format.md']),only('rust'));
});

test('Web sources that xtask reads keep its check',()=>{
test('Web sources that static checks read avoid the heavy xtask build',()=>{
for (const file of ['web/src/main.ts','web/src/chat-ui/WebChatTimeline.vue','web/src/rpc/protocol.ts','web/src/a.mjs','web/src/a.js'])
assert.deepEqual(classify([file]),only('web','xtask'),file);
assert.deepEqual(classify([file]),only('web','static'),file);
});

test('dependency policy changes select the scan without compiling the workspace',()=>{
Expand Down Expand Up @@ -67,6 +69,7 @@ test('bridge, evaluation and wall-clock flows follow their owning paths',()=>{
assert.deepEqual(classify(['crates/dim-cli/src/ui/tui.rs']),only('rust','windows'));
assert.deepEqual(classify(['crates/dimcode/tests/cli_flow/models.rs']),only('rust'));
assert.deepEqual(classify(['crates/dim-agent-types/src/tool.rs']),only('rust','windows','node'));
assert.deepEqual(classify(['xtask/check/src/literal_main.rs']),only('static','xtask'));
assert.deepEqual(classify(['xtask/src/scenario_eval.rs']),only('rust','node','eval'));
assert.deepEqual(classify(['xtask/scenario-eval/case.json']),only('rust','node','eval'));
assert.deepEqual(classify(['crates/dim-agent-capabilities/src/workspace_tools/exec.rs']),only('rust','node','execution'));
Expand Down
5 changes: 1 addition & 4 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ dim-agent-types.workspace = true
dim-client.workspace = true
rutis.workspace = true
rutis-bridge.workspace = true
rutis-types = "0.23.0"
rutis-loader.workspace = true
tokio.workspace = true
tokio-util.workspace = true
serde.workspace = true
serde_json.workspace = true
futures-util.workspace = true
syn = { version = "2", features = ["full", "visit"] }
# The literal-main rule reads a literal's line from its span.
proc-macro2 = { version = "1", features = ["span-locations"] }
xtask-check = { path = "check" }
axum = { workspace = true, features = ["json"] }
# The run child's process group: a cancelled run kills the group, so the
# Node plugin runtimes it started go with it. std starts the group
Expand Down
16 changes: 16 additions & 0 deletions xtask/check/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "xtask-check"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
publish = false

[dependencies]
proc-macro2 = { version = "1", features = ["span-locations"] }
rutis-types = "0.23.0"
serde_json.workspace = true
syn = { version = "2", features = ["full", "visit"] }

[lints]
workspace = true
Loading