Integrate crabrl parser into taxonomy hydration

This commit is contained in:
2026-03-16 15:18:01 -04:00
parent cf084793ed
commit a58b07456e
23 changed files with 4696 additions and 2466 deletions

View File

@@ -1,17 +1,17 @@
import { describe, expect, it } from 'bun:test';
import { mkdtempSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { Database } from 'bun:sqlite';
import { ensureFinancialIngestionSchemaHealthy } from '../lib/server/db/financial-ingestion-schema';
import { hasColumn, hasTable } from '../lib/server/db/sqlite-schema-compat';
import { prepareE2eDatabase } from './e2e-prepare';
import { describe, expect, it } from "bun:test";
import { mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { Database } from "bun:sqlite";
import { ensureFinancialIngestionSchemaHealthy } from "../lib/server/db/financial-ingestion-schema";
import { hasColumn, hasTable } from "../lib/server/db/sqlite-schema-compat";
import { prepareE2eDatabase } from "./e2e-prepare";
describe('prepareE2eDatabase', () => {
it('bootstraps a fresh e2e database with the current taxonomy schema shape', () => {
const tempDir = mkdtempSync(join(tmpdir(), 'fiscal-e2e-prepare-'));
const databasePath = join(tempDir, 'e2e.sqlite');
const workflowDataDir = join(tempDir, 'workflow-data');
describe("prepareE2eDatabase", () => {
it("bootstraps a fresh e2e database with the current taxonomy schema shape", () => {
const tempDir = mkdtempSync(join(tmpdir(), "fiscal-e2e-prepare-"));
const databasePath = join(tempDir, "e2e.sqlite");
const workflowDataDir = join(tempDir, "workflow-data");
try {
prepareE2eDatabase({ databasePath, workflowDataDir });
@@ -19,12 +19,19 @@ describe('prepareE2eDatabase', () => {
const client = new Database(databasePath, { create: true });
try {
client.exec('PRAGMA foreign_keys = ON;');
client.exec("PRAGMA foreign_keys = ON;");
expect(hasColumn(client, 'filing_taxonomy_snapshot', 'parser_engine')).toBe(true);
expect(hasTable(client, 'filing_taxonomy_context')).toBe(true);
expect(
hasColumn(client, "filing_taxonomy_snapshot", "parser_engine"),
).toBe(true);
expect(
hasColumn(client, "filing_taxonomy_snapshot", "computed_definitions"),
).toBe(true);
expect(hasTable(client, "filing_taxonomy_context")).toBe(true);
const health = ensureFinancialIngestionSchemaHealthy(client, { mode: 'auto' });
const health = ensureFinancialIngestionSchemaHealthy(client, {
mode: "auto",
});
expect(health.ok).toBe(true);
} finally {
client.close();