fix(supabase): confirmed uploads gate asset reads (hash claim), seeds-listed test, Dockerfile workspace manifests; importer declares every authored label, real in=out control

This commit is contained in:
bchanot committed 2026-10-09 00:50:36 +02:00
1 parent bbfb8d6203
commit dee4ce43d9
28 files changed
+511 -87

No files matched your search

@@ -0,0 +1,46 @@
import { renderSeedSql, DOCUMENT_DOLLAR_TAG } from '../src'
import { mapAnnotation } from '../src/legacy/annotations'
import { assertNothingDropped } from '../src/legacy/catalog'
import { parseAnnotatedSvg } from '../src/legacy/svg'
import { runImport } from './helpers'
/** Guards that never fire on today's data, proven on synthetic inputs. */
const SVG_WITHOUT_EN = `<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
<circle cx="1" cy="2" r="3" data-anno-id="point-x"
data-anno-name-fr="Garrot" data-anno-category="os"/>
</svg>`
describe('importer guards', () => {
it('throws when a zone loses a vet referral', () => {
const before = { nodes: 10, leaves: 7, vetReferrals: 2 }
const after = { nodes: 10, leaves: 7, vetReferrals: 1 }
expect(() => assertNothingDropped('hip', before, after)).toThrow(
'zone hip: vetReferrals 2 in, 1 out',
)
expect(() => assertNothingDropped('hip', before, before)).not.toThrow()
})
it('copies FR into EN when data-anno-name-en is absent, and says so', () => {
const [legacy] = parseAnnotatedSvg(SVG_WITHOUT_EN, 'x.svg').annotations
const mapped = mapAnnotation(legacy!, {
viewId: 'main',
fileName: 'x.svg',
zoneByNames: new Map(),
})
expect(mapped.annotation.name).toEqual({ fr: 'Garrot', en: 'Garrot' })
expect(mapped.anomalies.map((a) => [a.code, a.level])).toContainEqual([
'annotation.name_en.missing',
'a_valider',
])
})
it('refuses a document that contains the dollar-quote tag', async () => {
const result = await runImport()
const documentJson = JSON.stringify({ note: DOCUMENT_DOLLAR_TAG })
expect(() => renderSeedSql({ result, documentJson })).toThrow(
DOCUMENT_DOLLAR_TAG,
)
})
})