Skip to content

ci: autofix annotations and lint on pull requests - #122

Merged
jaspermayone merged 6 commits into
mainfrom
chore/route-annotations
Sep 28, 2026
Merged

jaspermayone merged 6 commits into
mainfrom
chore/route-annotations

Conversation

@jaspermayone

@jaspermayone jaspermayone commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Route annotations: adds the missing annotation lines in config/routes.rb (confirm_magic_link and the /profile/emails routes). This fixes annotate_check on main.
  • annotate_check now uses a real database. Before, CI had no Postgres, so annotaterb skipped every model and reported "unchanged". Model drift was never caught. The job now starts postgres:17 and loads the schema.
  • Routes are annotated in development. The committed annotations include dev-only routes (letter_opener, actual_db_schema). A test run would delete them.
  • New Autofix workflow on pull requests from this repo:
    1. Loads the schema into Postgres.
    2. Runs annotaterb models and annotaterb routes.
    3. Runs bin/rubocop -a (safe corrections only).
    4. If files changed, commits chore: autofix annotations and lint to the PR branch as github-actions[bot].
    5. Starts CI for the new commit with workflow_dispatch.
flowchart LR
    P[PR opened or pushed] --> A[Autofix job]
    A --> D{Files changed?}
    D -- no --> E[Done]
    D -- yes --> C[Bot commits fix to PR branch]
    C --> W[workflow_dispatch CI on new commit]
Loading

Limits

  • PRs from forks are skipped, because GITHUB_TOKEN cannot push to a fork.
  • Offenses that RuboCop cannot fix safely still fail lint.
  • The bot commit counts as a new push. The ruleset requires approval of the last push, so approve after the bot commit.
  • GitHub marks pull_request runs for the bot commit as "action required". The dispatched CI run covers that commit.

Test plan

  • Removed one route annotation on purpose. Autofix restored exactly that line (b41d857), and config/routes.rb matched the correct version again.
  • Dispatched CI on the bot commit: lint, zeitwerk_check, scan_ruby, annotate_check all pass.
  • annotaterb models --frozen against a fresh test database: no changes.

@jaspermayone jaspermayone changed the title chore: update route annotations ci: autofix annotations and lint on pull requests Sep 28, 2026
@jaspermayone
jaspermayone merged commit 2c80e77 into main Sep 28, 2026
8 checks passed
@jaspermayone
jaspermayone deleted the chore/route-annotations branch September 28, 2026 20:45
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.

1 participant