ci: restore green pipeline and harden CI workflow - #2
Merged
Conversation
Restore a green CI pipeline after the test-coverage expansion commit. - Apply `cargo fmt` to test modules across adapters, config, core, event, and state (no behavior change). - Fix `clippy::field_reassign_with_default` in state::persistence tests by using a struct initializer instead of reassigning fields after Default. - Fix `clippy::useless_format` in adapters::codex test by replacing `format!(r#"..."#)` with a `.to_string()` raw string literal. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Add concurrency control to cancel stale runs on PRs (saves CI minutes). - Scope token permissions to contents:read (least privilege). - Add workflow_dispatch for manual runs. - Add per-job timeouts, colored cargo output, and RUST_BACKTRACE=1. - Gate on `cargo fetch --locked` to catch Cargo.lock drift early. - Add a macOS build job (`cargo build --locked --all-targets`) to validate cross-platform compilation: lint/test run on Linux, but the project targets macOS (notify macos_fsevent, arboard clipboard). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Restores CI stability after a formatting-related break on main and strengthens the CI workflow so it’s both more reliable and more representative of local development checks (bash scripts/dev.sh ci), while adding a macOS compilation gate for cross-platform safety.
Changes:
- Reformats multiple test modules to satisfy
cargo fmt --checkand unblock the pipeline. - Fixes a couple of Clippy warnings in tests (struct init instead of post-
Defaultfield reassignment; removes aformat!that was only wrapping a raw string). - Hardens
.github/workflows/ci.ymlwith concurrency cancellation on PRs, least-privilege permissions, timeouts, lockfile fetch gate, and a macOS build job.
Reviewed changes
Copilot reviewed 5 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/state/persistence.rs |
Test cleanup: fixes clippy lint (field_reassign_with_default) and applies formatting. |
src/event/dispatcher.rs |
Test formatting only. |
src/core/models/state_machine.rs |
Test formatting only. |
src/core/models/git.rs |
Test formatting; minor formatting compaction in commit constructor call. |
src/core/logic/guards.rs |
Test formatting only. |
src/config/saver.rs |
Test import ordering + formatting. |
src/config/loader.rs |
Test formatting only. |
src/adapters/cursor.rs |
Test formatting only. |
src/adapters/codex.rs |
Test formatting; replaces format!(r#"..."#) with raw string .to_string(); minor formatting of async write. |
src/adapters/claudecode.rs |
Test formatting only. |
.github/workflows/ci.yml |
Adds permissions/concurrency/env/timeouts, lockfile fetch gate, workflow_dispatch trigger, and new macOS build gate. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The last
mainpush ("test: expand unit coverage…") broke CI:cargo fmt --checkfailed across the newly added test modules, so the pipeline never reached clippy/tests. This PR restores a green pipeline and improves the workflow itself.What changed
1. Fix the broken pipeline (
fix: format tests and resolve clippy lints)cargo fmtapplied to test modules inadapters/,config/,core/,event/,state/— pure reformatting, no behavior change.clippy::field_reassign_with_defaultinstate::persistencetests (struct initializer instead of post-Defaultreassignment).clippy::useless_formatinadapters::codextest (format!(r#"..."#)→ raw string.to_string()).bash scripts/dev.sh ciis now green locally: 1644 tests pass, 0 failures (incl. doctests).2. Improve the CI workflow (
ci: harden workflow and add macOS build gate)concurrencywithcancel-in-progresson PRspermissions: contents: readworkflow_dispatchtimeout-minutes+RUST_BACKTRACE=1+ colorcargo fetch --lockedgateCargo.lockdrift before buildbuild-macosjob (cargo build --locked --all-targets)notify macos_fsevent,arboard) — this catches cross-platform compile breakageThe primary
checkjob still runsbash scripts/dev.sh ci, preserving the local == CI invariant the tooling is built around.Verification
bash scripts/dev.sh cigreen locally (fmt, clippy-D warnings, all tests)checkandbuild-macosjobs)