feat(ci): implement change detection in CI workflow to optimize job e…#1306
feat(ci): implement change detection in CI workflow to optimize job e…#1306
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds a Change Detection job that emits per-area flags and gates downstream CI jobs (engine, SDKs, Motia, console) based on those flags and event type; also updates matrices, enables formatting checks, cache save-always, artifact compression tweaks, and parallelizes several build/test jobs. Changes
Sequence Diagram(s)sequenceDiagram
participant PR as Pull Request / Push
participant Runner as GitHub Runner
participant Detect as Detect Changes job
participant Orchestrator as Job Orchestrator (needs/conditions)
participant Engine as Engine Jobs
participant SDKs as SDK/Motia/Console Jobs
participant Cache as Cache / Artifacts
PR->>Runner: trigger workflow
Runner->>Detect: run path filters, compute booleans
Detect-->>Orchestrator: emit outputs (engine, sdk_node, sdk_python, sdk_rust, motia_js, motia_py, console, needs_engine)
Orchestrator->>Engine: conditionally start (if engine || push/main)
Orchestrator->>SDKs: conditionally start per-output (sdk_node, sdk_python, ...)
Engine->>Cache: use/save caches (save-always)
SDKs->>Cache: use/save caches
Engine->>Cache: upload artifacts (compression-level=0)
SDKs->>Cache: upload artifacts
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 68-76: The CI path filters for the Motia jobs (motia_js and
motia_py) currently list directories like 'frameworks/motia/motia-js/**',
'sdk/packages/node/**', and '.github/workflows/ci.yml' but omit 'scripts/**', so
changes to scripts/start-iii.sh or scripts/stop-iii.sh can incorrectly skip
motia-js-ci and motia-py-ci; update the motia_js and motia_py path filter
entries to include 'scripts/**' (and apply the same addition to the other
similar motia blocks referenced in the comment) so the Motia jobs run when
script files change.
- Around line 108-109: The CI workflow uses the Swatinem/rust-cache@v2 action
with an invalid input key `save-always`; update each occurrence to the correct
input name `save-if` so the action functions as intended (replace `save-always:
true` with `save-if: true` in the Swatinem/rust-cache@v2 steps referenced in the
diff).
| motia_js: | ||
| - 'frameworks/motia/motia-js/**' | ||
| - 'sdk/packages/node/**' | ||
| - 'pnpm-lock.yaml' | ||
| - '.github/workflows/ci.yml' | ||
| motia_py: | ||
| - 'frameworks/motia/motia-py/**' | ||
| - 'sdk/packages/python/**' | ||
| - '.github/workflows/ci.yml' |
There was a problem hiding this comment.
Include scripts/** in Motia filters to avoid false skips.
motia-js-ci and motia-py-ci both depend on scripts/start-iii.sh / scripts/stop-iii.sh, but motia_js and motia_py filters (Lines 68-76) don’t watch scripts/**. A PR that only changes scripts can skip Motia tests incorrectly.
Proposed patch
motia_js:
- 'frameworks/motia/motia-js/**'
- 'sdk/packages/node/**'
+ - 'scripts/**'
- 'pnpm-lock.yaml'
- '.github/workflows/ci.yml'
motia_py:
- 'frameworks/motia/motia-py/**'
- 'sdk/packages/python/**'
+ - 'scripts/**'
- '.github/workflows/ci.yml'Also applies to: 425-439, 484-497
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/ci.yml around lines 68 - 76, The CI path filters for the
Motia jobs (motia_js and motia_py) currently list directories like
'frameworks/motia/motia-js/**', 'sdk/packages/node/**', and
'.github/workflows/ci.yml' but omit 'scripts/**', so changes to
scripts/start-iii.sh or scripts/stop-iii.sh can incorrectly skip motia-js-ci and
motia-py-ci; update the motia_js and motia_py path filter entries to include
'scripts/**' (and apply the same addition to the other similar motia blocks
referenced in the comment) so the Motia jobs run when script files change.
| with: | ||
| save-always: true |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
curl -fsSL https://raw.githubusercontent.com/Swatinem/rust-cache/v2/action.yml \
| sed -n '/^inputs:/,/^runs:/p'Repository: iii-hq/iii
Length of output: 2962
🏁 Script executed:
cat -n .github/workflows/ci.yml | sed -n '105,115p; 156,165p; 193,205p; 352,360p; 529,540p'Repository: iii-hq/iii
Length of output: 1676
Replace invalid rust-cache input save-always with save-if.
save-always is not a valid input for Swatinem/rust-cache@v2. The correct input is save-if, which has the same intended behavior.
Proposed patch
- uses: Swatinem/rust-cache@v2
with:
- save-always: true
+ save-if: trueApply to all 5 occurrences: lines 109, 160, 198, 356, 533.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| with: | |
| save-always: true | |
| with: | |
| save-if: true |
🧰 Tools
🪛 actionlint (1.7.11)
[error] 109-109: input "save-always" is not defined in action "Swatinem/rust-cache@v2". available inputs are "add-job-id-key", "add-rust-environment-hash-key", "cache-all-crates", "cache-bin", "cache-directories", "cache-on-failure", "cache-provider", "cache-targets", "cache-workspace-crates", "env-vars", "key", "lookup-only", "prefix-key", "save-if", "shared-key", "workspaces"
(action)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/ci.yml around lines 108 - 109, The CI workflow uses the
Swatinem/rust-cache@v2 action with an invalid input key `save-always`; update
each occurrence to the correct input name `save-if` so the action functions as
intended (replace `save-always: true` with `save-if: true` in the
Swatinem/rust-cache@v2 steps referenced in the diff).
| sdk_node: | ||
| - 'sdk/packages/node/**' | ||
| - 'sdk/fixtures/**' | ||
| - 'scripts/**' | ||
| - 'pnpm-lock.yaml' | ||
| - '.github/workflows/ci.yml' | ||
| sdk_python: | ||
| - 'sdk/packages/python/**' | ||
| - 'sdk/fixtures/**' | ||
| - 'scripts/**' | ||
| - '.github/workflows/ci.yml' | ||
| sdk_rust: | ||
| - 'sdk/packages/rust/**' | ||
| - 'sdk/fixtures/**' | ||
| - 'scripts/**' | ||
| - 'Cargo.toml' | ||
| - 'Cargo.lock' | ||
| - '.github/workflows/ci.yml' |
There was a problem hiding this comment.
let's include engine in these, we want to run the tests in all sdk even if we change 1 line in engine
| console: | ||
| - 'console/**' | ||
| - 'pnpm-lock.yaml' | ||
| - '.github/workflows/ci.yml' |
There was a problem hiding this comment.
let's include
- sdk_rust
- engine
| name: SDK Node Tests | ||
| needs: build-engine | ||
| needs: [changes, build-engine] | ||
| if: github.event_name != 'pull_request' || needs.changes.outputs.sdk_node == 'true' |
There was a problem hiding this comment.
are we skipping in pull requests?
…xecution based on modified paths
0e7839d to
8f89124
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (3)
.github/workflows/ci.yml (3)
109-109:⚠️ Potential issue | 🔴 CriticalReplace invalid
save-alwayswithsave-ifin all rust-cache steps.At Line [109], Line [159], Line [197], Line [355], and Line [532],
Swatinem/rust-cache@v2is configured with an unsupported input key. This can break the cache step contract.Proposed patch
- uses: Swatinem/rust-cache@v2 with: - save-always: true + save-if: trueApply this replacement to all 5 occurrences.
#!/bin/bash # Read-only verification: ensure no invalid rust-cache input remains rg -n 'save-always|save-if' .github/workflows/ci.ymlAlso applies to: 159-159, 197-197, 355-355, 532-532
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml at line 109, Replace the unsupported input key "save-always" with the correct "save-if" for every Swatinem/rust-cache@v2 step; search for occurrences of the key "save-always" used alongside "Swatinem/rust-cache@v2" and update each to "save-if" so the cache step contract is valid (ensure you modify all five occurrences where the action is used).
50-67:⚠️ Potential issue | 🟠 MajorEngine-only PRs currently skip SDK test suites.
At Line [50]-Line [67],
sdk_node,sdk_python, andsdk_rustfilters don’t include engine paths. With current job conditions (Line [218], Line [283], Line [344]), an engine-only PR sets SDK flags tofalse, so SDK integration jobs are skipped.Proposed patch
sdk_node: + - 'engine/**' - 'sdk/packages/node/**' - 'sdk/fixtures/**' - 'scripts/**' - 'pnpm-lock.yaml' - '.github/workflows/ci.yml' sdk_python: + - 'engine/**' - 'sdk/packages/python/**' - 'sdk/fixtures/**' - 'scripts/**' - '.github/workflows/ci.yml' sdk_rust: + - 'engine/**' - 'sdk/packages/rust/**' - 'sdk/fixtures/**' - 'scripts/**' - 'Cargo.toml' - 'Cargo.lock' - '.github/workflows/ci.yml'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml around lines 50 - 67, The SDK path filters for the sdk_node, sdk_python, and sdk_rust matrix entries omit engine files so engine-only PRs set SDK flags to false and skip SDK integration jobs; update each matrix entry (sdk_node, sdk_python, sdk_rust) to also include the engine-related paths (e.g., 'engine/**' or whatever repository subpath contains engine code) so that changes under the engine will flip the SDK flags true and run the corresponding SDK jobs that use those flags (ensure you modify the arrays for sdk_node, sdk_python, and sdk_rust in the matrix block to include the engine path pattern).
68-76:⚠️ Potential issue | 🟠 MajorInclude
scripts/**in Motia path filters to prevent false skips.
motia-js-ciandmotia-py-ciexecute shell scripts (see Line [427], Line [438], Line [486], Line [496]), butmotia_js/motia_pyfilters at Line [68]-Line [76] don’t watchscripts/**. Script-only PRs can incorrectly skip these jobs.Proposed patch
motia_js: - 'frameworks/motia/motia-js/**' - 'sdk/packages/node/**' + - 'scripts/**' - 'pnpm-lock.yaml' - '.github/workflows/ci.yml' motia_py: - 'frameworks/motia/motia-py/**' - 'sdk/packages/python/**' + - 'scripts/**' - '.github/workflows/ci.yml'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml around lines 68 - 76, The motia_js and motia_py path filters in .github/workflows/ci.yml are missing scripts/**, causing script-only PRs to skip motia-js-ci and motia-py-ci; update the motia_js and motia_py arrays (the entries labeled motia_js and motia_py in the CI YAML) to add 'scripts/**' alongside the existing path globs so the workflow detects changes to shell scripts and doesn't falsely skip those jobs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 81-89: The needs_engine job filter is missing pnpm-lock.yaml which
allows lockfile-only PRs to match sdk_node/motia_js and skip build-engine;
update the needs_engine entries (the needs_engine block) to include
"pnpm-lock.yaml" so changes to the lockfile trigger build-engine as intended;
verify related jobs build-engine, sdk_node, and motia_js still reference the
same filters after adding pnpm-lock.yaml.
---
Duplicate comments:
In @.github/workflows/ci.yml:
- Line 109: Replace the unsupported input key "save-always" with the correct
"save-if" for every Swatinem/rust-cache@v2 step; search for occurrences of the
key "save-always" used alongside "Swatinem/rust-cache@v2" and update each to
"save-if" so the cache step contract is valid (ensure you modify all five
occurrences where the action is used).
- Around line 50-67: The SDK path filters for the sdk_node, sdk_python, and
sdk_rust matrix entries omit engine files so engine-only PRs set SDK flags to
false and skip SDK integration jobs; update each matrix entry (sdk_node,
sdk_python, sdk_rust) to also include the engine-related paths (e.g.,
'engine/**' or whatever repository subpath contains engine code) so that changes
under the engine will flip the SDK flags true and run the corresponding SDK jobs
that use those flags (ensure you modify the arrays for sdk_node, sdk_python, and
sdk_rust in the matrix block to include the engine path pattern).
- Around line 68-76: The motia_js and motia_py path filters in
.github/workflows/ci.yml are missing scripts/**, causing script-only PRs to skip
motia-js-ci and motia-py-ci; update the motia_js and motia_py arrays (the
entries labeled motia_js and motia_py in the CI YAML) to add 'scripts/**'
alongside the existing path globs so the workflow detects changes to shell
scripts and doesn't falsely skip those jobs.
| needs_engine: | ||
| - 'engine/**' | ||
| - 'cli/**' | ||
| - 'sdk/**' | ||
| - 'frameworks/motia/**' | ||
| - 'scripts/**' | ||
| - 'Cargo.toml' | ||
| - 'Cargo.lock' | ||
| - '.github/workflows/ci.yml' |
There was a problem hiding this comment.
Add pnpm-lock.yaml to needs_engine to avoid dependency-induced skips.
needs_engine at Line [81]-Line [89] omits pnpm-lock.yaml, but sdk_node/motia_js include it (Line [54], Line [71]) and both jobs require build-engine (Line [217], Line [391]). A lockfile-only PR can satisfy SDK/Motia filters while build-engine is skipped, causing downstream jobs to skip.
Proposed patch
needs_engine:
- 'engine/**'
- 'cli/**'
- 'sdk/**'
- 'frameworks/motia/**'
- 'scripts/**'
+ - 'pnpm-lock.yaml'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/ci.yml'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/ci.yml around lines 81 - 89, The needs_engine job filter
is missing pnpm-lock.yaml which allows lockfile-only PRs to match
sdk_node/motia_js and skip build-engine; update the needs_engine entries (the
needs_engine block) to include "pnpm-lock.yaml" so changes to the lockfile
trigger build-engine as intended; verify related jobs build-engine, sdk_node,
and motia_js still reference the same filters after adding pnpm-lock.yaml.
…xecution based on modified paths
Summary by CodeRabbit
Chores
Tests