Something went wrong. Try again.
A ebook and PDF reader, annotator, and citation manager.
Something went wrong. Try again.
2.4 kB 46 lines
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647== Schema source freeze during refactoring
The refactor must not change the database schema. These independent SHA-256fingerprints capture the pre-refactor runtime SQL literals, frozen SQL fixturesand migration implementation. Check source text directly so this guard can runbefore native compilation, without opening a library or changing its label.A mismatch is a review failure, not permission to refresh the fingerprints.
This is a strict source freeze, not proof of runtime schema or payload parity.Keep the migration regressions and full SQLite object/payload comparisons asseparate gates before changing persistence. The two whole-file fingerprintsintentionally freeze migration code and prose until a narrower reviewed changeis necessary; no blanket exception is made for formatting.
```javascript#| file: tangled/scripts/check-schema.mjsimport { createHash } from "node:crypto";import { readFileSync } from "node:fs";
/** Pre-refactor fingerprints; never regenerate these to make a refactor pass. * @type {ReadonlyArray<readonly [string, boolean, string]>} */const frozen = [ ["rust-document-storage.typ", true, "ff1ea20264f0499f07dd677728c4c112cc91ad79f8e2b354a01e5815bde68e17"], ["snapshot-capture-storage.typ", true, "9a5d8516077e0d2376e5d3883f0993f8ab352dc79861db0bb4969bee16402943"], ["database-migration-schemas.typ", false, "5d830033ab47aeaa02ac29fabd07fe7da33f113a1d3ad8ce67c606144a12babe"], ["database-migrations.typ", false, "a2fde88f3da466cf8bf433436ac55d5c6e1a974acc18b701d47d1fb76806523e"],];
for (const [file, literal, expected] of frozen) { const source = readFileSync(`src/${file}`, "utf8"); const matches = [...source.matchAll(/pub\(crate\) const SCHEMA: &str = r#"([\s\S]*?)"#;/g)]; if (literal && matches.length !== 1) { throw new Error(`Expected exactly one frozen SCHEMA literal in src/${file}`); } const value = literal ? matches[0][1] : source; const actual = createHash("sha256").update(value).digest("hex"); if (actual !== expected) { throw new Error(`Schema source freeze violated: src/${file}. Preserve the pre-refactor definition.`); }}console.log("Frozen schema and migration sources match the pre-refactor baseline.");```
The source checker runs this guard and JavaScript syntax checks after Loom.It does not claim generated-source synchronization: Loom is the sole tangler,and its output must be reviewed separately. There is no legacy sync script.