Repository navigation
feat(ce-review): format code references in verification rationales - #2
Conversation
…n rationales The converter now takes an optional prose.findings["<#>"].rationale and uses it for verification.rationale when it matches the verifier's text once backticks are removed, as it already does for review notes. Otherwise it keeps the verifier's wording. `--list-rationales` prints the generated rationales for the writer to mark up, and SKILL.md asks the writer to wrap file references and identifiers in backticks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| "highlight": [11] | ||
| } | ||
| ], | ||
| "comment": "A zero amount now returns as if it was paid. Could this throw instead?" |
There was a problem hiding this comment.
I think that providing the rationale is out of scope. What you should have done instead is just replace this comment with its appropriate backticks so that agents know to match the format that you requested.
There was a problem hiding this comment.
Declined. No agent reads fixtures/ce-run/prose.json: the writer's format example is fixtures/demo-story.findings.json (skill-ce/SKILL.md:48), and comment becomes the suggested comment (scripts/ce-review.ts:283), not the Verification card's verification.rationale (scripts/ce-review.ts:275). The upstream verifier runs unchanged (skill-ce/SKILL.md:8), so the writer's rationale field, checked against the verifier's wording (scripts/ce-review.ts:152), is the smallest change that reaches the generated rationale, and the fixture's two rationale lines are the fictional example the ticket asks for (scripts/ce-review.test.ts:245-251).
0xDirmes
left a comment
There was a problem hiding this comment.
Reviewed with revUI — no inline comments.
Omitted:
- Backtick-only edits can change the displayed verifier rationale (
scripts/ce-review.ts:153): The claim holds:markedUpcompares strings with all backticks removed (scripts/ce-review.ts:149-153), andrenderInlinepairs backticks before parsing links (src/lib/inline.tsx:26), so an added pair can mis-style a rationale that already has a lone backtick or a link. Not worth a fix commit:…
Linear ticket: https://linear.app/agorafinance/issue/BE-2568/format-code-references-in-verification-rationales
Summary
The ticket asks for file references and identifiers in a finding's Verification card to show as inline code, without changing the verifier's wording. The public Compound Engineering producer now has its writer agent wrap them in backticks, the same way it already marks up review notes. The converter accepts the writer's version only if it matches the verifier's text once the backticks are removed. If the words differ, it keeps the verifier's text.
scripts/ce-review.ts: adds the optionalrationalefield, an exportedrationales(run)function and the--list-rationalesoption.skill-ce/SKILL.md: tells the writer to copy each rationale and wrap file references and identifiers in backticks, e.g.`settings.ts:12` checks `enabledAt`.fixtures/ce-run/prose.json: the fictionalacme/shoprun now includes marked-up rationales.Decisions
amountfrom an ordinary English word. The writer already marks up review notes this way, so rationales reuse that check.--list-rationalesoption rather than adding rationales to--list-notes, so the existing note output keeps its shape.SKILL.mdand the offline test cover the whole path.Left out
Reviews already saved and the Verification card's display code are outside the ticket's scope. The card already renders backticks as inline code.
Evidence
main's converter, run on the fictional fixture with the marked-up prose, ignoresrationaleand writes plain text.After: the new converter keeps the writer's backticks, and demo mode shows
amountand0as inline code. Playwright found code spans[]before and['amount', '0']after.To get these, I converted the fixture with each converter, POSTed both documents to
/api/runinpnpm demo --port 5183asexample/demo/7andexample/demo/8, and took screenshots of the Verification card with Playwright.scripts/ce-review.test.tsfailed first withdoes not provide an export named 'rationales', then passed (16/16):`settings.ts:12` checks `enabledAt`.is kept, and a reworded`settings.ts:20` ignores `retryLimit`.falls back tosettings.ts:20 reads retryLimit.rationales(run)returns the verifier's reason for a confirmed finding and the default text for an unresolved onefindings.jsonpnpm test: 251 passed, 0 failed (249 before).pnpm typecheck,pnpm format:check,pnpm lintandpnpm buildpass. I didn't runpnpm test:browser, so the fullpnpm checkis left to the factory.Merge Danger
Door: two-way
The new prose field is optional and the converter falls back to its current output, so reverting the commit restores the old behavior. No stored data changes.
Blast Radius: contained
This affects only new conversions from the Compound Engineering producer. Prose files without
rationaleconvert exactly as before.🤖 Generated with Claude Code
Factory record
pnpm checkpassed on the runner at 60de39d.pnpm test): 251 passed, 0 failed.pnpm test:browser): 96 passed.