Repository navigation
Add compare install validity gate - #343
Conversation
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 (6)
🚧 Files skipped from review as they are similar to previous changes (6)
📝 WalkthroughWalkthroughThis PR implements comprehensive install detection and measurement validity reporting for ChangesMadar install detection and measurement validity gates
🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/cli/parser.ts (1)
1093-1100:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUpdate compare usage text to include
--allow-no-install.The parser accepts
--allow-no-install, but theUsage: madar compare ...error text still omits it. That makes the new escape hatch hard to discover when users hit validation errors.Also applies to: 1202-1202
🤖 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 `@src/cli/parser.ts` around lines 1093 - 1100, The compare command's usage string in the error thrown by UsageError omits the new --allow-no-install flag; update the two usage message literals surrounding the normalizedQuestion validation (the UsageError thrown where normalizedQuestion.trim() is checked) and the other occurrence near line ~1202 to include --allow-no-install so the help text reflects the accepted flag.src/cli/main.ts (1)
408-417:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winDocument
--allow-no-installincomparehelp output.
formatHelp()lists compare flags but omits--allow-no-install, so users won’t see the intended override path from--help.🤖 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 `@src/cli/main.ts` around lines 408 - 417, The compare command's help output (built in formatHelp for the 'compare' command strings in src/cli/main.ts) is missing the `--allow-no-install` flag; add an entry for `--allow-no-install` to the same help lines array/strings where the other compare options are defined so it appears in `--help` (match style/placement and a short description like "allow running compare without installing dependencies"). Locate the block that defines the compare usage/help lines (the strings including 'compare [question] run a real baseline vs madar prompt comparison' and its option lines) and insert the new `--allow-no-install` flag line there so it shows up in the CLI help.src/infrastructure/benchmark/suite.ts (1)
431-461:⚠️ Potential issue | 🟠 Major | ⚡ Quick win
summary.mddoes not mark skipped cells per-row.You’re collecting skipped state/reason, but the markdown table only prints metrics, so skipped cells are not explicitly labeled
skipped (no install)in row output. This misses the stated per-cell reporting requirement.Suggested direction
- lines.push('| Repo | Baseline input tokens | Madar input tokens | SPI Madar input tokens | Baseline tool calls | Madar tool calls | SPI Madar tool calls | Baseline Read | Madar Read | SPI Madar Read | Baseline Glob/Grep | Madar Glob/Grep | SPI Madar Glob/Grep | Baseline wall-clock (ms) | Madar wall-clock (ms) | SPI Madar wall-clock (ms) | Baseline cost (USD) | Madar cost (USD) | SPI Madar cost (USD) |') - lines.push('| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |') + lines.push('| Repo | Status | Reason | Baseline input tokens | Madar input tokens | SPI Madar input tokens | Baseline tool calls | Madar tool calls | SPI Madar tool calls | Baseline Read | Madar Read | SPI Madar Read | Baseline Glob/Grep | Madar Glob/Grep | SPI Madar Glob/Grep | Baseline wall-clock (ms) | Madar wall-clock (ms) | SPI Madar wall-clock (ms) | Baseline cost (USD) | Madar cost (USD) | SPI Madar cost (USD) |') + lines.push('| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |')function formatCellRow(cell: BenchmarkSuiteSummaryCell): string { + const statusLabel = cell.status === 'skipped' ? 'skipped (no install)' : cell.status + const reason = cell.reason ?? '—' return [ cell.repoId, + statusLabel, + reason, formatMetric(cell.baseline.input_tokens), ... ].join(' | ') }🤖 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 `@src/infrastructure/benchmark/suite.ts` around lines 431 - 461, The markdown table never marks per-row skipped cells; update formatBenchmarkSuiteSummaryMarkdown (or its helper formatCellRow) to detect the cell's skipped state/reason (e.g., cell.skipped, cell.skipped_for_install, or cell.skippedReason) and emit a clear row indicating "skipped (no install)" (or the captured reason) instead of metrics; implement this by short-circuiting when a cell is skipped and returning a table row with the repo and a single explicit "skipped (no install)" message (and empty/dash placeholders for the other metric columns) so every skipped cell is labeled in the generated summary.
🧹 Nitpick comments (1)
tests/unit/compare-install-regression-fixture.test.ts (1)
21-29: 💤 Low valueConsider validating
madar_mcp_call_countin assertions.The test verifies
install_verifiedandmeasurement_validitybut notmadar_mcp_call_count, which is part of the new report schema. Validating that the no-install fixture hasmadar_mcp_call_count: 0and the with-install fixture hasmadar_mcp_call_count: 2would strengthen the test.🤖 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/compare-install-regression-fixture.test.ts` around lines 21 - 29, Add assertions to validate the new madar_mcp_call_count field on the report fixtures: for noInstallReport and noInstallShareSafeReport assert madar_mcp_call_count === 0, and for withInstallReport and withInstallShareSafeReport assert madar_mcp_call_count === 2; update the test block that currently checks install_verified and measurement_validity to include these madar_mcp_call_count expects for all four report variables (noInstallReport, withInstallReport, noInstallShareSafeReport, withInstallShareSafeReport).
🤖 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.
Inline comments:
In `@tests/unit/benchmark-suite.test.ts`:
- Around line 500-596: The test "skips runnable cells when the repo has no
verified Madar install" is currently nested inside the mock callback
(executeNativeAgentCompare) and thus unreachable; move that entire it(...) block
out of the mock callback body so it lives at the top-level within the test suite
(same scope as other it blocks). Locate the mock function
executeNativeAgentCompare in this file and remove the nested it(...) from inside
it, then place the it(...) after the surrounding describe/it setup (so it calls
runBenchmarkSuite with the same mock overrides and assertions), keeping the same
variables names (generateCalls, compareCalls, runBenchmarkSuite, result, etc.)
so the assertions and mocks still reference the correct symbols. Ensure the mock
executeNativeAgentCompare only contains mock behavior/throws and does not
include any test registration code.
In `@tests/unit/compare-install-regression-fixture.test.ts`:
- Around line 14-31: The test compare install regression fixture currently only
asserts 'invalid' and 'valid' states; add coverage for the 'degraded' state by
reading the degraded fixture reports (use the same helper readFixtureReport) and
asserting install_verified is true and measurement_validity is 'degraded' for
both the normal and share-safe reports; update the test 'stores invalid vs valid
measurement validity across the no-install and with-install arms' or add a
separate it block that calls readFixtureReport('degraded' or a new fixture name
you create) for both 'report.json' and 'report.share-safe.json' and adds
expect(...install_verified).toBe(true) and
expect(...measurement_validity).toBe('degraded').
---
Outside diff comments:
In `@src/cli/main.ts`:
- Around line 408-417: The compare command's help output (built in formatHelp
for the 'compare' command strings in src/cli/main.ts) is missing the
`--allow-no-install` flag; add an entry for `--allow-no-install` to the same
help lines array/strings where the other compare options are defined so it
appears in `--help` (match style/placement and a short description like "allow
running compare without installing dependencies"). Locate the block that defines
the compare usage/help lines (the strings including 'compare [question] run a
real baseline vs madar prompt comparison' and its option lines) and insert the
new `--allow-no-install` flag line there so it shows up in the CLI help.
In `@src/cli/parser.ts`:
- Around line 1093-1100: The compare command's usage string in the error thrown
by UsageError omits the new --allow-no-install flag; update the two usage
message literals surrounding the normalizedQuestion validation (the UsageError
thrown where normalizedQuestion.trim() is checked) and the other occurrence near
line ~1202 to include --allow-no-install so the help text reflects the accepted
flag.
In `@src/infrastructure/benchmark/suite.ts`:
- Around line 431-461: The markdown table never marks per-row skipped cells;
update formatBenchmarkSuiteSummaryMarkdown (or its helper formatCellRow) to
detect the cell's skipped state/reason (e.g., cell.skipped,
cell.skipped_for_install, or cell.skippedReason) and emit a clear row indicating
"skipped (no install)" (or the captured reason) instead of metrics; implement
this by short-circuiting when a cell is skipped and returning a table row with
the repo and a single explicit "skipped (no install)" message (and empty/dash
placeholders for the other metric columns) so every skipped cell is labeled in
the generated summary.
---
Nitpick comments:
In `@tests/unit/compare-install-regression-fixture.test.ts`:
- Around line 21-29: Add assertions to validate the new madar_mcp_call_count
field on the report fixtures: for noInstallReport and noInstallShareSafeReport
assert madar_mcp_call_count === 0, and for withInstallReport and
withInstallShareSafeReport assert madar_mcp_call_count === 2; update the test
block that currently checks install_verified and measurement_validity to include
these madar_mcp_call_count expects for all four report variables
(noInstallReport, withInstallReport, noInstallShareSafeReport,
withInstallShareSafeReport).
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2c655fa4-0dc6-417d-bef9-764f0856b87d
📒 Files selected for processing (13)
docs/benchmarks/regression/install-ab-govalidate-explain/no-install/report.jsondocs/benchmarks/regression/install-ab-govalidate-explain/no-install/report.share-safe.jsondocs/benchmarks/regression/install-ab-govalidate-explain/with-install/report.jsondocs/benchmarks/regression/install-ab-govalidate-explain/with-install/report.share-safe.jsonsrc/cli/main.tssrc/cli/parser.tssrc/infrastructure/benchmark/suite.tssrc/infrastructure/compare.tstests/unit/benchmark-suite.test.tstests/unit/cli.test.tstests/unit/compare-install-regression-fixture.test.tstests/unit/compare-native-agent.test.tstests/unit/compare.test.ts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Closes #341
Summary
Test Plan
Summary by CodeRabbit
New Features
Improvements
Tests