feat(domain): R2.2 sheet integrity rules, publish check, SheetIndexData and SQL conformance in Rust

The 21 rules of validateSheetDocument ported with identical codes,
severities, paths and messages (frozen from the TypeScript on 26
conformance fixtures), createEmptySheetDocument, the publish check
(strict shape then rules), and the index data React reads once (positions
with Map semantics, names, spine ids, finding-path keys). The fixtures
also carry the codes private.sheet_document_issues returns: a cargo test
generates supabase/tests/011_sheet_conformance.sql and refuses drift
(PGlite 12/12 files, real stack 446/446). .prettierignore keeps the
byte-exact oracles and generated fixtures out of pnpm format.
This commit is contained in:
bchanot committed 2026-10-14 00:17:21 +02:00
1 parent 343d6f4c1f
commit 0c47d0f837
40 files changed
+3280 -1

No files matched your search

@@ -0,0 +1,26 @@
/**
* R2: the horse slice fixture as JSON for the Rust suites (crates/core/tests/fixtures),
* written from the TypeScript fixture with `MAKE_R2_ORACLES=1`, asserted otherwise.
*/
import { readFileSync, writeFileSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
import { HORSE_MAIN_ASSET_ID, horseSliceInput } from './fixtures/horse-slice'
const FILE = resolve(
dirname(fileURLToPath(import.meta.url)),
'../../../crates/core/tests/fixtures/horse-slice.json',
)
describe('horse slice JSON fixture', () => {
it('equals the TypeScript lean input', () => {
const fixture = {
mainAssetId: HORSE_MAIN_ASSET_ID,
input: horseSliceInput(),
}
const text = `${JSON.stringify(fixture, null, 2)}\n`
if (process.env.MAKE_R2_ORACLES === '1') writeFileSync(FILE, text)
expect(readFileSync(FILE, 'utf8')).toBe(text)
})
})