Skip to content

chore: add generate-client sync check to CI and lefthook#87

Merged
11gather11 merged 4 commits intomainfrom
chore/add-generate-client-check
Dec 22, 2025
Merged

chore: add generate-client sync check to CI and lefthook#87
11gather11 merged 4 commits intomainfrom
chore/add-generate-client-check

Conversation

@11gather11
Copy link
Copy Markdown
Contributor

@11gather11 11gather11 commented Dec 22, 2025

Summary

src/client.tsがルートファイルと同期されているかをCI/lefthookでチェックするようにしました。

Changes

  • CI (ci.yml, pull_request.yml) に generate-client チェックを追加
  • lefthook の pre-commit に generate-client チェックを追加
  • PRテンプレートを現在のCIチェック内容に更新

Test Plan

  • Lint & Format check passed: bun run check
  • Type check passed: bun run typecheck
  • Generated client is up to date: bun run generate:client
  • Tests passed: bun test
  • Changeset created: bun changeset (if this PR includes user-facing changes)
  • Manual testing completed: lefthook pre-commit 動作確認済み

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Expanded the PR template with a more comprehensive testing checklist (lint & format, type check, generated-client verification, tests, changeset, manual testing).
    • Added CI checks to block merges when generated client output is stale.
    • Added a pre-commit hook to run and stage local client generation.
    • Minor update to the client-generation implementation (internal change).

✏️ Tip: You can customize this high-level summary in your review settings.

- Add generate-client check to ci.yml and pull_request.yml
- Add generate-client check to lefthook pre-commit
- Update PR template with current CI checks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Dec 22, 2025

⚠️ No Changeset found

Latest commit: 7df7e84

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 22, 2025

Warning

Rate limit exceeded

@11gather11 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 6bed9ca and 7df7e84.

📒 Files selected for processing (2)
  • scripts/generate-client.ts
  • src/client.ts

Walkthrough

Adds CI and pre-commit checks that regenerate and verify the repository's generated client (src/client.ts), updates the PR template to require those checks, and adjusts the client generation script's Glob import.

Changes

Cohort / File(s) Summary
PR template documentation
.github/PULL_REQUEST_TEMPLATE.md
Expands the Test Plan section to require multiple checks: Lint & Format, Type check, Generated client up to date, Tests, Changeset, and Manual testing; reflows and reformats comments.
CI workflow updates
.github/workflows/ci.yml, .github/workflows/pull_request.yml
Inserts a "Check generated client is up to date" step that runs bun run generate:client and verifies src/client.ts has no changes via git diff --exit-code.
Pre-commit hook
lefthook.json
Adds a generate-client pre-commit command targeting src/routes/**/*.ts that runs bun run generate:client and stages src/client.ts (via git add src/client.ts).
Client generation script
scripts/generate-client.ts
Replaces Bun.Glob usage with Glob imported from 'bun' (new Bun.Glob(...) -> new Glob(...)) — no other logic changes.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer (local)
  participant Hook as Lefthook (pre-commit)
  participant Repo as Git repo / Working tree
  participant CI as CI Runner
  participant Script as generate:client (bun)
  participant Git as git diff

  Dev->>Hook: commit
  Hook->>Script: run `bun run generate:client`
  Script->>Repo: update `src/client.ts`
  Hook->>Git: `git diff --exit-code src/client.ts`
  alt no changes
    Git-->>Hook: exit 0 — commit allowed
  else changes detected
    Git-->>Hook: exit non-zero — commit rejected
  end

  Note over Dev,CI: On push / PR
  Dev->>CI: push / open PR
  CI->>CI: run Type Check
  CI->>Script: run `bun run generate:client`
  Script->>Repo: update `src/client.ts`
  CI->>Git: `git diff --exit-code src/client.ts`
  alt no changes
    Git-->>CI: exit 0 — continue to tests
  else changes detected
    Git-->>CI: exit non-zero — job fails
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review focus:
    • Correct placement and ordering of the new CI steps.
    • Lefthook command glob and the git add src/client.ts behavior.
    • scripts/generate-client.ts change from Bun.Glob to Glob for compatibility.

Possibly related PRs

Suggested labels

client

Poem

🐰 I hopped through files at break of day,
Ran the generator to keep drift at bay,
Hooks and CI watch the client stay new,
No stale lines slip past our view.
Fresh src/client.ts — a rabbit's cue ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: add generate-client sync check to CI and lefthook' accurately summarizes the main changes: adding a generate-client check to CI workflows and lefthook configuration.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pull_request.yml (1)

24-24: Critical: Bun version mismatch between workflows.

This workflow uses Bun version 1.3.4, while .github/workflows/ci.yml uses version 1.3.5. This inconsistency could cause different client generation output between PR checks and main branch CI, potentially leading to false positives or false negatives in the generate-client sync validation.

🔎 Proposed fix to align Bun versions
       - name: Setup Bun
         uses: oven-sh/setup-bun@v2
         with:
-          bun-version: 1.3.4
+          bun-version: 1.3.5
♻️ Duplicate comments (1)
.github/workflows/pull_request.yml (1)

35-38: Same scope concern as in ci.yml.

As noted in the ci.yml review, this check only validates src/client.ts. If the generation script produces multiple files, others won't be caught.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 30dda8f and 2b317bb.

📒 Files selected for processing (4)
  • .github/PULL_REQUEST_TEMPLATE.md
  • .github/workflows/ci.yml
  • .github/workflows/pull_request.yml
  • lefthook.json
🔇 Additional comments (2)
.github/PULL_REQUEST_TEMPLATE.md (1)

31-36: Excellent documentation of the test plan.

The expanded checklist clearly documents all CI validation steps, including the new generate-client check. This helps contributors understand what checks they need to pass before submitting a PR.

lefthook.json (1)

11-15: The glob pattern does not restrict when this hook runs.

The hook executes on every commit regardless of changed files because the run command doesn't use {staged_files} or other file templates. Remove the glob filter since it has no effect here, or add {staged_files} to the run command if you want to make glob filtering functional.

Likely an incorrect or invalid review comment.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@11gather11 11gather11 merged commit 7748fd8 into main Dec 22, 2025
4 checks passed
@11gather11 11gather11 deleted the chore/add-generate-client-check branch December 22, 2025 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant