Reference Implementation Architecture
ADDED Requirements
Requirement: A reusable reconciliation primitive SHALL be available for manifest-vs-schema-vs-emit drift checks
The polyfill-connectors package SHALL provide a pure-function reconciler (reconcile, parseManifestStreams, parseSchemaStreams, scanEmittedStreams, and reconcileFromDisk in src/manifest-reconcile.ts) that compares declared streams (manifest), registered streams (schema registry keys), and emit-site stream-name literals (static-scanned from connector source).
The reconciler SHALL flag three drift classes:
missing_manifest— emitted but not declared in the manifest. Public-contract gap.missing_schema— emitted but not registered in the connector'sSCHEMAS. Runtime-validation gap.missing_emit— declared in the manifest but neither registered inSCHEMASnor literal-emitted. Public-contract overclaim with no fulfillment path.
A connector SHALL be considered aligned (ok: true) when all three drift arrays are empty. Declared and registered but not literal-emitted is acceptable: the schema registration is treated as the contract that the connector can populate the stream, and the emit-scan is a heuristic that may miss dynamic emits.
Scenario: A connector starts emitting a new stream
- WHEN an emit literal
emitRecord("new_stream", ...)is added to a connector's source - THEN running the reconciler SHALL flag
missing_manifestandmissing_schemauntil both are added - AND the regression-test in
bin/reconcile-manifests.test.tsSHALL fail
Requirement: A regression test SHALL run reconciliation against every schema-bearing connector
A test under bin/reconcile-manifests.test.ts SHALL iterate every connector that ships a schemas.ts and assert the reconciler reports ok: true. The test SHALL fail with the drift detail (missing arrays + declared/registered/emitted snapshots) when any connector drifts.
Scenario: A schema edit removes a stream from the registry without removing it from the manifest
- WHEN the connector's
SCHEMASregistry no longer includes a stream that the manifest still declares - THEN the regression test SHALL fail with
missing_emitlisting that stream (ormissing_schemaif the connector still emits it)