feat(review): AI evidence line, suggestions and base-branch repo instructions (needs core 0.10)
Issue for this PR
Part of #1792
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
Draft, not for merge yet. Stacked on #1769. It needs the @altimateai/altimate-core release that parses the new AI output fields (0.10.0, PR in the core repo). Against core 0.9.0 the new fields default and behaviour is unchanged.
What changed
- Reads the AI reviewer's
evidence_line,pre_existing,suggestionandcitesand maps them to the finding: quoted line, pre-existing tag, a GitHub suggestion block when valid, and(per <file>). - Repo review instructions (
REVIEW.md,.altimate/REVIEW.md,AGENTS.md,CLAUDE.mdat the root and above each changed path) are read from the base branch and given to the AI as conventions, so a PR can't change its own instructions. Capped at 4k chars per file and 12k in total. - AI findings that quote a line but give no line number are anchored to the diff line they quote.
Results so far
- Widening the AI's remit to macro, test and yml bugs did not help, so that part was dropped:
- Tuning repos: +2 catches (95% CI ā3 to +7).
- Held-out repos: ā1 catch, with 8% wrong comments.
- This PR keeps only the output fields, repo instructions and anchoring. Measuring those alone is still to do: one tuning-repo run before the core release.
How did you verify your code works?
bun test test/altimate/review: 678 pass.bunx tsc --noEmit: clean.
Cost side effects
No new model calls, warehouse queries or cloud resources. When the AI lane is enabled, base-branch repo instructions add at most 12k characters (about 3k tokens) of input per AI call (4k per file), and the new output fields add a few output tokens per finding.
Screenshots / recordings
Not a UI change.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
- I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"
š¤ Generated with Claude Code
Summary by cubic
Maps the AI reviewer's newer output fields onto findings and supplies the reviewer with the repo's own review instructions read from the base branch. Requires altimate-core 0.10.0; against 0.9.0 the new fields default to absent and behavior is unchanged.
- Reads
evidence_line,pre_existing,suggestionandcitesfrom the AI reviewer, mapping them to the finding's quoted line, pre-existing tag, GitHub suggestion block, and a(per <file>)body suffix; malformed suggestions are dropped, not fatal. - Reads
REVIEW.md,.altimate/REVIEW.md,AGENTS.mdandCLAUDE.mdat the repo root and each ancestor directory of a changed path from the base commit, so a PR can't rewrite its own instructions; each file is capped at 4k chars, 12k total. - AI findings that quote a line without a line number are anchored to the matching diff line.
- Widening the AI remit to macro, test and yml bugs did not improve catch rate and was dropped.