Skip to content

Widen CI: dev pushes, mne on macOS, weekly slow run - #290

Merged
neuromechanist merged 8 commits into
devfrom
feature/issue-246-ci-widening
Aug 23, 2026
Merged

neuromechanist merged 8 commits into
devfrom
feature/issue-246-ci-widening

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Aug 23, 2026 •

Copy link
Copy Markdown
Member

Summary

ci.yml now triggers on push to dev as well as main, so post-merge drift on the integration branch is caught immediately (issue #241's precedent: a fix that was green on the PR failed right after landing on dev).
The existing concurrency group already cancels a superseded run on the same ref, so no separate change was needed there.
The test-macos job installs --extra mne alongside --extra mlx, so pamica/tests/mne_tests (the AMICAICA/MNE wrapper) now runs against Accelerate as well as Linux/OpenBLAS.
A new schedule-only weekly-macos-slow.yml workflow runs the full suite on macOS every Sunday (plus manual workflow_dispatch), including @pytest.mark.slow tests and the Fortran-parity tests, none of which had ever run in CI before.
.rules/ci_cd.md and docs/changelog.md are updated to describe the new topology.

What each trigger/job now covers

ci.yml (pull_request + push to main/dev): lint -> typecheck -> test (Linux, -m "not slow", coverage-gated) -> test-macos (Apple Silicon, --extra mlx --extra mne, -m "not slow") -> test-mne (Linux, --extra mne) -> build (sdist/wheel import matrix).
weekly-macos-slow.yml (Sunday cron + workflow_dispatch only, never push/pull_request): full suite, no -m filter, on macOS.

Parity-test gating wired for the weekly job

run_fortran_amica's default binary_path=None resolves via PAMICA_NATIVE_BINARY (pamica/native/resolver.py), which the job sets by building the dependency-free native engine (native/build.sh, same recipe ci.yml's test-macos job already uses) -- this unlocks the slow end-to-end parity tests in test_ng_backend.py and, combined with AMICA_RUN_FORTRAN=1, the opt-in test_ng_pdf_families.py::test_family_converged_ll_matches_fortran.
test_fortran_adapter.py's three CI-skipped tests gate on a separate env var, AMICA_FORTRAN_BIN, which wants a different native build (benchmarks/fortran/build_amica.sh, a real mpif90 single-rank singleton, per benchmarks/fortran/README.md) -- the job builds that too and points AMICA_FORTRAN_BIN at it.
Neither native build needs Rosetta: both compile amica15.f90/funmod2.f90 from source for the runner's own arm64, unlike the legacy bundled pamica/sample_data/amica15mac fixture (x86_64-only), which nothing in CI runs.

Review follow-ups (addressed in this branch)

  1. push:[main, dev] + auto-bump-dev.yml self-cancel. The bot's version-bump push to dev (deliberately PAT-authored so it triggers workflows) was landing in the same ci.yml concurrency group as the just-merged commit's run and cancelling it -- so a merge to dev would show "cancelled" on the real commit and test the trivial bump commit instead, doubling compute and misattributing the green check. Fixed in two layers: (a) the concurrency group now keys on github.sha for push events instead of github.ref (pull_request keeps ref-based grouping, so rapid PR pushes still supersede each other), so every commit landing on main/dev gets its own group and a later push can never cancel an earlier commit's run -- the bot's bump push cannot land in the merge commit's group at all, closing the cancellation gap completely; (b) lint/typecheck also carry the same author-email + Bump version to message-prefix if: guard auto-bump-dev.yml/auto-tag.yml already use on themselves, with every other job needs-ing one of those two so the skip cascades to the whole run -- with (a) in place this now only saves compute (the bump run no-ops instantly) rather than preventing a cancellation. Documented in ci.yml's header and .rules/ci_cd.md.
  2. Weekly job failure visibility. weekly-macos-slow.yml is the repo's only scheduled workflow; on failure GitHub only emails whoever last edited the schedule, and silently disables it after 60 days of repo inactivity. Added an if: failure() step (actions/github-script) that opens (or comments on, to avoid a fresh issue every week) a tracking issue titled "Weekly macOS slow run failed" linking the run. The workflow header now also notes the 60-day auto-disable so a future reader knows to check for it and re-enable via the Actions tab or gh workflow enable weekly-macos-slow.yml.
  3. timeout-minutes: 180 is a first estimate. Noted as such in the workflow header (full suite + two from-source native builds + slow/parity tests, revisit against the actual wall-clock once a real run has completed). I'll dispatch a manual workflow_dispatch run once this PR is merged to get that first real number rather than guessing further.

Deviations

None from the brief. One correction worth flagging: the issue's own comment worried the bit-exact parity tests "need Rosetta" -- that turned out not to apply to anything actually gated in CI. run_fortran_amica already prefers the native (arm64-buildable) engine over the legacy x86_64 fixture (issue #228), so wiring PAMICA_NATIVE_BINARY + AMICA_FORTRAN_BIN was sufficient; no Rosetta step was added or needed.

Test plan

  • YAML syntax validated (python -c "import yaml; yaml.safe_load(...)", uvx yamllint, and actionlint) on both changed/new workflow files, after every round of edits.
  • Cron field structure checked by hand (0 6 * * 0 = Sunday 06:00 UTC).
  • uv run ruff check . / uv run ruff format --check . / uv run ty check . all clean (no Python files touched).
  • uv run pytest -m "not slow" -n auto --cov-fail-under=80: 417 passed, 25 skipped, 1 xfailed, coverage 86.55% -- reran clean after the review-fix commits too.
  • The macOS mne extra, the weekly job's failure-issue step, and the bot-bump skip guard can only be fully verified by GitHub-hosted runners/real trigger events (not reproducible locally or via act for the macOS case); will confirm once this PR's own test-macos job runs and after the post-merge workflow_dispatch mentioned above.

Closes #246

Adds push:dev alongside existing push:main/pull_request so post-merge
drift on the integration branch is caught. macOS job now installs
--extra mne too, so the AMICAICA/MNE tests run against Accelerate.
Schedule-only (Sunday cron, plus workflow_dispatch) job on macOS that
runs the full suite with no -m filter: slow tests, and the
Fortran-parity tests gated on PAMICA_NATIVE_BINARY/AMICA_RUN_FORTRAN/
AMICA_FORTRAN_BIN, none of which ran in CI before. Never triggers on
push/pull_request, so it cannot block or slow a PR.
.rules/ci_cd.md gets a project-specific topology section describing
the actual workflows; docs/changelog.md gets an Unreleased bullet
summarizing the dev-push trigger, macOS mne coverage, and the new
weekly full-suite job.
auto-bump-dev.yml/auto-tag.yml push a version-bump commit straight
back to dev/main, which lands in ci.yml's own concurrency group and
would cancel the real merge commit's in-progress run then test the
trivial bump commit instead. lint/typecheck now skip on the same
author-email + message-prefix guard those two workflows already use
on themselves; every other job needs one of them, so the skip
cascades to the whole run.
Open (or comment on) a tracking issue on failure via
actions/github-script: this is the repo's only scheduled workflow,
and GitHub's default notification (an email to whoever last edited
the schedule) is otherwise the only signal. Header now also notes
GitHub's 60-day schedule auto-disable and that timeout-minutes: 180
is a first estimate pending an actual run.
.rules/ci_cd.md's topology section now covers the auto-bump-dev.yml/
auto-tag.yml interaction guard on ci.yml and the weekly job's
failure-tracking issue, timeout caveat, and 60-day auto-disable note.
Groups push events by github.sha instead of github.ref, so every
commit landing on main/dev gets its own concurrency group and pushes
never cancel each other. This closes the residual gap in the prior
bot-bump fix: auto-bump-dev.yml/auto-tag.yml's follow-up push could
still land in the same ref-keyed group as the merge commit's run and
cancel it, even though the if: guard made that run a no-op. pull_
request keeps ref-based grouping (rapid PR pushes still supersede
each other).
Updates the bot-bump interaction passage: per-SHA grouping means the
bump push can never land in the merge commit's concurrency group, so
the if: guard now only saves compute rather than preventing a
cancellation.
@neuromechanist
neuromechanist merged commit 26aa9c7 into dev Aug 23, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-246-ci-widening branch August 23, 2026 22:27
@neuromechanist neuromechanist mentioned this pull request Aug 25, 2026
neuromechanist added a commit that referenced this pull request Aug 25, 2026
From the PR #301 code-review pass: record the params-file backend
divergence (wrapper-only Fortran reader; numpy params_file stays
JSON-only, MLX has none) in the amica-differences backend table with
the decision tracked as #304; add a cross-backend tuner-defaults
agreement test so a drifted do_opt_block/blk_* default fails CI (the
restart-policy pattern); list the three shared policy modules in
AGENTS.md's architecture map and add AMICANative to its import-surface
line; point the stale MLX-gaps sentences (AGENTS.md and
backend_parity.md) at epic #278; widen typos.yml to dev pushes to
match ci.yml's #290 change; and document the do_opt_block/blk_* pass-
through in AMICA.fit's kwargs docstring. Tested: test_blocktune.py
43 passed; ruff and ty clean.
neuromechanist added a commit that referenced this pull request Aug 25, 2026
* Narrow numpy restart catch to LinAlgError

The multi-restart loop also caught bare RuntimeError, copied from the
torch/MLX loops where their linalg genuinely fails that way; numpy's fit
path has no RuntimeError-raising numeric failure, so the broad catch
could only swallow programming bugs as degenerate restarts. Covered by
the existing LinAlgError injection test; suite green.

* Refuse empty Fortran param files

read_fortran_param_file returned {} for an empty or comment-only file
(the zero-recognized guard short-circuited on content_lines == 0), so a
truncated or accidentally cleared input.param silently produced an
all-defaults run. Now a named ValueError, format-independent. Replaces
the test pinning the old behavior and adds a comment-only case; tested.

* Log skipped memory-cap queries at DEBUG

The three device-memory probes and host_memory_bytes disabled the
block-size tuner's memory cap silently on any query failure; each now
leaves a DEBUG line naming the exception, matching the logging
discipline of the rest of blocktune. Logging only; suites green.

* Catch Fortran timeout in precision experiment

subprocess.TimeoutExpired escaped the OSError-only catch as a raw
traceback; a hung binary now lands in the same structured
available=False result as every other failure mode. Research script,
not exercised by the suite.

* Test that non-bad annotations reject nothing

Boundary of the reject_by_annotation overlap computation: annotations
present, none bad_*, mask must stay all-True at full sample count.
Real sample EEG; passes.

* Sanction error-injection subclasses in testing rules

Names the pattern three test files already use (raise the trigger
exception at the real call site, everything else real) as an explicit
exception to the no-mock policy, per the release test review.

* Fix doc rot and Fortran citations from release review

Comment-accuracy pass on PR #301: validation.md's from_params_file
detection text matched neither the code nor its docstring (content
sniffing, never the extension); amica-differences row 5 cited ADR 0003
which disclaims that row; the do_opt_block paragraph referenced a
16-60% range and a table that exist nowhere (now cites the validation
guide's measured ~2.3x MPS gap); AGENTS.md cited amica15.f90:1898 (an
MPI_BCAST) for identify_shared_comps (declared at :1916). Standardized
citation ranges against the literal Fortran: 2617-2620 for the
loglik/modloglik allocation, 2231-2234 for the reject_data zeroing
block, and amica15 (the actual reference) lines for the restart-on-NaN
machinery previously cited from amica17. Also documented that the
keep_best guard covers do_reject alongside share_comps, and corrected
amica15_header.f90 line cites (109 is req1/req2, the defaults live at
24/74). Comments and docs only; ruff/format green, touched suites pass.

* Document PDFTYPE_NAMES export; add AMICANative to surface

The mlx_impl PDFTYPE_NAMES re-export (#265) had no doc coverage, and
AGENTS.md's public-import-surface line predated the AMICANative
top-level export. Docs only, from the release code review.

* Address code-review findings on the release delta

From the PR #301 code-review pass: record the params-file backend
divergence (wrapper-only Fortran reader; numpy params_file stays
JSON-only, MLX has none) in the amica-differences backend table with
the decision tracked as #304; add a cross-backend tuner-defaults
agreement test so a drifted do_opt_block/blk_* default fails CI (the
restart-policy pattern); list the three shared policy modules in
AGENTS.md's architecture map and add AMICANative to its import-surface
line; point the stale MLX-gaps sentences (AGENTS.md and
backend_parity.md) at epic #278; widen typos.yml to dev pushes to
match ci.yml's #290 change; and document the do_opt_block/blk_* pass-
through in AMICA.fit's kwargs docstring. Tested: test_blocktune.py
43 passed; ruff and ty clean.
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.

CI runs Linux only: MLX backend and the Apple Silicon numerical path are never tested

1 participant