Skip to content

docs(claude): add workflow rules#3293

Merged
PierreBrisorgueil merged 3 commits into
masterfrom
docs/workflow-rules
Mar 24, 2026
Merged

docs(claude): add workflow rules#3293
PierreBrisorgueil merged 3 commits into
masterfrom
docs/workflow-rules

Conversation

@PierreBrisorgueil

Copy link
Copy Markdown
Contributor

Add rules: always use PRs, never lower coverage thresholds, audit existing modules before implementing, always run /verify.

…gs (#3291)

Wrap GitHub API calls in try/catch and return empty array on failure.
Prevents 422 errors when rate-limited or repos are unreachable.
Tests now expect 200 with empty data when GitHub API fails, matching
the service's catch-and-return-empty-array behavior.
Copilot AI review requested due to automatic review settings March 24, 2026 20:12
@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@PierreBrisorgueil has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 23 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0150117b-619a-4cbb-9060-5f045a17fa7c

📥 Commits

Reviewing files that changed from the base of the PR and between cf58689 and 009023b.

📒 Files selected for processing (3)
  • CLAUDE.md
  • modules/home/services/home.service.js
  • modules/home/tests/home.integration.tests.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/workflow-rules

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.

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

This PR updates the project’s Claude workflow guidance and also changes the Home module’s GitHub-backed endpoints to return successful empty lists when the GitHub API is unavailable.

Changes:

  • Added “Workflow rules” guidance to CLAUDE.md (PR workflow, coverage thresholds, module audit, verify).
  • Updated HomeService.releases() / HomeService.changelogs() to return [] on failures instead of propagating errors.
  • Updated Home integration tests to expect 200 success with empty data when GitHub API calls fail.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
modules/home/tests/home.integration.tests.js Adjusts integration test expectations to match the new “graceful empty list” behavior for GitHub failures.
modules/home/services/home.service.js Wraps GitHub API calls in try/catch and returns empty arrays on error for releases/changelogs.
CLAUDE.md Adds explicit workflow rules for PR usage, coverage thresholds, auditing existing modules, and running /verify.

Comment thread CLAUDE.md
Comment on lines +70 to +75
## Workflow rules

- **Never push directly to master/main.** Always create a branch, push, create a PR, wait for CI green + review, then merge.
- **Never lower coverage thresholds** in `jest.config.js`. If coverage drops after adding code, write tests for the new project modules to bring it back above thresholds.
- **Audit existing modules before implementing.** Before creating new storage, file handling, or utility code, check `modules/` for existing solutions (e.g., `uploads` module for file storage via GridFS).
- **Always run `/verify` after any code change** before declaring done. CI must be green.

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

The PR title/description indicate a docs-only change to CLAUDE workflow rules, but this PR also changes runtime behavior and integration tests for the Home GitHub endpoints. Please either split the Home service/test changes into a separate PR or update the PR title/description to reflect the code behavior change.

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +53
try {
const requests = config.repos.map((item) =>
axios.get(`https://api.github.com/repos/${item.owner}/${item.repo}/releases`, {
headers: item.token ? { Authorization: `token ${item.token}` } : {},
}),
);
let results = await axios.all(requests);
results = results.map((result, i) => ({
title: config.repos[i].title,
list: result.data.map((release) => ({
name: release.name,
prerelease: release.prerelease,
published_at: release.published_at,
})),
}));
return results;
} catch (_err) {
return [];
}

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

The try/catch is broad enough that it will swallow non-network bugs/misconfigurations (e.g. config.repos missing/invalid or unexpected response shape) and silently return an empty list, making those failures hard to detect in production. Consider narrowing the catch to expected Axios/GitHub failures and/or logging the error (e.g. via lib/services/logger) before returning the fallback so operational issues remain observable.

Copilot uses AI. Check for mistakes.
Comment on lines +61 to +76
try {
const repos = _.filter(config.repos, (repo) => repo.changelog);
const requests = repos.map((item) =>
axios.get(`https://api.github.com/repos/${item.owner}/${item.repo}/contents/${item.changelog}`, {
headers: item.token ? { Authorization: `token ${item.token}` } : {},
}),
);
let results = await axios.all(requests);
results = results.map((result, i) => ({
title: repos[i].title,
markdown: Base64.decode(result.data.content),
}));
return results;
} catch (_err) {
return [];
}

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

Same concern here: catching all errors and returning [] will also hide unexpected decoding/shape errors (not just GitHub API unavailability). Suggest logging the caught error and limiting the fallback to expected request failures so real bugs still surface.

Copilot uses AI. Check for mistakes.
@PierreBrisorgueil
PierreBrisorgueil merged commit 1a10722 into master Mar 24, 2026
7 checks passed
@PierreBrisorgueil
PierreBrisorgueil deleted the docs/workflow-rules branch March 24, 2026 20:31
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