-
Notifications
You must be signed in to change notification settings - Fork 26
fix: Correct pre-commit template path in PrecommitHooksFixer #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Correct pre-commit template path in PrecommitHooksFixer #269
Conversation
Signed-off-by: Rahul Shetty <[email protected]>
AgentReady Code Review - PR #269OverviewPR: fix: Correct pre-commit template path in PrecommitHooksFixer Executive Summary✅ APPROVED - This is a well-targeted bug fix that corrects a template path mismatch causing Key Findings:
AgentReady Attribute AnalysisAffected Attributes
Score Impact CalculationCurrent State: When
Projected Repository Score Improvement: +3.0 points (for repos missing pre-commit hooks) Code Quality Assessment✅ Strengths
|
| Category | Status | Notes |
|---|---|---|
| Command Injection | ✅ SAFE | No user input in shell commands |
| Path Traversal | ✅ SAFE | Template paths are constructed from language detection, not user input |
| Template Injection | ✅ SAFE | Jinja2 templates are static and bundled with the package |
Best Practices Compliance
✅ Follows AgentReady Guidelines
- ✅ Conventional Commits: Commit message follows
fix: <description>format - ✅ Type Annotations: All functions have proper type hints
- ✅ Inline Documentation: Docstrings present and descriptive
- ✅ Separation of Concerns: Fix is localized to the fixer class
- ✅ Minimal Change Scope: Only modifies what's necessary
⚠️ Needs Improvement
⚠️ Test Coverage: No unit tests forPrecommitHooksFixer(see Issue [P0] Create Automated Demo #1)⚠️ Error Handling: Overly broad exception catching (see Issue [P0] Fix Critical Security & Logic Bugs from Code Review #2)
Recommendations Summary
Required Before Merge
- Add unit tests for
PrecommitHooksFixer(HIGH priority)
Recommended Improvements
- Replace broad exception with specific
TemplateNotFoundcatch (MEDIUM priority) - Add defensive fallback to
_basetemplate (LOW priority) - Add structured logging for template fallback events (LOW priority)
Conclusion
VERDICT: ✅ APPROVE WITH RECOMMENDATIONS
This is a solid bug fix that correctly addresses the template path mismatch. The code change is minimal, targeted, and safe. However, the lack of unit tests for PrecommitHooksFixer is a gap that should be addressed.
Recommended Merge Path:
- Option A (Ideal): Add unit tests, then merge
- Option B (Acceptable): Merge now, create follow-up issue for tests
- Option C (Not Recommended): Merge without tests
AgentReady Certification Impact:
- Enables automated fixing of
precommit_hooksattribute for target repositories - Supports AgentReady's mission to improve repository AI-readiness
- Aligns with Tier 2 Critical attributes (pre-commit hooks prevent bad commits)
Review conducted by: AgentReady Code Review Analysis
Date: 2026-01-29
Reviewers: @claude (sonnet-4-5)
|
this is good to go - would you mind looking at why the CI tests are failing? i dont think its related to this PR but if you could take a look I would appreciate it. |
Signed-off-by: Rahul Shetty <[email protected]>
|
It seems the earlier CI failure was due to formatting issue in couple of files. Have run the Also I might need to get some permission to run the check automatically: https://github.com/ambient-code/agentready/pull/269/checks |
📈 Test Coverage Report
Coverage calculated from unit tests only |
## [2.24.1](v2.24.0...v2.24.1) (2026-01-30) ### Bug Fixes * Correct pre-commit template path in PrecommitHooksFixer ([#269](#269)) ([c42a3c9](c42a3c9))
|
🎉 This PR is included in version 2.24.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
# [2.14.0](v2.13.0...v2.14.0) (2026-02-03) ### Bug Fixes * add bounded retry logic for LLM rate limit handling ([ambient-code#205](https://github.com/kami619/agentready/issues/205)) ([6ecb786](6ecb786)), closes [ambient-code#104](https://github.com/kami619/agentready/issues/104) * **assessors:** FileSizeLimitsAssessor now respects .gitignore ([ambient-code#248](https://github.com/kami619/agentready/issues/248)) ([eaaecc2](eaaecc2)), closes [ambient-code#245](https://github.com/kami619/agentready/issues/245) * **ci:** use gh pr view for fork PR number lookup in coverage comment ([ambient-code#253](https://github.com/kami619/agentready/issues/253)) ([1688362](1688362)) * Correct pre-commit template path in PrecommitHooksFixer ([ambient-code#269](https://github.com/kami619/agentready/issues/269)) ([c42a3c9](c42a3c9)) * downgrade docker/metadata-action to v5 and fix shellcheck warnings ([12f5509](12f5509)) * enable Harbor task filtering for smoketest support ([ambient-code#222](https://github.com/kami619/agentready/issues/222)) ([f780188](f780188)) * make E2E test timeouts configurable and add sensitive directory test ([ambient-code#206](https://github.com/kami619/agentready/issues/206)) ([27e87e5](27e87e5)), closes [ambient-code#104](https://github.com/kami619/agentready/issues/104) [ambient-code#192](https://github.com/kami619/agentready/issues/192) * prevent unauthorized message for non-command comments ([ambient-code#262](https://github.com/kami619/agentready/issues/262)) ([84c6f69](84c6f69)) * rename research report in data directory ([b8ddfdc](b8ddfdc)) * resolve all test suite failures - achieve zero failures ([ambient-code#180](https://github.com/kami619/agentready/issues/180)) ([990fa2d](990fa2d)), closes [ambient-code#148](https://github.com/kami619/agentready/issues/148) [ambient-code#147](https://github.com/kami619/agentready/issues/147) [ambient-code#145](https://github.com/kami619/agentready/issues/145) * resolve YAML syntax error in continuous-learning workflow ([ambient-code#172](https://github.com/kami619/agentready/issues/172)) ([3d40fcc](3d40fcc)) * resolve YAML syntax error in update-docs workflow and add actionlint ([ambient-code#173](https://github.com/kami619/agentready/issues/173)) ([97b06af](97b06af)) * update --version flag to show correct version and research report date ([ambient-code#221](https://github.com/kami619/agentready/issues/221)) ([5a85abb](5a85abb)) * **workflows:** ensure post-comment step runs after Claude Code Action ([b087e5c](b087e5c)) * **workflows:** handle all event types in agentready-dev workflow ([9b942bf](9b942bf)) * **workflows:** improve error handling and logging for comment posting ([9ea1e6b](9ea1e6b)) * **workflows:** improve issue number extraction and add debug step ([ecd896b](ecd896b)) * **workflows:** remove if:always() to test step execution ([ff0bb12](ff0bb12)) * **workflows:** simplify post-comment step condition ([1bbf40a](1bbf40a)) ### Features * add Harbor Terminal-Bench comparison for agent effectiveness ([ambient-code#199](https://github.com/kami619/agentready/issues/199)) ([a56e318](a56e318)) * add Memory MCP server allow list to repository settings ([ambient-code#203](https://github.com/kami619/agentready/issues/203)) ([41d87bb](41d87bb)) * **assessors:** support AGENTS.md and @ references in CLAUDEmdAssessor ([ambient-code#265](https://github.com/kami619/agentready/issues/265)) ([450ec25](450ec25)), closes [ambient-code#244](https://github.com/kami619/agentready/issues/244) * consolidate GitHub Actions workflows by purpose ([ambient-code#217](https://github.com/kami619/agentready/issues/217)) ([717ca6b](717ca6b)), closes [ambient-code#221](https://github.com/kami619/agentready/issues/221) * container support ([ambient-code#171](https://github.com/kami619/agentready/issues/171)) ([c6874ea](c6874ea)) * convert AgentReady assessment to on-demand workflow ([ambient-code#213](https://github.com/kami619/agentready/issues/213)) ([b5a1ce0](b5a1ce0)), closes [ambient-code#191](https://github.com/kami619/agentready/issues/191) * enhance assessors with multi-language support and security ([ambient-code#200](https://github.com/kami619/agentready/issues/200)) ([85712f2](85712f2)), closes [ambient-code#10](https://github.com/kami619/agentready/issues/10) * Harbor framework integration for Terminal-Bench evaluations ([ambient-code#202](https://github.com/kami619/agentready/issues/202)) ([d73a8c8](d73a8c8)), closes [#4](#4) [ambient-code#178](https://github.com/kami619/agentready/issues/178) [ambient-code#178](https://github.com/kami619/agentready/issues/178) * integrate ACL file with Claude Code Action allowed_users ([ambient-code#261](https://github.com/kami619/agentready/issues/261)) ([fe52489](fe52489)) * Redesign homepage features with two-column layout and research links ([ambient-code#189](https://github.com/kami619/agentready/issues/189)) ([570087d](570087d)), closes [ambient-code#187](https://github.com/kami619/agentready/issues/187) * replace markdown-link-check with lychee for link validation ([ambient-code#177](https://github.com/kami619/agentready/issues/177)) ([f1a4545](f1a4545)) * Terminal-Bench eval harness (MVP Phase 1) ([ambient-code#178](https://github.com/kami619/agentready/issues/178)) ([d06bab4](d06bab4)), closes [ambient-code#171](https://github.com/kami619/agentready/issues/171) * **workflows:** add comment posting for [@agentready-dev](https://github.com/agentready-dev) agent ([5dff614](5dff614))
Description
The
PrecommitHooksFixerwas using an incorrect template path (precommit-{lang}.yaml.j2) that doesn't match the actual template structure, causingTemplateNotFounderrors when running the align command from different directory contexts.When running
agentready align .on a repository without pre-commit hooks, the following template error was observed:Type of Change
Related Issues
Fixes #
Relates to #
Changes Made
src/agentready/fixers/testing.py: Fixed template path from precommit-{lang}.yaml.j2 to {lang}/precommit.yaml.j2 to match actual template structureTesting
pytest)Checklist
Screenshots (if applicable)
Additional Notes