Skip to content

feat(ci): implement change detection in CI workflow to optimize job e…#1306

Open
ytallo wants to merge 1 commit intomainfrom
feat/improvement-ci
Open

feat(ci): implement change detection in CI workflow to optimize job e…#1306
ytallo wants to merge 1 commit intomainfrom
feat/improvement-ci

Conversation

@ytallo
Copy link
Contributor

@ytallo ytallo commented Mar 13, 2026

…xecution based on modified paths

Summary by CodeRabbit

  • Chores

    • Optimized CI with conditional and parallel execution to speed up feedback and reduce unnecessary runs.
    • Improved caching and artifact compression for faster, more reliable pipeline performance.
    • Added automated formatting checks to enforce consistent code style.
  • Tests

    • Expanded and parallelized cross-platform test matrices, with targeted PR vs. push behavior to balance coverage and speed.

@vercel
Copy link
Contributor

vercel bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
iii-docs Ready Ready Preview, Comment Mar 15, 2026 1:31am
iii-website Ready Ready Preview, Comment Mar 15, 2026 1:31am
motia-docs Ready Ready Preview, Comment Mar 15, 2026 1:31am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
CI workflow
/.github/workflows/ci.yml
Adds Detect Changes job with path-based outputs (engine, sdk_node, sdk_python, sdk_rust, motia_js, motia_py, console, needs_engine). Downstream jobs now conditionally run based on those outputs and event type (PR vs push). Adjusts matrices (PR vs push), enables cargo fmt --check, sets save-always: true for caches, lowers artifact compression, introduces engine cross-platform builds (push-only), and reorganizes job dependencies and parallelization.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through CI with ears held high,

I sniffed the diffs and watched jobs fly,
Flags set paths where runners should tread,
Caches snug, formats checked ahead,
Parallel leaps — a carrot-fueled sky.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: implementing change detection in the CI workflow to optimize job execution.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/improvement-ci
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c38ec009-7f68-4555-b481-220b9e444730

📥 Commits

Reviewing files that changed from the base of the PR and between bd1459e and 0e7839d.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Comment on lines +68 to +76
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'
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Comment on lines +108 to +109
with:
save-always: true
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 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: true

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

Suggested change
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).

Comment on lines +50 to +67
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'
Copy link
Contributor

Choose a reason for hiding this comment

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

let's include engine in these, we want to run the tests in all sdk even if we change 1 line in engine

Comment on lines +77 to +80
console:
- 'console/**'
- 'pnpm-lock.yaml'
- '.github/workflows/ci.yml'
Copy link
Contributor

Choose a reason for hiding this comment

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

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'
Copy link
Contributor

Choose a reason for hiding this comment

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

are we skipping in pull requests?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (3)
.github/workflows/ci.yml (3)

109-109: ⚠️ Potential issue | 🔴 Critical

Replace invalid save-always with save-if in all rust-cache steps.

At Line [109], Line [159], Line [197], Line [355], and Line [532], Swatinem/rust-cache@v2 is 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: true

Apply 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.yml

Also 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 | 🟠 Major

Engine-only PRs currently skip SDK test suites.

At Line [50]-Line [67], sdk_node, sdk_python, and sdk_rust filters don’t include engine paths. With current job conditions (Line [218], Line [283], Line [344]), an engine-only PR sets SDK flags to false, 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 | 🟠 Major

Include scripts/** in Motia path filters to prevent false skips.

motia-js-ci and motia-py-ci execute shell scripts (see Line [427], Line [438], Line [486], Line [496]), but motia_js / motia_py filters at Line [68]-Line [76] don’t watch scripts/**. 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1c6a8802-d9a7-44b2-9f78-b5aa33e05fdd

📥 Commits

Reviewing files that changed from the base of the PR and between 0e7839d and 8f89124.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Comment on lines +81 to +89
needs_engine:
- 'engine/**'
- 'cli/**'
- 'sdk/**'
- 'frameworks/motia/**'
- 'scripts/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/ci.yml'
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

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.

2 participants