Assert that folding every version entry reproduces the CURRENT declared schema.
This is the co-located guard: change a component or resource and forget to
record it, and this throws — with an actionable recipe for fixing it.
components/resources are the app's current persistent schemas (inject the
plugin's, minus the built-ins). Pass currentVersion (the db's version) to also
assert it equals entries.length - 1 (the current version).
On drift the message classifies every change as auto-convertible (record a
merge-patch, no handler) or breaking (record a patch AND a handler), and prints
the exact new entry to append — so a human just re-runs after editing schemas,
and an agent can apply the fix mechanically.
Assert that folding every version entry reproduces the CURRENT declared schema. This is the co-located guard: change a component or resource and forget to record it, and this throws — with an actionable recipe for fixing it.
components/resourcesare the app's current persistent schemas (inject the plugin's, minus the built-ins). PasscurrentVersion(the db'sversion) to also assert it equalsentries.length - 1(the current version).On drift the message classifies every change as auto-convertible (record a merge-patch, no handler) or breaking (record a patch AND a handler), and prints the exact new entry to append — so a human just re-runs after editing schemas, and an agent can apply the fix mechanically.