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:
1 parent
bbfb8d6203
commit
dee4ce43d9
28 files changed
+511
-87
No files matched your search
@@ -17,7 +17,7 @@ export const repoRoot = resolve(here, '../../../..')
|
||||
export const supabaseDir = join(repoRoot, 'supabase')
|
||||
export const migrationsDir = join(supabaseDir, 'migrations')
|
||||
export const pgTapTestsDir = join(supabaseDir, 'tests')
|
||||
/** Versioned seeds (reference data such as the official sheets); seed.sql itself needs the real auth schema and stays out. */
|
||||
/** Versioned seeds (reference data such as the official sheets); seed.sql itself needs the real auth schema and stays out. The CLI reads literal paths from config.toml: the seeds test checks every file here is listed. */
|
||||
export const seedDir = join(supabaseDir, 'seed')
|
||||
|
||||
async function listSqlFiles(dir: string): Promise<string[]> {
|
||||
|
||||
@@ -29,6 +29,7 @@ const expectedColumns = {
|
||||
'id',
|
||||
'sha256',
|
||||
'sheet_id',
|
||||
'uploaded_at',
|
||||
],
|
||||
anatomical_sheet_versions: [
|
||||
'change_note',
|
||||
@@ -106,6 +107,7 @@ type FunctionArgs = {
|
||||
}
|
||||
const expectedFunctionArgs = {
|
||||
archive_anatomical_sheet: ['sheet_id'],
|
||||
confirm_sheet_asset_upload: ['asset_id'],
|
||||
create_anatomical_sheet: [
|
||||
'description',
|
||||
'document',
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import { join, relative } from 'node:path'
|
||||
import { listSeeds, seedDir, supabaseDir } from './harness'
|
||||
|
||||
/**
|
||||
* The CLI applies only the literal files of config.toml sql_paths, while the
|
||||
* harness applies every seed on disk: a seed forgotten in the list would pass
|
||||
* here and never reach `supabase db reset`.
|
||||
*/
|
||||
describe('versioned seeds', () => {
|
||||
it('are all listed in config.toml [db.seed] sql_paths', async () => {
|
||||
const config = await readFile(join(supabaseDir, 'config.toml'), 'utf8')
|
||||
const line = config.match(/^sql_paths\s*=\s*\[(.*)\]/m)?.[1] ?? ''
|
||||
const listed = [...line.matchAll(/"([^"]+)"/g)].map((m) => m[1])
|
||||
for (const file of await listSeeds()) {
|
||||
const path = './' + relative(supabaseDir, join(seedDir, file))
|
||||
expect(listed, `${path} missing from sql_paths`).toContain(path)
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user