Entimema

Detecting Silent Schema Changes Before They Break Risk Models

Entimema
Contents

Yesterday, payment_status = 1 meant SETTLED and 2 meant REVERSED. Today, the producer reuses 1 for AUTHORISED, 2 for SETTLED and adds 3 for REVERSED. The field remains INTEGER. Parsing succeeds. SettledPaymentCount_30d now counts authorisations.

YESTERDAY1 = SETTLED2 = REVERSED
same INTEGER field
TODAY1 = AUTHORISED2 = SETTLED3 = REVERSED
PIPELINE: GREEN
RISK MEANING: WRONG
SchemaValid ≠ SemanticValid
Foundational boundary

A complete contract governs structure and economic interpretation

Two contract layers
LayerDefinesExamples
SyntacticFields, types, required/optional, enum shape, nullability and structureamount DECIMAL; payment_status required
SemanticEconomic meaning, units, time basis, scope, ownership and versionminor units; settled time; principal-only balance
type SemanticContract = {
  field: string;
  meaning: string;
  unit?: string;
  timeBasis?: string;
  owner: string;
  version: string;
};

Ask what status=1 means, whether amount is gross or net, whether time is UTC or local, whether balance includes pending and whether payment date means initiated or settled. Schema validation cannot answer these questions.

Silent drift has six forms that demand different evidence

STRUCTURALshape · type · required fieldsSEMANTICmeaning · units · sign · time basisPOPULATIONwhich records are emittedIDENTITYkeys · mapping coverageFRESHNESSwhen evidence arrivesBEHAVIOURALborrowers actually changed
The first five can arise from infrastructure or source change; behavioural drift reflects genuine customer behaviour. Distribution movement alone cannot distinguish them.
High-impact semantic drift examples
DriftSame technical shapeEconomic failure
Unitamount = 500€500 becomes 500 cents / €5
Scaleutilisation numeric0.72 becomes 72
Null meaningNULLUnavailable becomes not applicable
TimestamptimestampSettlement time becomes processing time
Timezoneparseable timestampUTC becomes local without offset
Signnumeric amountSigned reversal becomes positive amount + type
Scopebalance numericPrincipal-only becomes principal + interest + fees
Aggregationamount numericTransaction row becomes daily aggregate

Unknown enums must not silently become OTHER when distinctions affect models. Date rounding can leak same-day information; join-key formatting such as 001234 → 1234 can collapse identity coverage without breaking a type.

The registry gives every critical source technical and domain ownership

type DataContract = {
  source: string;
  object: string;
  version: string;
  schema: SchemaDefinition;
  semantics: SemanticDefinition[];
  owner: string;
};

The producer declares schema version, semantic version and change type where possible. Consumers declare exactly which fields and interpretations they depend on. Technical owners understand format; domain owners establish economic meaning.

Contract change classification
ClassExampleGovernance
Additive compatibleUnused optional fieldProportional validation; usually non-blocking
Syntactic breakingINTEGER → STRINGExplicit adapter/consumer change
Semantic breakingpayment_date redefinedVersioned semantic review and impact assessment
Behavioural breakingUpstream filter changes emitted populationShadow distributions, features and decisions

Use meaningful schemaVersion and semanticVersion; do not over-version irrelevant metadata. Compatibility is a producer/consumer matrix, not a label attached only to the producer.

Field-to-decision lineage turns a source change into a measurable blast radius

SOURCE FIELD · payment_statusCANONICAL FIELD · settled_payment_flagFEATURE · payment_count_30dMODEL · behavioural PDDECISION · EWS / collections
Consumer contracts state the path explicitly so incident scope and release risk can be traced before or after a change.

Each feature value records its source-contract version, canonical mapping version and feature-definition version. Training dataset manifests retain contract versions; otherwise historical reproduction silently uses today's semantics.

Versioned adapters absorb source churn without hiding real semantic change

Sourcev → Canonicalv preserves defined economic meaning
Adapter proof obligation

A source rename should require only an adapter change while canonical output stays stable. If economic meaning truly changes, version the canonical contract rather than conceal it inside mapping logic.

type SourceChangeManifest = {
  source: string;
  changeVersion: string;
  expectedChanges: string[];
  effectiveAt: Date;
};

During a transition window, process explicit message versions; do not infer them from payload guesses. An unsupported version is quarantined or fails controlled for decision-critical data. Keep the prior adapter available for rollback without deleting received raw events.

Shadow and canary validation must reach the decision layer

OLD ADAPTER / CONTRACTSAME SOURCE RECORDSNEW ADAPTER / CONTRACT
Decision-safe comparison stack
LayerCompare
CanonicalEvent type, amount, identity, effective/available timestamps
FeatureEntity-level values and distributions
ModelScore/band deltas under the same model
DecisionOutcome and action transitions by materiality
ΔX = Xnew source − Xold source
Feature impact
ChangedDecisions / ComparedDecisions
Decision impact rate

Small feature changes can cross policy boundaries, so feature stability does not guarantee decision stability. Before release: contract tests pass, canonical and feature diffs are understood, decision impact is reviewed and rollback is executable. Canary a controlled sample before full cutover.

Runtime sentinels catch unannounced source changes

Runtime semantic detection
SignalPossible break
Unknown enum appearsUnannounced code/version change
Amounts become 100× smallerUnit change
Received−event time shifts exactly one hourTimezone/DST interpretation
Null rate 1% → 45%Producer or population failure
Category cardinality changesEnum/filter drift
MappingCoverage fallsJoin-key/identity drift
Row volume collapses/spikesExtraction/filter change or genuine seasonality
Freshness deterioratesCadence/latency contract broken
MappingCoverage = MappedRecords / TotalRecords
Mapping coverage

Use domain-valid ranges and economic invariants such as reversal amount ≤ original amount or Available = Limit − Drawn − Pending under defined semantics. Distribution shifts are signals, not automatic proof: compare change context and borrower behaviour.

Historical data must retain the semantics effective at the time

A contract change needs effective_from. To rebuild an old feature or decision, load the historical source/canonical interpretation; applying today's adapter to old raw data can rewrite meaning.

Historical change semantics
ChangeHistorical treatment
Source correctionOld data were wrong; preserve original and versioned restatement
Source redefinitionMeaning changes prospectively from effective date
Backfill under new semanticsLabel state mode/version; never overwrite decision input history
Rollback after bad adapterReplay durable raw data through corrected adapter into new projection

Golden semantic cases and mutation tests attack meaning, not only shape

Golden contract dataset
CaseInputExpected proof
A€500 payment in declared minor unitsCanonical amount and currency fixed
BCausally linked reversalSign and original reference preserved
CUTC timestampEffective ordering unchanged
DUnknown enumGoverned quarantine/failure, never silent coercion
EMissing identifierMapping failure visible; affected record not misjoined
Contract mutation testing
MutationDetection
Multiply amount by 100Unit invariant/sentinel fails
Shift timezoneTimestamp-lag and ordering tests fail
Swap status mappingGolden semantic output and feature diff fail
Flip sign conventionFinancial-state invariant fails
Increase nullsNull contract and runtime rate fail
Add unsupported versionControlled quarantine/failure

Run old and new adapters through the full feature and decision pipeline. Only changes declared in the change manifest should differ.

Semantic incidents require end-to-end scope and decision revalidation

Determine the interval from semantic change to detection, then use dependency lineage to identify affected raw records, canonical events, features, scores, decisions and actions.

SOURCE RECORDSCANONICAL EVENTSFEATURE VALUESMODEL SCORESDECISIONSACTIONS

Reconstruct corrected features/state and compare actual with corrected decisions. Preserve historical outcomes and route remediation through governance rather than overwriting them automatically.

Monitor contracts in economic units and decision outcomes

ContractViolationRateUnknownEnumRateNullRateShiftMappingCoverageSemanticSentinelDriftFeatureDiffRateDecisionImpactRateUnsupportedVersionRate

Also monitor payment totals, exposure, utilisation, reversal ratios and DPD transitions. These business measures reveal failures that parser success, schema registries and infrastructure uptime cannot.

The Entimema architecture gates source change by decision impact

SOURCE SYSTEMSCHEMA + SEMANTIC CONTRACTVERSIONED ADAPTERCANONICAL DATA / EVENTSFEATURE PIPELINEMODELDECISION
CONTROL PATH
CONTRACT TESTSSHADOW COMPARISONFEATURE DIFFDECISION DIFFRELEASE GATE / RUNTIME MONITORING
Versioned adapters stabilise canonical meaning while a parallel control path tests compatibility, compares features and decisions, gates release and monitors unannounced drift.
ENTIMEMA FRAMEWORKDetect → Compare → Assess → Gate → Monitor
  1. Define source contract
  2. Define semantic meaning
  3. Version changes
  4. Test compatibility
  5. Run shadow adapter
  6. Compare canonical outputs
  7. Compare features
  8. Measure decision impact
  9. Gate release
  10. Monitor runtime drift
  11. Roll back and replay if needed

A Data Contract & Semantic Drift Agent can trace silent change without approving it

A controlled agent can monitor versions, unknown fields and enums, null/cardinality/unit anomalies, compare contract versions, trace source fields to affected models, run feature comparisons, quantify decision impact and identify historical decisions affected by semantic defects.

Continue with Backpressure and Failure Recovery, From Batch ETL to Event-Driven Credit Risk Architecture, Building a Credit Risk Feature Store, Point-in-Time Correct Features, Streaming Behavioural Features, Decision Engine Monitoring and The Hidden Infrastructure Debt of Modern Lending. Infrastructure feature drift and decision-system observability remain future research directions—not fabricated routes.