Uh oh!
There was an error while loading. Please reload this page.
fix: use local binary for hooks + parallelize translation workflow - #97
Conversation
npx -y failproofai creates a self-referencing conflict when run inside the failproofai project itself. Use bun ./bin/failproofai.mjs instead, which runs directly from source without a build step. The npx -y approach remains the default for all other repos via `failproofai policies --install --scope project`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Explains why this repo uses bun ./bin/failproofai.mjs instead of npx -y failproofai, and that other repos should use the npx approach. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR updates the failproofai hook configuration to use a local Bun-based script instead of Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Replace single sequential job with a matrix strategy that runs all 14 languages in parallel, plus a consolidation job that merges artifacts and creates the PR. Cache fragments are merged via Object.assign on disjoint per-language keys. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/translate-docs.yml (1)
18-21: Avoid duplicating the tier-3 language list in CI.This matrix hardcodes the same selection logic that
scripts/translate-docs/cli.tsalready owns. A future language add/remove or tier change will makebun run translate --tier 3and this workflow disagree. Consider generating the matrix from the same source of truth, or add a guard that fails when the lists drift.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/translate-docs.yml around lines 18 - 21, The CI workflow hardcodes the tier-3 language matrix (lang) which duplicates the logic in scripts/translate-docs/cli.ts and can drift from bun run translate --tier 3; change the workflow to derive or validate the matrix from the single source of truth: either invoke scripts/translate-docs/cli.ts (or a new exportable function it uses) at workflow runtime to emit the lang list, or add a step that runs a script which compares the workflow's lang list against scripts/translate-docs/cli.ts and fails the job if they differ; update references to the matrix name (lang) and the script invocation (bun run translate --tier 3 or the exported function) so maintainers can locate and keep a single canonical list.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/translate-docs.yml:
- Around line 93-115: The merge currently uses
Object.assign(merged.translations, data.translations) which lets a stale
full-snapshot overwrite other languages; change the logic to merge per-language
using data.lastUpdated to avoid clobbering: create a map (e.g.,
mergedLastUpdatedByLang) and for each file's data iterate
Object.keys(data.translations) and for each lang replace
merged.translations[lang] only if mergedLastUpdatedByLang[lang] is missing or
data.lastUpdated > mergedLastUpdatedByLang[lang], update
mergedLastUpdatedByLang[lang] and set merged.lastUpdated =
max(merged.lastUpdated, data.lastUpdated); remove the Object.assign usage and
ensure the final write still writes merged (and sourceHash handling if needed).
---
Nitpick comments:
In @.github/workflows/translate-docs.yml:
- Around line 18-21: The CI workflow hardcodes the tier-3 language matrix (lang)
which duplicates the logic in scripts/translate-docs/cli.ts and can drift from
bun run translate --tier 3; change the workflow to derive or validate the matrix
from the single source of truth: either invoke scripts/translate-docs/cli.ts (or
a new exportable function it uses) at workflow runtime to emit the lang list, or
add a step that runs a script which compares the workflow's lang list against
scripts/translate-docs/cli.ts and fails the job if they differ; update
references to the matrix name (lang) and the script invocation (bun run
translate --tier 3 or the exported function) so maintainers can locate and keep
a single canonical list.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0dd438bc-f482-472f-9ffd-900b057ad318
📒 Files selected for processing (5)
.claude/settings.json.github/workflows/translate-docs.ymlCHANGELOG.mdCLAUDE.mdREADME.md
Uh oh!
There was an error while loading. Please reload this page.
Translate all uncached files concurrently using Promise.allSettled instead of sequential await loops. Cache is read once upfront to filter unchanged files before starting work, and batch-written once at the end. Translator functions accept an optional cache parameter to skip per-file disk I/O when the caller manages the cache lifecycle. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Each cache fragment contains the full base cache plus updates for one language. Using Object.assign naively lets a later fragment's stale entries overwrite an earlier fragment's fresh entries for a different language. Fix by loading the base from the first fragment, then only overlaying entries matching each fragment's own language suffix. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
NiveditJain
commented
Apr 14, 2026
@CodeRabbit review |
✅ Actions performedReview triggered.
|
- Cache page contents in a Map to avoid repeated readFileSync calls - Remove unused contentHash import - Move try/catch inside concurrent callbacks to preserve lang/source context in error reporting - Add concurrency limiter (max 10) to avoid Anthropic API rate limits - Add if: always() to consolidation job so partial successes are still collected when some language jobs fail Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds `force` (boolean, ignore cache) and `languages` (comma-separated filter) inputs to the Translate Docs workflow. A `prepare` job resolves the language list dynamically so the matrix works for both push triggers (all 14 languages) and manual dispatch (user-selected subset). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
Summary
npx -y failproofaiwithbun ./bin/failproofai.mjsin committed.claude/settings.jsonto fix self-referencing conflict when developing inside the failproofai repo itselftranslate-docs.ymlworkflow: 14-language matrix + consolidation jobif: always()) so successful translations aren't droppedworkflow_dispatchinputs:force(ignore cache) andlanguages(comma-separated filter) for manual translation runsTest plan
bun ./bin/failproofai.mjs --hook PreToolUseruns successfullybun run test:run)bunx tsc --noEmit)bun run translate --languages zh --dry-runworks with concurrency limiterforceandlanguagesinputs works🤖 Generated with Claude Code