AI code reviews that understand
your entire codebase.
MergeLens indexes your repository, then reviews every pull request against the callers, tests and conventions it touches. Findings land on GitHub with suggested fixes.
Return invoice totals in cents #412
- Read diff
- Trace callers
- Check tests
- Write review
| 39 | 39 | export function invoiceTotal(invoice: Invoice): number { | |
| 40 | - | return sumLines(invoice.lines) / 100; | |
| 40 | + | return sumLines(invoice.lines); |
Two callers still treat this total as dollars
invoiceTotal now returns cents, but its type is still number, so nothing fails to compile. scheduleDunning compares it against a 50 dollar threshold and InvoiceRow prints it as dollars, so reminders go out for small balances and every row shows a total 100 times too large.
-if (invoiceTotal(invoice) > 50) {+if (invoiceTotal(invoice) > MIN_DUE_CENTS) {
| 41 | 41 | } |
Platform
Reviews with the whole repository in view
Index yourrepository, review everypull request against the code it touches, and shipfixes your team can commit.
Catch regressions before they merge
with the path from change to failure
northwind/billing, this week
Open findings
4
Resolved this week
5
Files read for #412
8
RegressionDeclined cards are now retried
export function isRetryable(res: Response) {- return res.status >= 500;+ return res.status >= 400;}
This now returns true for 402 Payment Required and every other 4xx response. chargeCard in src/payments/charge.ts makes up to 6 attempts, so a declined card is attempted 6 times and every attempt counts against the processor's fraud limits.
Context for every change
across files, tests and conventions
| Module | Files | Used by | Tests |
|---|---|---|---|
| invoices | 14 | 23 | 9 |
| ui | 31 | 4 | 12 |
| jobs | 7 | 6 | 3 |
| payments | 9 | 11 | 6 |
invoices is used by 23 files in jobs, ui and api, so a change to it is reviewed against all of them.
Take action
Turn findings into commits without leaving the pull request
Suggested fixes
ready to commit
Format amounts with formatMoney
Other components in src/ui format amounts through formatMoney from src/lib/money.ts, which applies the invoice currency and its rounding rules. toFixed(2) drops the currency and shows yen with decimals.
-<td>{"$" + note.amount.toFixed(2)}</td>+<td>{formatMoney(note.amount, note.currency)}</td>
Explain every finding
with the code that proves it
Unsafe change in #412
invoiceTotal now returns cents
2 callers still read it as dollars
src/jobs/dunning.ts:48
if (invoiceTotal(invoice) > 50) {
src/ui/InvoiceRow.tsx:31
formatMoney(invoiceTotal(row), row.currency)
Found by following invoiceTotal to its callers outside the diff.
A summary and a check
on every pull request
Return invoice totals in cents #412
Summary. Switches invoiceTotal from dollars to cents. The diff is one line, but the return value is read in 4 places outside it.
1 inline comment on line 40, with a suggested fix for dunning.ts.
Findings4
- src/jobs/dunning.ts:48Assumes dollars
- src/ui/InvoiceRow.tsx:31Assumes dollars
- test/invoices/total.test.ts:22Will fail
- src/api/export.ts:112Unit safe
How it works
From install to your first review
Setup happens once, in GitHub. After that, every pull request is reviewed without anyone asking.
- 1
Connect GitHub
Install the MergeLens GitHub App and choose which repositories it can read.
Repository access
- northwind/billing
- northwind/web
- northwind/infra
- 2
Index the repository
MergeLens maps files, symbols, callers and tests, then keeps the map current as you merge.
northwind/billing
- Files and symbols
- Call graph
- Tests and fixtures
- 3
Analyze pull requests
When a pull request opens or changes, MergeLens follows each change to the code that depends on it.
#412 opened
invoiceTotal()
read by 3 callers, 1 test - 4
Deliver reviews
Findings land as inline comments with suggested fixes, plus a summary and a check on the pull request.
mergelens reviewed
3 findings in the review of #412
Pricing
Free for public repositories. Private repositories are billed per active author.
Open source
$0public repositories
- Repositories
- Public
- Code host
- GitHub
- Billing
- Free
- Reviews on every pull request
- Repository-wide context
- Suggested fixes in comments
Team
$20per active author / month
- Repositories
- Public and private
- Code host
- GitHub
- Billing
- Monthly
- Everything in Open source +
- Private repositories
- Billed per active author
Enterprise
Custom
- Repositories
- Public and private
- Code host
- GitHub
- Billing
- Annual
- Everything in Team +
- Pricing set in an annual agreement
Frequently asked questions
How MergeLens reviews code, and what it needs from your repository.
Something else? Contact us
What is MergeLens?
An AI code reviewer for GitHub. It indexes your repository and reviews each pull request against the callers, tests and conventions the change touches.
How do I get started?
Install the MergeLens GitHub App and choose the repositories it can read. The next pull request opened in those repositories gets a review.
What does MergeLens comment on?
Changes that break something elsewhere in the repository: a caller that now gets the wrong value, a test that no longer matches, or code that ignores a team convention. Each comment names the files and lines that show why.
Does MergeLens change my code?
No. It reads your repository and comments on pull requests. A suggested fix is applied only when someone on your team commits it.
Why does it need the whole repository?
A change can be safe inside the diff and unsafe somewhere else. Reading the code around a change is how MergeLens finds those cases.
Which code hosts are supported?
GitHub. MergeLens installs as a GitHub App and works on the repositories you give it access to.
Review your next pull request with the whole codebase in view
Install the GitHub App, pick your repositories, and the next pull request gets a review. Free for public repositories.
