A sidebar for GitHub pull requests

A scout for every
pull request.

Scout opens right inside GitHub. It reads the whole diff the moment you arrive — then summarizes the PR, lays out the smartest order to review files, flags the risky changes, and explains any line of code you don't recognize.

Install extensionSee it in action
Free  ·  works on github.com  ·  Chrome & Edge
github.com/acme/storefront/pull/317

feat: apply discount code before charging #317

Openalex-chen wants to merge into main
ConversationCommits 6Files changed 5
▸ Scout scrolled to payments.service.ts
src/modules/payments/payments.service.ts+44 5
 const order = await this.ordersService.findById(orderId)
+const discount = await this.ordersService.applyDiscount(
+ order.id,
+ input.discountCode,
+)
+const finalAmount = discount?.amount ?? order.total
+if (!discount && input.discountCode) {
+ this.logger.warn('discount code not applied', { code: input.discountCode })
+}
 return this.stripe.charge({ ...base, amount: finalAmount })
src/modules/orders/orders.service.ts+6 0
 export class OrdersService {
+ async applyDiscount(orderId: UUID, code?: string): Promise<Discount | null> {
+ if (!code) return null
+ return this.discountsRepository.apply(orderId, code)
+ }
 }
src/modules/payments/types/charge-request.ts+4 2
 export class ChargeRequest {
  orderId: UUID
+ discountCode?: string
- // legacy: promoCode
 }
src/modules/catalog/catalog.repository.ts+3 1
src/modules/notifications/notification.formatter.ts+0 1
Scout
feat: apply discount code before charging
@alex-chen+57 −95 files
2 tests skipped
SUMMARY
REVIEW QUEUE
BATCH 1/12/5 reviewed
1payments.service.ts
high+44 5
Core change: applies discount before charging. Start here — affects all payment flows.
2orders.service.ts
high+6 0
New public applyDiscount used in the main flow. Verify null handling and edge cases.
3charge-request.ts
medium+4 2
Adds discountCode?: string to ChargeRequest. Check client compatibility.
4catalog.repository.ts
low+3 1
Import formatting only. Confirm the logic is unchanged.
5notification.formatter.ts
low+0 1
Removed an empty line. Cosmetic, no logic impact.
CRITICAL CHANGES2
ARCHITECTURAL ALTERNATIVES2
ASK ABOUT THIS PR
↑ this is live — mark files as viewed, jump between diffs, expand sections, and ask Scout
FEATURES

Everything you need to review a PR well

01 — SUMMARIZE

Understand the PR in seconds

Scout reads every changed file and writes a short, honest summary — what the PR does, how big it is, and what it touches. No more scrolling 40 files to figure out the intent.

Summary
Adds discount code support to the payment flow — applies a discount before charging.
5 files changed · +57 / −9. Core change is in payments.service.ts.
Adds a public applyDiscount method — check null handling and edge cases.
02 — REVIEW QUEUE

Review files in an order that makes sense

Scout batches the diff into a priority queue — each file tagged by risk, with a note on why it matters. Tick a file off as you go, and click any file to jump straight to it.

BATCH 1/12/5 reviewed
1
payments.service.ts
high
3
charge-request.ts
medium
03 — CRITICAL CHANGES

See the risky changes before they ship

Scout surfaces the changes that deserve a second look — race conditions, silent failures, breaking edits — each with a plain-language warning of what could go wrong and where to find it.

payments.service.ts
Adds an extra DB query (applyDiscount) inside the payment flow before charging.
If discountsRepository.apply is slow or throws, the entire payment fails. No timeout or fallback — consider wrapping in a try/catch that falls back to full price.
04 — ARCHITECTURE

Catch architecture shifts — and the roads not taken

When a PR changes how the system is built, Scout shows the approach that was used and the alternative beside it — so you can weigh the trade-offs instead of reverse-engineering them.

usedSeparate applyDiscount query inside the payment service
altResolve the discount at order creation and store it on the order
Avoids an extra query in the critical payment path and eliminates the race condition.
05 — ASK SCOUT

Ask about any line you don't recognize

Type a symbol or paste a snippet — applyDiscount, a regex, an unfamiliar API — and Scout answers in the sidebar with the surrounding code as context.

Is there a race condition here?
Scout
Potentially. The discount is resolved and the charge made in two separate steps. If discountsRepository.apply throws, the charge still proceeds at full price with no signal to the user.
HOW IT WORKS

From open tab to confident review

01

Open any pull request

Hit the Scout button in GitHub's PR toolbar. The sidebar slides in alongside the diff — no new tab, no context switch.

02

Scout reads the diff

It summarizes the change, builds a review queue, and flags critical and architectural shifts — usually before you've finished reading the title.

03

Review and ship

Work the queue, check files off, and ask Scout about anything unclear. Leave the review knowing you saw what mattered.

Review your next PR with a scout

Add Scout to your browser and it works on every pull request you open. Free, no account required.

Chrome · Edge · Brave  ·  works on github.com