
Diffing an OpenAPI Spec Is Not Impact Analysis
Most teams already diff OpenAPI specs. The diff itself is rarely the hard part: a tool prints red for a removed field and green for a new one, someone skims it, and the PR merges. What nobody produced was evidence about who actually depends on the changed surface, whether their deployed code still works, and what remains unknown. This post builds that missing layer as a runnable Node.js fixture: a semantic diff, a consumer inventory, directional compatibility rules, and contract tests that turn predicted API breakage into scoped CI evidence.
TechGig reported on November 28, 2026 that Netflix built Quasar to track the impact of API changes, framing it around understanding the consequences of API evolution for dependent software. That framing is the useful part. The gap between "the contract changed" and "these consumers are affected in these ways, and here is the test that proves it" is where release incidents live.
Evidence boundary: the supplied report summary establishes one claim — that Netflix built a system called Quasar for tracking API-change impact. It does not describe Quasar's architecture, which contract formats it supports, how it identifies consumers, or whether it is available outside Netflix. Everything below is an independent design for a JavaScript-first impact analyzer. It is not a reconstruction of Quasar, and I am not claiming Netflix does any of this.
On this page
A Contract Diff Is Evidence, Not a Blast-Radius Map
Impact analysis requires contract changes, identifiable consumers, compatibility rules, and executable evidence
Here's my position: a spec diff is one input among four. Shipping the diff alone is worse than shipping nothing, because it looks confident while having no defined semantics. Impact analysis needs all four, and it degrades to unknown when any is missing:
- Contract changes — a semantic diff of the provider contract, not a textual one.
- Identifiable consumers — a versioned inventory of who calls what, at which deployed revision.
- Compatibility rules — an explicit, directional model of what "breaking" means for requests versus responses.
- Executable evidence — tests that run real consumer code against the candidate contract.
Drop (2) and you have a list of changes with no subjects. Drop (3) and you have changes with no verdict. Drop (4) and you have a prediction that has never been falsified. The failure mode I keep seeing is teams that own (1) and (4) separately — a diff bot in the provider repo, contract tests in the consumer repos — with nothing joining them.
What the TechGig report actually says about Netflix Quasar
The TechGig report, published November 28, 2026, says Netflix built Quasar to track the impact of API changes, with the report centered on understanding what API evolution does to dependent software. That is the whole of the confirmed claim available here. It is a reasonable thing for a large platform to build: at Netflix's scale, the number of internal consumers per endpoint makes "ask the team" an unreliable discovery mechanism.
What the report does not say, and what I will not invent: whether Quasar is a static analyzer, a traffic-analysis system, a registry, or a dashboard; whether it consumes OpenAPI, Protobuf, GraphQL, or internal IDL; whether it runs in CI; and whether anything about it is public. The snippet is a headline and a one-line summary.
Where the evidence stops and the independent design begins
The report is a secondary source with a one-sentence summary. Treat it as motivation, not documentation. Nothing in this post describes how Quasar works internally, and no output shown below comes from Netflix systems.
So the rest of this post is a design exercise with a runnable fixture. Where I state behavior, it comes from the OpenAPI 3.1.1 specification or from code in the fixture. Where I state a judgment call — like "adding a response enum value should be treated as a potential break" — I say so as a position, because reasonable teams differ.
Define What the Impact Analyzer Must Actually Answer
Four questions to answer separately, with different evidence for each
Conflating these is the root cause of bad tooling. Each question has a different evidence type and a different confidence level:
| Question | Evidence type | Confidence when present |
|---|---|---|
| What changed? | Semantic diff of two contracts | High, if both specs validate |
| Who might depend on it? | Consumer inventory + declarations | Medium — declarations drift |
| What is the compatibility risk? | Rule table over directional changes | Medium — rules are a model |
| What does a test demonstrate? | Executed consumer code against candidate contract | High, but scoped to what the test covers |
A tool that collapses all four into a single risk score destroys the information a reviewer needs. I would rather see four columns with honest gaps than one number with none.
A potential dependency is not a confirmed failure, and untested is not compatible
This is the sentence I would put at the top of every impact report. Two asymmetries matter:
- Absence of evidence is not compatibility. A consumer with no contract test is not passing; it is untested. Those must render differently in the report.
- Presence of a declaration is not a dependency. A manifest that lists
estimatedShipDatemay be six months stale. It is a lead, and leads get tested.
The outcome vocabulary I use has exactly four values, and only one of them is a positive claim:
no-detected-contract-risk— no rule fired for this consumer and operation, and its tests ranpotential-break— a rule fired, tests either not run or not yet failingconfirmed-fixture-failure— real consumer code failed against the candidate contractunknown-coverage— the inventory cannot answer the question (missing manifest, stale revision, unsupported schema construct)
There is deliberately no value called safe.
Scope: one OpenAPI 3.1 provider, two JavaScript consumers, a registry, and a PR gate
Scope, stated up front so the fixture stays honest about what it proves:
- One provider contract in OpenAPI 3.1.0, baseline and candidate versions
- Two JavaScript consumers with different failure modes: one that sends requests, one that exhaustively handles response values
- A YAML consumer registry checked into the provider repository
- A pull-request CI job that produces a report artifact and blocks on defined outcomes
Out of scope: GraphQL, gRPC, non-JSON media types, authorization semantics, pagination behavior, and anything requiring production traffic.
Build One Reproducible API-Change Fixture
Repository layout: baseline and candidate specs, consumer manifests, scripts, and CI
api-impact-fixture/
├── specs/
│ ├── orders.baseline.yaml # what is deployed today
│ └── orders.candidate.yaml # proposed change
├── consumers/
│ ├── checkout-service.yaml # manifest
│ ├── checkout-service/
│ │ ├── create-order.js # real request-building code
│ │ └── tests/create-order.test.js
│ ├── reporting-worker.yaml
│ └── reporting-worker/
│ ├── status-label.js # real response-handling code
│ └── tests/status-label.test.js
├── scripts/
│ ├── semantic-diff.mjs
│ ├── compat-rules.mjs
│ ├── impact.mjs
│ ├── gate.mjs
│ └── provider-stub.mjs
├── api-change-exceptions.yaml
└── .github/workflows/api-impact.yml
Node.js version, pinned dependencies, and the exact install and test commands
{
"name": "api-impact-fixture",
"private": true,
"type": "module",
"engines": { "node": ">=22.11.0 <23" },
"scripts": {
"spec:validate": "redocly lint specs/orders.baseline.yaml specs/orders.candidate.yaml",
"diff": "node scripts/semantic-diff.mjs",
"impact": "node scripts/impact.mjs",
"test:contract": "vitest run --reporter=json --outputFile=reports/vitest.json",
"gate": "node scripts/gate.mjs"
},
"devDependencies": {
"@readme/openapi-parser": "2.6.0",
"@redocly/cli": "1.25.5",
"ajv": "8.17.1",
"vitest": "2.1.5",
"yaml": "2.6.0"
}
}
Install and run:
node --version # v22.11.0
npm install # writes package-lock.json; commit it
npm run spec:validate
npm run diff -- --baseline specs/orders.baseline.yaml --candidate specs/orders.candidate.yaml --out reports/diff.json
npm run impact -- --diff reports/diff.json --consumers consumers --out reports/impact.json
npm run test:contract
These pins are what the fixture is written against. If your registry resolves newer majors of @redocly/cli or vitest, expect CLI flag churn — the scripts call them through package.json so the pin is the contract.
A baseline orders endpoint and a candidate with three different breaking edits
Three changes, chosen because they fail in three different ways:
openapi: 3.1.0
info:
title: Orders API
version: 1.4.0
paths:
/orders:
post:
operationId: createOrder
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateOrderRequest'
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
get:
operationId: listOrders
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Order'
components:
schemas:
CreateOrderRequest:
type: object
required: [currency, items]
properties:
currency:
type: string
enum: [USD, EUR]
items:
type: array
items:
type: object
required: [sku, quantity]
properties:
sku: { type: string }
quantity: { type: integer, minimum: 1 }
Order:
type: object
required: [orderId, status]
properties:
orderId: { type: string }
status:
type: string
enum: [PENDING, SHIPPED, DELIVERED, CANCELLED]
estimatedShipDate:
type: string
format: dateThe candidate makes three edits:
# change 1: new required request property
CreateOrderRequest:
type: object
required: [currency, items, idempotencyKey]
properties:
idempotencyKey: { type: string, minLength: 16 }
## change 2: response property removed
Order:
properties:
# estimatedShipDate: removed
status:
type: string
# change 3: exhaustive clients now see an unknown value
enum: [PENDING, SHIPPED, PARTIALLY_SHIPPED, DELIVERED, CANCELLED]Two consumers that fail differently: checkout-service and reporting-worker
The two consumers are deliberately different shapes, because they fail differently:
consumer: checkout-service
owner: payments-platform
environment: production
deployedRevision: checkout-service@sha-9f2c1ab
verifiedAt: "2026-11-19"
contractTests: consumers/checkout-service/tests
consumedOperations:
- method: POST
path: /orders
operationId: createOrder
fieldDependencies:
- operation: createOrder
direction: request
fields: [currency, items[].sku, items[].quantity]
- operation: createOrder
direction: response
fields: [orderId, status, estimatedShipDate]consumer: reporting-worker
owner: analytics-platform
environment: production
deployedRevision: reporting-worker@sha-4be77d0
verifiedAt: "2026-11-24"
contractTests: consumers/reporting-worker/tests
consumedOperations:
- method: GET
path: /orders
operationId: listOrders
fieldDependencies:
- operation: listOrders
direction: response
fields: [orders[].orderId, orders[].status]
enumHandling: exhaustiveenumHandling: exhaustive is the key declaration. It tells the analyzer that this consumer's code treats unknown enum values as an error, so a new response enum value is a real risk rather than a shrug.
Fixture output is expected, not measured against Netflix
Every command output in this post is expected output from the fixture described above. Nothing here was measured against Netflix, Quasar, or any production system, and no such claim is implied.
Produce a Semantic Diff Before Assigning Impact
Validate both OpenAPI documents and fail loudly on unsupported constructs
Validation is a hard gate. If a spec doesn't validate, the diff is meaningless — you'd be reasoning about a document the provider doesn't actually publish.
$ npm run spec:validate
Expected:
specs/orders.baseline.yaml: validated in 41ms
specs/orders.candidate.yaml: validated in 39ms
No errors were found.
Inside the diff script I use @readme/openapi-parser's bundle(), not validate(), for the comparison pass. validate() dereferences everything, and dereferencing recursive schemas produces circular object graphs that are painful to walk and impossible to serialize into a report. bundle() inlines external references but keeps internal $ref strings, so I resolve pointers myself with a guarded resolver and can mark recursion as unknown instead of hanging.
The unsupported-construct list is explicit and short. When the walker meets one of these, it emits an unknown-construct record rather than guessing:
// scripts/semantic-diff.mjs (excerpt)
const UNSUPPORTED = ["oneOf", "anyOf", "allOf", "not", "if", "patternProperties"];
function compareSchemas(baseRaw, candRaw, ctx, emit) {
const base = deref(baseRaw);
const cand = deref(candRaw);
const hits = UNSUPPORTED.filter((k) => base?.[k] !== undefined || cand?.[k] !== undefined);
if (hits.length > 0) {
// Do not pretend to know: composition changes need human review.
emit({ ...ctx, kind: "unknown-construct", detail: hits.join(",") });
return;
}
// ... property, type, enum, items comparison follows
}
Diff against the deployed baseline digest, not the default branch
main is not production. The baseline must be the artifact that is actually deployed, pinned by digest.
async function loadSpec(path) {
const raw = await readFile(path, "utf8");
const doc = await OpenAPIParser.bundle(path);
return {
path,
digest: "sha256:" + createHash("sha256").update(raw).digest("hex"),
doc,
};
}The digest goes into every change record. If the baseline digest doesn't match release-baseline.json — the file written at deploy time — the CI job fails with stale baseline, not no risk. That one check eliminates the most common false-negative: a pull request compared against a contract nobody is running.
Match operations by method and normalized path; treat operationId as its own change
function normalizePath(p) {
// /orders/{orderId} and /orders/{id} are the same wire route
return p.replace(/\{[^}]+\}/g, "{}").replace(/\/+$/, "") || "/";
}
Path parameter names are not part of the wire contract; path parameter positions are. Normalizing {id} and {orderId} to {} prevents a rename from being reported as a removed endpoint followed by an added one.
operationId is different. Changing it doesn't change a byte on the wire, but it renames the symbol in every generated client, which breaks every downstream compile. So it gets its own record kind, operation-id-changed, with the note "wire compatible; generated client symbol change". I classify it as compatible at the wire layer and let codegen-owning teams decide whether they care. That split is the whole point of having a rule table instead of a boolean.
Normalize every change into one record with operation, direction, pointer, and evidence
Every change becomes the same shape, regardless of which walker found it:
{
"operation": "POST /orders",
"operationId": "createOrder",
"direction": "request",
"pointer": "#/requestBody/properties/idempotencyKey",
"kind": "required-property-added",
"before": null,
"after": "{ type: string, minLength: 16 }",
"evidence": { "spec": "candidate", "pointer": "#/components/schemas/CreateOrderRequest/properties/idempotencyKey" }
}
direction is not decoration. It is the input to nearly every compatibility rule, because requests and responses fail in opposite directions.
The normalized fixture diff, and why textual YAML diffs under-report
Expected output of npm run diff for the fixture — four records:
[
{
"operation": "POST /orders",
"direction": "request",
"pointer": "#/requestBody/properties/idempotencyKey",
"kind": "required-property-added",
"before": null,
"after": "{ type: string, minLength: 16 }"
},
{
"operation": "POST /orders",
"direction": "response",
"pointer": "#/responses/201/properties/estimatedShipDate",
"kind": "property-removed",
"before": "{ type: string, format: date }",
"after": null
},
{
"operation": "POST /orders",
"direction": "response",
"pointer": "#/responses/201/properties/status",
"kind": "enum-value-added",
"after": "PARTIALLY_SHIPPED"
},
{
"operation": "GET /orders",
"direction": "response",
"pointer": "#/responses/200/items/properties/status",
"kind": "enum-value-added",
"after": "PARTIALLY_SHIPPED"
}
]
A textual diff of the same files produces something like "one line added in required", "two lines removed", "one enum value added" — with no notion of direction, no notion of which operation is affected, and crucially no notion that the enum change appears in two operations because the same Order component is referenced from both. Component reuse means one schema edit produces N operation-level changes. Textual diffs systematically under-report that.
Apply Compatibility Rules in the Correct Direction
Request compatibility asks whether old client requests are still accepted
Two independent questions, and mixing them up produces wrong verdicts:
- Request compatibility: given a client that sends exactly what the baseline schema allowed, does the candidate server still accept it? Tightening the request schema breaks clients. Loosening it does not.
- Response compatibility: given a client that correctly consumed the baseline response, can it still consume the candidate response? Adding to the response schema can break clients. Removing from it certainly can.
Notice the asymmetry: for requests, adding constraints is the dangerous direction; for responses, adding new values is. Teams that apply one mental model to both get one of the two backwards.
A small rule table for required, removed, enum, type, and status-code changes
| ID | Change | Direction | Verdict | Reasoning |
|---|---|---|---|---|
| R1 | Required property added | request | potential-break | Baseline-conforming clients omit it; server now rejects |
| R2 | Optional property added | request | compatible | Server accepts strictly more |
| R3 | Property removed | response | potential-break | Consumers reading the field now get undefined |
| R4 | Enum value added | response | potential-break | Exhaustive consumers throw or mis-bucket |
| R5 | Enum value added | request | compatible | Widens what the server accepts |
| R6 | Enum value removed / constraint added | either | potential-break | Narrows acceptance (request) or invalidates known values (response) |
| R7 | Type changed | either | potential-break | Assume incompatible unless the types are provably equivalent |
| R8 | Operation or status code removed | either | potential-break | Callers receive 404/405 or lose a handled branch |
| R9 | Operation id changed | neither | compatible (wire) | Wire route unchanged; generated client symbols break |
| R0 | Unsupported construct | either | unknown | Composition, conditionals, pattern properties |
The table is intentionally small. A large table invites the illusion of coverage; this one admits where it stops.
Why a new response enum value breaks exhaustive clients
This is the rule people argue about, so here's the mechanism rather than the assertion.
On the response path, the client owns a mapping from value to behavior. A switch with no default, a TypeScript discriminated union, or a lookup table that throws on miss all share the same property: an unrecognized value is a hard failure at runtime. The provider cannot see this. The schema says the value set got bigger, which sounds harmless, and the client experiences it as an exception in a code path that previously never executed.
On the request path, the provider owns the mapping. Accepting a new enum member means the server now handles inputs it previously rejected. Existing clients never send the new value, so nothing they do changes. Widening server acceptance is close to free; widening client expectations is not.
Required, nullable, additionalProperties, and readOnly/writeOnly move the verdict
Four details that change verdicts and that the walker handles explicitly:
requiredtransition:optional → requiredandrequired → optionalproduce different records, because one is a break and the other is a relaxation. The walker compares the parent'srequiredarray, not just the property presence.nullable/type: ["string", "null"]: in OpenAPI 3.1, nullability is expressed through the type union or a JSON Schema keyword. Removingnullfrom a response type is R6 territory; adding it is R4-adjacent for exhaustive clients.additionalProperties: afalsehere makes removing a request property genuinely breaking, because the server now rejects requests carrying the old field. A defaulttrue(absent) makes the same removal merely lossy. The walker records the effectiveadditionalPropertiesvalue in the change record so the verdict can be revised without re-running the diff.readOnly/writeOnly: areadOnlyproperty is never sent by clients, so a request-path rule should not fire on it. Ignoring these annotations is a reliable source of false positives in naive diffs.
What I'm not claiming: this is not a complete JSON Schema satisfiability check. Proving that the candidate request schema accepts a superset of the baseline is a real problem with real tools, and my walker approximates it with a rule table. That approximation is the reason unknown-construct exists.
Mark composition-heavy schemas unknown and separate wire compatibility from behavior
Two distinct kinds of unknowability, and blurring them is how reports become untrustworthy:
- Unknown to this tool.
oneOfwith reordered branches,allOfmerges,if/then/else. The contract may be perfectly compatible; the analyzer cannot tell. - Unknown to any schema.
POST /ordersmight now return 201 with the same shape but take 400ms longer, allocate a different order id format, or apply a new authorization rule. Wire compatibility says nothing about these.
The report keeps them in separate buckets: unknown-coverage for the first, and a "not analyzed by contract tooling" section for the second. Neither is silently dropped.
Join Changes to a Consumer Inventory
What a versioned consumer manifest has to contain
Every field in the manifest exists because something downstream needs it:
| Field | Used for |
|---|---|
owner | Routing the report and approving exceptions |
environment | Distinguishing production dependencies from staging experiments |
deployedRevision | Knowing which code is actually at risk, not which code is on main |
verifiedAt | Staleness detection |
consumedOperations | Operation-level join key |
fieldDependencies | Field-level precision |
contractTests | Locating executable evidence |
deployedRevision is the field most often omitted and most often decisive. A potential-break against a revision that has already been replaced by a tolerant implementation is noise. A compatible verdict against a revision deployed last week is a lie.
Declarations, generated clients, and traffic provide different evidence
Three sources, three epistemics:
- Declarations (the manifest): high precision, low recall. Someone wrote down what they think they use. Good for test targeting, unreliable as a complete dependency list.
- Generated-client metadata: the operation list in a generated SDK is machine-derived and therefore trustworthy for operation-level reachability. It says nothing about which fields the caller reads.
- Observed traffic: catches undeclared dependencies, but only for code paths that ran during the observation window. A nightly batch that calls
listOrdersonce a month is invisible to a one-week window.
That last point deserves emphasis. "No traffic to estimatedShipDate in the last 14 days" is consistent with full removal and with a monthly job that will break in three weeks. Traffic absence is evidence about the observation window, not about the consumer.
Join changed operations to consumers without collapsing confidence levels
import { readFile, readdir } from "node:fs/promises";
const STALE_AFTER_DAYS = 45;
function lastProperty(pointer) {
const tail = pointer.split("/properties/").at(-1) ?? "";
return tail.split("/")[0];
}
function fieldMatches(declaredFields, pointer) {
const needle = lastProperty(pointer).replace(/[]$/, "");
return declaredFields.some((f) => f.split(".").at(-1).replace(/[]$/, "") === needle);
}
async function loadManifests(dir) {
const out = [];
for (const file of await readdir(dir)) {
if (!file.endsWith(".yaml")) continue;
const raw = await readFile(dir + "/" + file, "utf8");
out.push({
file,
digest: "sha256:" + createHash("sha256").update(raw).digest("hex"),
data: yaml.parse(raw),
});
}
return out;
}The join itself keeps two confidence levels separate:
function join(change, manifest) {
const op = manifest.data.consumedOperations.find(
(o) => o.method + " " + o.path === change.operation
);
if (!op) return null; // not a declared consumer of this operation
const deps = manifest.data.fieldDependencies.filter(
(d) => d.direction === change.direction && d.operation === op.operationId
);
const fieldLevel = deps.some((d) => fieldMatches(d.fields, change.pointer));
return {
consumer: manifest.data.consumer,
owner: manifest.data.owner,
deployedRevision: manifest.data.deployedRevision,
confidence: fieldLevel ? "field-level" : "operation-level",
// operation-level exposure is a lead, not a finding
risk: fieldLevel ? classify(change).risk : "potential-break",
};
}
An operation-level match floors the risk at potential-break rather than clearing it. That is deliberate: the consumer calls the endpoint, the manifest doesn't say which fields it reads, and "we don't know" must not render as "fine".
Missing, stale, and incomplete manifests are coverage gaps, not silence
Three failure modes the join must surface, not swallow:
- No manifest for a known consumer. Detected by comparing the manifest set against generated-client metadata from the internal registry. Renders as
unknown-coverage. - Stale manifest.
verifiedAtolder thanSTALE_AFTER_DAYS, or adeployedRevisionthat no longer matches the deployment record. Renders asunknown-coveragewith the reason. - Manifest with no contract test path. Renders as
potential-breakwithtestStatus: "not-run". Not a pass.
The common implementation bug here is findings.filter(Boolean) — dropping unmatched consumers from the output entirely, so the report is green because the join returned an empty array. Empty must mean "nothing matched", never "nothing is wrong".
An impact report with explicit evidence columns and no numerical score
Expected report excerpt for the fixture:
{
"schemaVersion": 1,
"baseline": { "path": "specs/orders.baseline.yaml", "digest": "sha256:1f9c...e2" },
"candidate": { "path": "specs/orders.candidate.yaml", "digest": "sha256:a74b...08" },
"inventoryRevision": "consumers@sha-5d1e0b3",
"findings": [
{
"consumer": "checkout-service",
"owner": "payments-platform",
"deployedRevision": "checkout-service@sha-9f2c1ab",
"operation": "POST /orders",
"pointer": "#/requestBody/properties/idempotencyKey",
"change": "required-property-added",
"confidence": "field-level",
"evidence": "fieldDependencies[0] declares createOrder request",
"risk": "potential-break",
"testStatus": "not-run"
},
{
"consumer": "checkout-service",
"owner": "payments-platform",
"deployedRevision": "checkout-service@sha-9f2c1ab",
"operation": "POST /orders",
"pointer": "#/responses/201/properties/estimatedShipDate",
"change": "property-removed",
"confidence": "field-level",
"evidence": "fieldDependencies[1] declares createOrder response fields",
"risk": "potential-break",
"testStatus": "not-run"
},
{
"consumer": "reporting-worker",
"owner": "analytics-platform",
"deployedRevision": "reporting-worker@sha-4be77d0",
"operation": "GET /orders",
"pointer": "#/responses/200/items/properties/status",
"change": "enum-value-added",
"confidence": "field-level",
"evidence": "fieldDependencies declares orders[].status with enumHandling: exhaustive",
"risk": "potential-break",
"testStatus": "not-run"
}
],
"coverage": { "unknownConsumers": [], "staleManifests": [] }
}
Six columns per finding, all defensible in review. No score, because a reviewer cannot act on 7.4 — they can act on "reporting-worker declares exhaustive handling of a value you just added".
Turn Predicted Risk Into Executable Contract Evidence
Drive a provider stub from the candidate contract, not from mocks
The stub is not a mock of the business logic. It is a thin HTTP server that enforces the candidate contract — request validation against the candidate schema, response construction from candidate enum values — so consumer code meets the proposed contract without a deployed provider.
import { createServer } from "node:http";
// schema is loaded from orders.candidate.yaml after OpenAPIParser.bundle()
export function startStub({ requestSchema, enumValues }) {
const ajv = new Ajv2020({ strict: false });
const validate = ajv.compile(requestSchema);
return createServer((req, res) => {
let body = "";
req.on("data", (c) => (body += c));
req.on("end", () => {
if (req.method === "POST" && req.url === "/orders") {
const parsed = body ? JSON.parse(body) : {};
if (!validate(parsed)) {
res.writeHead(400, { "content-type": "application/json" });
res.end(JSON.stringify({ errors: validate.errors }));
return;
}
res.writeHead(201, { "content-type": "application/json" });
res.end(JSON.stringify({
orderId: "ord_fixture_1",
status: enumValues.at(-1), // the newest candidate value
}));
return;
}
res.writeHead(404).end();
});
});
}Using enumValues.at(-1) — the newly added member — is the point. A stub that returned PENDING would pass every exhaustive client and prove nothing.
Reproduce both failures with real consumer code
The consumer code under test is real code, not a fixture-specific shim:
export async function createOrder(baseUrl, { currency, items }) {
const res = await fetch(baseUrl + "/orders", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ currency, items }),
});
const payload = await res.json();
return {
ok: res.status === 201,
status: res.status,
orderId: payload.orderId,
estimatedShipDate: payload.estimatedShipDate,
};
}const LABELS = {
PENDING: "Pending",
SHIPPED: "Shipped",
DELIVERED: "Delivered",
CANCELLED: "Cancelled",
};
export function statusLabel(status) {
const label = LABELS[status];
if (label === undefined) {
throw new Error("Unhandled order status: " + status);
}
return label;
}Both tests are contract tests in the precise sense: they exercise the consumer's request-building and response-handling code against the candidate contract.
Exact test commands, expected assertions, and the report rows they map to
$ npm run test:contract
Expected output for the candidate contract:
❯ consumers/checkout-service/tests/create-order.test.js (1 test | 1 failed)
× createOrder -> 201 with order id
AssertionError: expected 400 to be 201
- Expected: 201
+ Received: 400
❯ consumers/reporting-worker/tests/status-label.test.js (1 test | 1 failed)
× statusLabel handles every candidate enum value
Error: Unhandled order status: PARTIALLY_SHIPPED
Test Files 2 failed (2)
Tests 2 failed (2)
The reporting test is enum-driven, so it stays correct as the contract evolves:
const ENUM_VALUES = ["PENDING", "SHIPPED", "PARTIALLY_SHIPPED", "DELIVERED", "CANCELLED"];
it("statusLabel handles every candidate enum value", () => {
for (const value of ENUM_VALUES) {
expect(statusLabel(value)).toBeTypeOf("string"); // expected: throws on PARTIALLY_SHIPPED
}
});
Each failure maps back to a report entry:
| Report entry | Test | Expected result | Outcome |
|---|---|---|---|
checkout-service / POST /orders / required-property-added | create-order.test.js | 400 instead of 201 | confirmed-fixture-failure |
checkout-service / POST /orders / property-removed | create-order.test.js | estimatedShipDate undefined (not asserted) | remains potential-break |
reporting-worker / GET /orders / enum-value-added | status-label.test.js | throws on PARTIALLY_SHIPPED | confirmed-fixture-failure |
Note the middle row. The checkout test fails on the request change and never reaches its response assertion, so the removed property stays at potential-break. One failing test does not upgrade every finding on that consumer. Per-finding test attribution requires the test to declare which finding it covers — a small mapping file (tests/coverage-map.yaml) is worth the friction.
Passing against a stub does not prove the deployed provider conforms
This is the limitation that gets forgotten once the report is green. The stub is generated from the candidate document. If the implementation doesn't match the document, every test passes and production still breaks. Stub-based evidence proves consumer compatibility with the proposed contract, and nothing about the provider's conformance to it.
Provider conformance needs its own check: schema validation of real responses in a staged environment, or a provider-side contract verification step that replays recorded consumer requests against the deployed candidate. Both are outside a pull-request job's reach. The report should say so rather than letting a green CI badge imply end-to-end safety.
When Pact-style consumer-driven contracts earn their overhead
Consumer-driven contract testing, as Pact describes it, inverts the ownership: consumers declare the interactions they depend on, and the provider verifies it satisfies them. It adds value when you have many consumers you don't control, when the interaction is more than shape (status codes, headers, sequencing), and when you want provider CI to fail on behalf of a specific consumer.
It adds less value when the contract is a single OpenAPI document in one repo and the schema already captures the dependency — which is why the fixture uses schema-driven tests plus a stub rather than a full Pact broker. I'd reach for Pact when consumers are in different organizations or deployment cadences; I wouldn't add a broker to a monorepo with two internal callers.
Two things schema validation cannot do:
- Behavioral assertions.
statusLabel("PARTIALLY_SHIPPED")throwing is a behavioral fact. No JSON Schema validator will ever discover it, because the schema has no model of the client'sswitch. - Version targeting. The consumer's deployed revision is what breaks. Testing
mainofcheckout-serviceproves that unreleased code is compatible, which is useful and not the same claim.
Make CI Gate on Evidence, Coverage, and Release Context
Pipeline order: validate, diff, apply rules, join consumers, test, publish
Order matters, and each step should fail closed.
name: api-impact
on: pull_request
jobs:
impact:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.11.0
cache: npm
- run: npm ci
- run: npm run spec:validate
- run: npm run diff -- --baseline specs/orders.baseline.yaml --candidate specs/orders.candidate.yaml --out reports/diff.json
- run: npm run impact -- --diff reports/diff.json --consumers consumers --out reports/impact.json
- run: npm run test:contract
continue-on-error: true
- run: npm run gate -- --report reports/impact.json --tests reports/vitest.json
- uses: actions/upload-artifact@v4
if: always()
with:
name: api-impact-report
path: reports/continue-on-error: true on the test step is intentional: the gate decides outcomes, and a failing test is data the gate consumes, not an early exit that skips report generation. Everything runs, the artifact always uploads, and the gate is the single place that decides block-or-pass.
Four explicit outcomes, and deliberately no "safe" label
// scripts/gate.mjs (excerpt)
const BLOCKING = new Set(["confirmed-fixture-failure", "unknown-coverage"]);
for (const finding of report.findings) {
const outcome = resolveOutcome(finding, testResults);
if (!BLOCKING.has(outcome) && outcome !== "potential-break") continue;
const exception = activeException(finding, exceptions);
if (exception) continue;
failures.push({ finding, outcome });
}
Note that potential-break is also blocking unless an exception exists. For a team that wants a softer start, the honest way to soften it is an explicit --treat-potential-as-warn flag recorded in the artifact — not a default that quietly lowers the bar.
Block on confirmed breaks and unknowns, with expiring owner-approved exceptions
Exceptions live in a file, are reviewed like code, and expire:
- id: EXC-2411
match:
consumer: checkout-service
operation: POST /orders
change: required-property-added
owner: payments-platform
reason: "idempotencyKey is sent by checkout-service@sha-2b91e4c, rollout window 2026-12-02"
approvedBy: "@payments-oncall"
expiresOn: "2026-12-09"The gate rejects an expired exception with a distinct exit code, so the failure message is "exception EXC-2411 expired on 2026-12-09" and not a generic red X. An exception that expires is a correctness feature: it converts "we'll fix it later" into a dated commitment with a named owner.
Put digests, inventory revision, and test results in the CI artifact
The artifact is a directory, not a single file:
reports/
├── diff.json # semantic changes + both spec digests
├── impact.json # findings + inventory revision + consumer revisions
├── vitest.json # raw test results
└── gate-result.json # decision, rule ids fired, exceptions applied
gate-result.json is what a reviewer reads six weeks later:
{
"decision": "block",
"baselineDigest": "sha256:1f9c...e2",
"candidateDigest": "sha256:a74b...08",
"inventoryRevision": "consumers@sha-5d1e0b3",
"consumerRevisions": {
"checkout-service": "checkout-service@sha-9f2c1ab",
"reporting-worker": "reporting-worker@sha-4be77d0"
},
"blocking": [
{ "consumer": "checkout-service", "rule": "R1", "outcome": "confirmed-fixture-failure" },
{ "consumer": "reporting-worker", "rule": "R4", "outcome": "confirmed-fixture-failure" }
],
"exceptionsApplied": [],
"unknowns": []
}
Without those digests, "it passed in CI" is unfalsifiable.
A green PR goes stale when baselines or consumer deployments move
A green pull request is a statement about a moment. Three things invalidate it before the release train leaves:
- The baseline moved. Another pull request merged spec changes after yours passed. Your candidate is now diffed against a contract nobody is running.
- A consumer deployed.
checkout-service@sha-9f2c1abwas the tested revision;sha-2b91e4cshipped Tuesday with a new field read. - The inventory drifted. A new consumer registered an operation after your run.
The mitigation is to re-run the gate against the release baseline rather than the pull-request baseline, and to record release-baseline.json at deploy time:
{
"service": "orders-api",
"deployedAt": "2026-11-22T14:07:00Z",
"specDigest": "sha256:1f9c...e2",
"image": "orders-api@sha256:3ab7..."
}
If the digest in that file differs from the PR's baseline digest, the gate fails with stale-baseline. That check catches more real incidents than any refinement of the rule table.
Fix the Change Without Losing the Compatibility Evidence
Make idempotencyKey required in three phases, and keep a test for the old path
Do not make idempotencyKey required in the same release that introduces it. Three phases:
Phase 1 — expand (v1.5.0). Add the property as optional. Accept its absence. Old requests keep working.
CreateOrderRequest:
required: [currency, items] # idempotencyKey deliberately NOT required
properties:
idempotencyKey:
type: string
minLength: 16
x-introduced-in: 1.5.0
Phase 2 — migrate. checkout-service ships a release that sends the field. Its deployedRevision in the manifest changes, and the impact report for the same diff now returns compatible for that consumer.
Phase 3 — contract (v1.6.0). Only after every declared consumer's deployedRevision sends the field, move it into required. The report at this point should show no-detected-contract-risk for consumers whose tests send the field, and unknown-coverage for any consumer with a stale manifest — which is precisely the signal to keep before flipping.
Proving the old path still works is a test, not an argument:
it("still accepts a v1.4-shaped request without idempotencyKey", async () => {
const res = await fetch(baseUrl + "/orders", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ currency: "USD", items: [{ sku: "sku_1", quantity: 1 }] }),
});
expect(res.status).toBe(201); // expected: passes in phase 1/2, fails if merged too early
});
That test is worth keeping permanently in the provider repo. It encodes the compatibility promise from the previous version, and it fails the moment someone flips required early.
Deprecate the response property; do not "fix" enum tolerance with a default branch
Two different repairs, and I'd resist the reflex to apply the second one everywhere.
estimatedShipDate: keep it, mark it deprecated, and publish a sunset date the analyzer can read.
estimatedShipDate:
type: string
format: date
deprecated: true
x-sunset-after: "2027-02-01"
x-replacement: "/orders/{orderId}/shipments[0].estimatedDelivery"
Removal then happens when the impact report shows zero consumers declaring it and zero unknowns. The x-sunset-after extension gives the analyzer something to gate on instead of a date buried in a wiki page.
The new enum value: the tempting "fix" is to tell reporting-worker to add a default branch. That converts a loud failure into a silent mis-bucketing — PARTIALLY_SHIPPED becomes whatever the default says, and nobody notices until a finance report is wrong six weeks later.
Tolerance should be an explicit decision with instrumentation, not a defensive default:
export function statusLabel(status) {
const label = LABELS[status];
if (label !== undefined) return label;
metrics.increment("order_status.unmapped", { status });
return "Unknown (" + status + ")";
}
This is a legitimate design choice when paired with a metric and an alert. It is a bug when it is a default: added to silence a contract test. The analyzer can help here: when a consumer manifest declares enumHandling: exhaustive but the code has a fallback, flag the mismatch — the declaration and the implementation have diverged.
Expand-migrate-contract rollout with owner sign-off and rollback criteria
| Phase | Provider change | Gate condition to proceed | Rollback trigger |
|---|---|---|---|
| Expand | Add idempotencyKey optional, x-sunset-after on estimatedShipDate | Zero unknown-coverage findings | Error rate on POST /orders up >0.5% |
| Migrate | No contract change; consumers ship | Every consumer deployedRevision sends the field | Consumer 4xx rate up |
| Contract | idempotencyKey → required; remove deprecated field | Impact report clean for one full release cycle | Any confirmed-fixture-failure reappears |
Owner acknowledgment is the part teams skip. An exception entry with approvedBy and expiresOn is the mechanism: the platform owner signs off on a specific finding for a specific window, and the gate enforces the window. That is a different artifact from a Slack thread saying "yeah we'll handle it".
Compare before-and-after reports and keep the remaining unknowns visible
The comparison after the fix should show movement, not a status flip:
| Finding | Before | After phase 1 | After phase 3 |
|---|---|---|---|
checkout-service / idempotencyKey required | confirmed-fixture-failure | no-detected-contract-risk (optional) | no-detected-contract-risk (test sends it) |
checkout-service / estimatedShipDate removed | potential-break | potential-break (still declared) | no-detected-contract-risk (declaration dropped) |
reporting-worker / status enum | confirmed-fixture-failure | potential-break (tolerance + metric, owner-approved) | potential-break (unchanged, intentional) |
| Inventory coverage | unknownConsumers: [] | unknownConsumers: [] | unknownConsumers: ["inventory-service"] |
That last row is the important one. Phase 3 discovered a new consumer with no manifest, and the report says so instead of turning green. Keeping the gap visible through a "successful" rollout is the difference between a report and a rubber stamp.
Know What This Analyzer Still Cannot Prove
Behavior a contract diff cannot see: auth, pagination, invariants, latency, retries, and undocumented clients
The honest list of things a contract-based analyzer cannot see:
- Authorization.
POST /ordersnow requires a scope the consumer's token lacks. The schema is unchanged; every request 403s. - Pagination. Cursor semantics changed from opaque to offset-based. Same schema, different loop.
- Business invariants. Quantity
1is still schema-valid but now rejected for certain SKUs. - Latency and retry behavior. The endpoint now takes 4s, the client's timeout is 2s, and retries create duplicate orders — which is exactly what
idempotencyKeywas supposed to prevent, and the schema cannot express that. - Undocumented clients. A spreadsheet, a cron job in a shell script, a partner integration nobody registered. The inventory cannot include what nobody declared.
Contract analysis addresses shape. Every item above is shape-compatible and behavior-breaking.
Where integration tests, telemetry, and canary checks fill the gap
- Targeted integration tests for the behavioral items: assert the token scope, assert pagination termination, assert the business rule. These belong in the consumer repo, keyed to the same operation manifest entry so the impact report can cite them.
- Deployment telemetry for undocumented clients: sample provider-side request patterns and match
user-agent+ caller identity against the inventory. Undocumented callers show up as an inventory gap, not as silence. - Staged rollout checks for latency, retries, and error-rate shifts: run the candidate in a canary with real traffic and compare p95 and 5xx rate before promoting. The contract gate runs before the canary; it cannot replace it.
The layering is: contract gate catches shape breaks before merge, integration tests catch behavior breaks before release, canary catches everything else before full rollout.
A diff locates, an inventory names, and a test proves — within scope
The position, restated without hedging: a diff is a locator, not an analysis. It tells you where to look. The inventory tells you who to ask. The rules tell you what to suspect. The tests tell you what you actually know, and only within the scope they exercise.
Any tool that presents a spec diff as a verdict — green, red, or a score — is making a claim it cannot support. The report shapes in this post are designed so that every cell is either backed by a digest, a declaration, or an executed test, and everything else is labeled unknown. That is a lower bar than "we can prove compatibility" and a much higher one than "the diff looked fine".
The Netflix report is a useful reminder that large platforms treat this as a first-class problem. It is not a recipe, and the snippet does not say how Quasar solves it. The design above is mine, the fixture is reproducible, and the unknowns are printed next to the answers.
Further Reading and Source Boundaries
The TechGig report on Netflix Quasar (secondary source)
- TechGig report: "Netflix builds Quasar to track API changes impact" — published November 28, 2026. Secondary source, accessed via a Google News redirect. It supports exactly one claim in this post: that Netflix built a system called Quasar for tracking API-change impact. It is not an implementation reference, and nothing in it describes architecture, supported formats, or availability.
OpenAPI 3.1.1 and JSON Schema 2020-12 (primary specifications)
- OpenAPI Specification 3.1.1 — the primary source for operation objects, request bodies, responses, and the JSON Schema 2020-12 alignment that makes
type: ["string", "null"]legal. Every rule in the table above is a judgment layered on these definitions, not a restatement of them. - JSON Schema Core, draft 2020-12 — for
required,additionalProperties, and composition keywords (oneOf,allOf,if/then/else). Useful if you want to go past the rule table and toward actual schema-satisfiability checking.
Pact consumer-driven contracts and RFC 9110 HTTP semantics
- Pact: How Pact works — the clearest description of the consumer-declares / provider-verifies inversion. Read it before deciding whether your situation needs a broker or just schema-driven tests plus a stub, as in this walkthrough.
- RFC 9110: HTTP Semantics — the source for status-code semantics referenced in rule R8, and for why a removed response code is a behavior change rather than a formatting detail.
More posts

Diffing OpenAPI Specs in CI with TypeScript to Block Breaking Changes
A practical walkthrough of using TypeScript and OpenAPI spec diffing in CI pipelines to catch contract-breaking API changes before they reach consumers.

Why a Committed PostgreSQL Write Can Still Produce a Failed Node.js Response
A deep technical walkthrough of how a Node.js API can commit a PostgreSQL transaction yet still return a failure to the client, and how idempotency keys, atomic writes, and response replay make retries safe.

Measuring Cost per Verified Change in JavaScript Coding Agents
This deep walkthrough builds a reproducible evaluation harness for JavaScript coding agents, measuring verified task completion, regressions, tool calls, latency, and cost per verified change beyond Hurdle benchmarks and VS Code's growing agent autonomy.
Loading comments…