This content reflects minia2a as of its publication date and is kept for the record. Current model: x402 pay-per-call in USDC on Base only, 5 free trial calls per signed wallet, no credits and no top-up rail.

Deleting a field from the handler does not delete it from the advertisement

2026-12-05 · one field, four advertisement surfaces, and the checks that make them agree

An endpoint used to offer two ways to sign a message: send it the message and receive a hash to sign locally, or send it your private key and let the server sign. The second option is a bad idea for reasons that need no repeating. It was retired: the handler now returns a 400 if a request carries privateKey, and it never echoes the value back.

The handler change took minutes. The field stayed in the advertisement for longer, in four different places, each with a different source. This post is about those four places — because a retired field is not one edit, and the last surface to update is the one the next build reads.

1. The 402 example is compiled, not rendered

An x402 challenge carries an input example. On our seller, that example is generated from a table that is compiled into the gateway binary at build time. A draft copy of the table sits on the host for the next build.

The live 402 stopped advertising the key as soon as the binary changed. The draft did not. It still held:

"x402-eth-sign": {"message": "hello", "privateKey": "0x0101…0101"} 

Nothing in the running system reads the draft, so every live check was green. The trap is one step away: the next build merges that draft, and the retired field reappears in a 402 that the new handler answers with 400. The fix is not the handler; it is the draft — and a guard that runs the handler against the draft's own example, so a mismatch is a red check instead of a future incident.

If an example is going to be compiled, check the compiled-from file, not just the served bytes. The served document proves what is running today; the draft proves what ships next.

2. The OpenAPI document is a snapshot with a writer

Our openapi.json is generated from a field table by an hourly job. The handler changed at 10:16. The generator had last run at 09:47. So the spec still said:

GET /x402/eth-sign parameters: …, privateKey (required: false) POST /x402/eth-sign requestBody.properties.privateKey 

A client that reads the spec has no way to know the handler refuses the field. It is the same promise as the 402 example, on a different surface, with a different update clock.

The check that closes this is cheap: compare the generated document with the table it is generated from, field for field, and refuse a document that advertises a field the table no longer declares. Running the generator again produced a spec with zero privateKey occurrences; running it on the host and locally produced the same MD5, which is the only proof that "the surface I checked" and "the surface that is served" are the same bytes.

3. The MCP inputSchema is read once at startup

An MCP server advertises tools with an inputSchema. Ours is built from an in-memory map that is loaded at process start. Editing the file on disk does not change what the running process answers until it restarts — and restarting a payment gateway is not something a cron job should do on its own.

So there is a deliberate window where the file says one thing and tools/list says another. The rule we follow is to make the file correct immediately, let the served schema lag, and treat the gap as a named signal ("needs gateway reload") rather than editing the process. The advertisement must never be ahead of the handler in the dangerous direction: a schema that asks for a secret is not a stale doc, it is a request to leak one.

4. Prose is a surface too

The old description said the server-side signing path was "deprecated; if you use it, …". That sentence is worse than silence: it tells a reader the field still works, and it was the only surface that mentioned a key at all after the schema was fixed. If a path is refused, the prose must say refused, not deprecated. "Deprecated" is a promise with no date.

The two checks that make the surfaces agree

Everything above reduces to two invariants:

  1. The handler accepts its own advertised example. Take the example from the 402 (or the draft that will become it), run it through the deployed handler in an offline harness, and fail if the handler answers 400. An example you publish is a promise you break at the first call.
  2. The generated document matches its source table. Diff the two faces — OpenAPI vs schema, draft vs build source — and fail on any field present in one and absent from the other. Direction matters: a field the handler refuses must not be advertised, even if it is optional.

Both checks are ordinary code, and both catch the failure that humans miss because the live endpoint looks healthy: the handler is correct, the 402 is correct, and the next deploy is wrong.

What generalises

  • A field retirement is a multi-surface change. List every surface that names the field: request schema, example, generated spec, prose, and any draft that feeds a build. Each has its own clock.
  • Never accept a secret in a request schema. If the schema asks for a private key, every proxy, log line and cache between the caller and the handler is now in scope. Sign locally; send a signature or a hash.
  • Generate examples from the handler, then test them against it. Hand-written examples rot in the direction of the last person who edited them.
  • Prefer refusal to deprecation. A deprecated field that still works is a field with two behaviours. A refused field has one.

The handler is the easy part. The advertisement is the part that outlives it — and the part a buyer reads before deciding whether to pay.

← All posts

Originally published at minia2a.uk.