Repository navigation
Fix managed hook install detection - #352
Conversation
Restore native-agent install detection by matching real managed hooks, add stable managed-hook sentinels for installed hooks, and align compare/benchmark fixtures with the real installer output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughInstalls now write a stable managed-hook sentinel ( ChangesManaged hook detection and identity
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/unit/install.test.ts (1)
698-712: ⚡ Quick winAssert the
sourcesentinel too, not justname.Line 708–710 only verifies
name. To lock the full managed-hook identity contract and prevent silent regressions, also assertsource(e.g.,madar:<version>).💡 Suggested test hardening
const claudeSettings = readFileSync(join(projectDir, '.claude', 'settings.json'), 'utf8') const geminiSettings = readFileSync(join(projectDir, '.gemini', 'settings.json'), 'utf8') const codexHooks = readFileSync(join(projectDir, '.codex', 'hooks.json'), 'utf8') - expect(extractHookEntry(claudeSettings, 'UserPromptSubmit').name).toBe('madar') - expect(extractHookEntry(geminiSettings, 'BeforeTool').name).toBe('madar') - expect(extractCodexPreToolUseEntry(codexHooks).name).toBe('madar') + const claudeEntry = extractHookEntry(claudeSettings, 'UserPromptSubmit') + const geminiEntry = extractHookEntry(geminiSettings, 'BeforeTool') + const codexEntry = extractCodexPreToolUseEntry(codexHooks) + + expect(claudeEntry.name).toBe('madar') + expect(geminiEntry.name).toBe('madar') + expect(codexEntry.name).toBe('madar') + + expect(String(claudeEntry.source ?? '')).toMatch(/^madar:/) + expect(String(geminiEntry.source ?? '')).toMatch(/^madar:/) + expect(String(codexEntry.source ?? '')).toMatch(/^madar:/)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unit/install.test.ts` around lines 698 - 712, The test currently only asserts the managed-hook name sentinel; update the assertions to also check the source sentinel for each hook entry returned by extractHookEntry (for Claude and Gemini) and extractCodexPreToolUseEntry (for Codex) — e.g., assert that .source matches the expected managed source pattern (such as starting with "madar:" or equals the exact "madar:<version>" you maintain); modify the three expectations after reading claudeSettings, geminiSettings, and codexHooks to include these .source checks alongside the existing .name checks to lock the full managed-hook identity contract.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/unit/install.test.ts`:
- Around line 698-712: The test currently only asserts the managed-hook name
sentinel; update the assertions to also check the source sentinel for each hook
entry returned by extractHookEntry (for Claude and Gemini) and
extractCodexPreToolUseEntry (for Codex) — e.g., assert that .source matches the
expected managed source pattern (such as starting with "madar:" or equals the
exact "madar:<version>" you maintain); modify the three expectations after
reading claudeSettings, geminiSettings, and codexHooks to include these .source
checks alongside the existing .name checks to lock the full managed-hook
identity contract.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 495b56c0-acbc-4029-b1a6-26228d5ebc48
📒 Files selected for processing (6)
src/infrastructure/compare.tssrc/infrastructure/install.tstests/unit/benchmark-suite.test.tstests/unit/compare-native-agent.test.tstests/unit/compare.test.tstests/unit/install.test.ts
Resolve the compare.ts import overlap between the managed-hook install detector fix and the shared explain-pack payload update from next. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
name/sourcemadar sentinels into Claude, Gemini, and Codex hook entriesCloses #349
Summary by CodeRabbit
Bug Fixes
Tests