Conversation
Adds a ``ruff-async-audit`` pre-commit hook scoped to the Phase 0
ASYNC ruleset (3 violations enumerated in
juniper-ml/notes/ASYNC_ROUTE_VIOLATIONS_2026-05-06.md). ``stages:
[manual]`` keeps it from firing on regular commits; on-demand via:
pre-commit run --hook-stage manual ruff-async-audit
Used as a Phase-2 stepping stone — Phase 2 will flip
``stages: [pre-commit, manual]`` and add a soft-fail CI lane so
PRs see violations as annotations without blocking merge.
Phase 4 hard-fails.
The ``--exit-zero`` flag means violations are reported but don't
fail the hook in Phase 1; that's the disabled-state contract.
This is the first of four Phase 1 wiring PRs (one per in-scope
repo). Order per the migration plan: data → cascor → canopy →
worker.
Plan: notes/ASYNC_ROUTE_AUDIT_HOOK_MIGRATION_PLAN.md (juniper-ml)
§4 Phase 1.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Phase 1 wiring of the async-route audit hook (BUG-JD-10 class
prevention) for juniper-data. Adds a ruff-based pre-commit hook
scoped to the `ASYNC` ruleset, stage-restricted to `manual`
so it doesn't fire on regular commits.
First of four Phase 1 wiring PRs. Order per the migration plan
(`ASYNC_ROUTE_AUDIT_HOOK_MIGRATION_PLAN.md`
§4): data → cascor → canopy → worker.
What's added
```yaml
id: ruff
alias: ruff-async-audit
name: Async-route audit (BUG-JD-10 class)
args: [--select, ASYNC, --exit-zero]
files: ^juniper_data/.*\.py$
stages: [manual]
```
`alias: ruff-async-audit` lets us reference the hook
independently of the existing `ruff` and `ruff-format` hooks
for invocation and Phase-2 enablement.
`--exit-zero` means violations are reported but don't fail
the hook in Phase 1 (the disabled-state contract).
No `pyproject.toml` change — `[tool.ruff.lint] select` stays
unchanged so regular runs don't enforce `ASYNC` yet.
No CI workflow change in this PR; CI lane lands in Phase 2.
How to use
```bash
Show the 3 enumerated violations on demand:
pre-commit run --hook-stage manual ruff-async-audit --all-files
```
Verified locally to surface all 3 violations from the Phase 0
enumeration (`juniper_data/api/app.py:46`, `juniper_data/api/routes/health.py:131` and `:132` — all `ASYNC240` pathlib-in-async).
What's next
`[pre-commit, manual]`, add CI lane with
`continue-on-error: true`.
per the Phase 0 doc).
pre-commit stages.
Test plan
surfaces 3 violations (no false positives, no missed sites).
verified by running on `juniper_data/api/routes/health.py`
and confirming only `ruff` and `ruff-format` ran.
🤖 Generated with Claude Code