Why Provider Schema Downgrades Must Fail at Compile Time
A provider adapter can serialize every field correctly and still weaken the contract.
That is the schema portability problem I care about. The payload may remain valid JSON. The request may even be accepted. Yet a constraint that existed in the source contract—an enum, a numeric bound, a pattern, a closed object—may no longer be enforced by the target provider. At that point the adapter has preserved syntax while losing meaning.
I do not think this should be discovered after generation. In FACET, a lossy schema translation should be a compile-time event with an explicit receipt.
The hidden gap between type checking and rendering
The current FACET compiler already has the right architectural separation. Its type system represents constraints such as min, max, regular-expression patterns, and enumerated values. Its provider schema layer renders a shared tool definition into OpenAI-, Anthropic-, or Llama-shaped payloads. The FACET adapter requirements are stricter still: adapters must map canonical JSON passively, must not repair semantics, and must fail when a provider constraint cannot be satisfied.
Those pieces establish the boundary. They do not, by themselves, prove that every source constraint survived a particular provider dialect.
Consider a small contract:
amount: float(min=0.01, max=10000)
currency: string(enum=["USD", "EUR"])
reference: string(pattern="^[A-Z]{3}-[0-9]{8}$")
There are at least four different outcomes:
| Result | What happened | Acceptable? |
|---|---|---|
| preserved | the target enforces the same constraint | yes |
| lowered | an equivalent target construct was used | yes, if equivalence is proven |
| runtime-guarded | the provider cannot enforce it, but the FACET host validates before any effect | only by explicit policy |
| dropped | the constraint disappeared | no |
A plain provider payload does not explain which outcome occurred. That missing explanation is the artifact I want.
A constraint-loss receipt
Compilation should emit a machine-readable receipt beside the rendered payload:
{
"target_profile": "provider-x/strict-tools-v3",
"source_schema_digest": "sha256:...",
"rendered_schema_digest": "sha256:...",
"constraints": [
{
"path": "$.amount.minimum",
"status": "preserved",
"enforced_by": "provider"
},
{
"path": "$.reference.pattern",
"status": "runtime-guarded",
"enforced_by": "facet-host",
"guard": "pre-dispatch"
}
],
"lossy": false
}
This is not another verbose trace. It answers one narrow question: which obligations crossed the provider boundary, and where are they enforced now?
The compiler can then apply a simple policy:
if status == dropped:
fail compilation
if status == runtime-guarded and profile forbids fallback:
fail compilation
if status == runtime-guarded:
bind guard identity into the execution artifact
The important part is that fallback is not invented inside the adapter. The target profile and contract policy authorize it before rendering. The adapter remains behaviorally passive, as the FACET adapter contract requires.
Capability profiles must be versioned
“Supports JSON Schema” is too coarse to be an engineering claim. Providers and runtimes support subsets, extensions, limits, and different failure behavior. A useful target profile therefore needs a versioned capability matrix:
schema_profile: provider-x/strict-tools-v3
supports:
enum: native
minimum: native
maximum: native
pattern: host_guard
additionalProperties_false: native
recursive_ref: unsupported
The profile is a compiler input, not ambient documentation. Changing it can change whether a contract compiles, where a constraint is enforced, and which receipt is produced. Its identity belongs beside the source and canonical artifact identities.
This follows the same discipline as making the FACET host profile part of the contract: environmental semantics that can change the result must not remain invisible. It also complements typed runtime inputs. Input typing defines what values may enter; the schema-loss receipt proves what the selected provider boundary still promises.
Why post-generation validation is not enough
Host validation remains necessary. Schema-valid data can still be factually wrong, stale, or unauthorized. But post-generation validation cannot retroactively make a weakened generation boundary equivalent to the original one.
There is a practical difference between:
- a provider constrained from emitting an invalid enum value;
- a host rejecting that value after tokens were generated;
- a host repairing it and continuing.
The first preserves the declared generation boundary. The second contains failure but changes cost and control flow. The third changes semantics and should never be smuggled in as “compatibility.” These outcomes deserve different receipt statuses.
The same distinction appears in why provider adapters must not think. The new mechanism is narrower: it gives the compiler a way to prove that passive translation did not erase constraints.
What this mechanism does not prove
A clean receipt does not prove that model output is true. It does not prove that a provider implements its documented schema behavior perfectly. It does not replace semantic validation, authorization, or tests. And the current public FACET compiler code exposes constraint validation and provider-shaped tool schemas, but I am not claiming that it already emits this receipt.
This is an implementation proposal derived from the existing FACET boundary: type constraints above, canonical representation in the middle, passive adapters below.
Portability should preserve obligations
Most portability layers ask whether the same request can be sent to another model. I think that is the weaker question.
The stronger question is whether the same obligations survive the move.
A constraint-loss receipt turns that question into a reviewable artifact. It makes provider migration fail before deployment when semantics would be dropped. It allows explicitly governed host-side enforcement when equivalence is impossible. And it keeps adapters small: translate what the compiler authorized, report incompatibility, never improvise.
That is the kind of portability FACET should demand—not identical JSON shapes, but preserved contract meaning.