Audit a Pull Request Diff for Breaking API Changes

Separates wire-breaking schema, status code, and migration changes from safe additions, returning a consumer impact table and deprecation plan.

Agent prompt for ChatGPT and Claude

You get: Verdict, consumer Impact Table and safe Additive Changes

Prompt

Prompt
Act as a staff API platform engineer reviewing a pull request for backward compatibility. I will paste a git diff and any related schema or migration files right after this prompt. Audit the diff to separate wire-breaking changes from safe additive changes.

Rules:
1. Classify every API change as Wire-Breaking, Behavioral-Breaking, or Safe Additive, citing the exact file path and symbol name from the diff.
2. Check for renamed or removed fields, tightened validation, changed HTTP status codes, altered default values, and database migrations that drop or lock columns before old code stops reading them.
3. Never assume a change is safe because a test passed; flag missing contract tests or undocumented version bumps.
4. For every breaking item, provide a zero-downtime alternative using expand-and-contract or versioned routing.

Output format:
- **Verdict:** Ship, Ship with Deprecation, or Block, with a two-sentence rationale.
- **Consumer Impact Table:** Markdown table with columns: File and Symbol, Change Type, Severity, Affected Consumers, Required Fix.
- **Safe Additive Changes:** Bullet list of non-breaking additions verified in the diff.
- **Deprecation and Rollout Plan:** Numbered steps to deploy safely without breaking existing clients.

End with one short section listing assumptions made and any missing context (such as unknown external consumers or missing schema files) needed to finalize the review.

Example output

Rollout plan to fix breaking API changesVerdict: Block. Three breaking changes found.
  1. Restore total_cents fieldStep 1Return both fields and add a Deprecation header with a 60-day sunset.
  2. Revert the 404 status changeStep 2Keep HTTP 200 on /v2/invoices and add a contract test.
  3. Split the column drop migrationStep 3Separate PR, after all pods ignore legacy_tax_rate.
  4. Track old field usageStep 4Emit a metric, remove total_cents once traffic hits zero.

Example for: a Node.js billing service pull request modifying the /v2/invoices/inv_8841 response payload and status codes.

Verdict: Block. This pull request introduces two wire-breaking changes to the invoice endpoint and a destructive column drop that will fail active readers during a rolling deploy.

Consumer Impact Table:

File and SymbolChange TypeSeverityAffected ConsumersRequired Fix
src/routes/invoices.ts (getInvoice)Renamed total_cents to amount_due_centsWire-BreakingMobile app v4.2, Partner webhooksReturn both fields during a 60-day deprecation window.
src/routes/invoices.ts (getInvoice)Changed empty result from HTTP 200 to 404Behavioral-BreakingInternal reporting workerKeep HTTP 200 on /v2/ or gate behind /v3/ route.
migrations/20250312_drop_tax.sqlDrops legacy_tax_rate columnWire-BreakingRunning pods during rolling deployStop reading column in release 1; drop in release 2.

Safe Additive Changes:

  • src/routes/invoices.ts: Added optional currency_code string field with default USD.
  • src/schemas/invoice.yaml: Added optional memo query filter; existing requests remain valid.

Deprecation and Rollout Plan:

  1. Restore total_cents alongside amount_due_cents and add a Deprecation response header with a sunset date 60 days out.
  2. Revert the 404 status code change on /v2/invoices and add a contract test asserting HTTP 200 for empty invoice lists.
  3. Split migrations/20250312_drop_tax.sql into a separate pull request scheduled after all production pods run code that ignores legacy_tax_rate.
  4. Emit a metric whenever a client parses total_cents without requesting the new schema version, then remove the old field once traffic hits zero.

Assumptions and Missing Context:
Assumes partner webhook subscribers deserialize strict JSON schemas. No OpenAPI spec diff or consumer traffic logs were included; verify whether any legacy mobile builds below v4.0 still call /v2/invoices.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Forces a strict three-tier classification so safe additive fields do not hide wire-breaking renames or status code shifts.
  • Explicitly checks database migrations for column drops and locks that break rolling deployments.
  • Requires concrete expand-and-contract steps instead of vague advice to version the API.

Use in GitHub Copilot Chat, Claude, or ChatGPT before approving an API pull request. Paste the full git diff along with any changed OpenAPI specs, proto files, or migration scripts.

Common edits

  • Add your team's API deprecation policy (such as a 90-day sunset window) to Rule 4 for tailored rollout timelines.
  • Include GraphQL or gRPC proto rules in Rule 2 if your service uses non-REST contracts.

Reuse it: Use in a workflowAdapt in the builder

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

Coding

Pull Request Review with Merge Recommendation

Reviews a diff against your standards and returns a merge, merge-with-changes, or do-not-merge recommendation. Findings are ranked by severity, with evidence, suggested fixes, and open questions.

Pre-PR Self-Review and Pull Request Description from a Git Diff

Has GitHub Copilot review your branch diff against the base branch, flag defects and missing tests, and draft a PR description with evidence. Use it to decide whether to open the PR or fix issues first.

AI Coding AgentsClaude Code

Pre-Merge Self-Review of a Git Diff: Correctness, Security, and Test Gaps

Has Claude Code review a branch diff like a skeptical maintainer, producing severity-ranked findings with evidence and a clear merge, fix, or block recommendation. Use it before opening or approving a pull request.

Conventional Commit and PR Description from a Diff and Ticket

Produces a Conventional Commits message and a reviewer-ready PR description covering what changed, why, how to test it, and the risks, based on your diff and ticket.

Codex Pre-Merge Diff Review with Severity-Ranked Findings

Has Codex review a branch diff against a base ref in read-only mode. It checks correctness, tests, security, and maintainability, and returns evidence-backed findings with severity and a merge recommendation.