Skip to content

ci: restore green pipeline and harden CI workflow - #2

Merged
guyghost merged 2 commits into
mainfrom
guyghost-improve-ci
Jul 22, 2026
Merged

ci: restore green pipeline and harden CI workflow#2
guyghost merged 2 commits into
mainfrom
guyghost-improve-ci

Conversation

@guyghost

Copy link
Copy Markdown
Owner

Summary

The last main push ("test: expand unit coverage…") broke CI: cargo fmt --check failed 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 fmt applied to test modules in adapters/, config/, core/, event/, state/ — pure reformatting, no behavior change.
  • Fixed clippy::field_reassign_with_default in state::persistence tests (struct initializer instead of post-Default reassignment).
  • Fixed clippy::useless_format in adapters::codex test (format!(r#"..."#) → raw string .to_string()).

bash scripts/dev.sh ci is now green locally: 1644 tests pass, 0 failures (incl. doctests).

2. Improve the CI workflow (ci: harden workflow and add macOS build gate)

Improvement Why
concurrency with cancel-in-progress on PRs Stops stale runs, frees CI minutes
permissions: contents: read Least-privilege token
workflow_dispatch Manual re-runs
Per-job timeout-minutes + RUST_BACKTRACE=1 + color Avoid hung jobs, better diagnostics
cargo fetch --locked gate Catch Cargo.lock drift before build
New build-macos job (cargo build --locked --all-targets) Lint/test run on Linux but the project targets macOS (notify macos_fsevent, arboard) — this catches cross-platform compile breakage

The primary check job still runs bash scripts/dev.sh ci, preserving the local == CI invariant the tooling is built around.

Verification

  • bash scripts/dev.sh ci green locally (fmt, clippy -D warnings, all tests)
  • Workflow YAML validated (structure + triggers + jobs)
  • CI green on this PR (both check and build-macos jobs)

guyghost and others added 2 commits July 22, 2026 11:12
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>
Copilot AI review requested due to automatic review settings July 22, 2026 09:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 --check and unblock the pipeline.
  • Fixes a couple of Clippy warnings in tests (struct init instead of post-Default field reassignment; removes a format! that was only wrapping a raw string).
  • Hardens .github/workflows/ci.yml with 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.

@guyghost
guyghost merged commit ab4395c into main Jul 22, 2026
3 checks passed
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