mirror of
https://github.com/Kaelio/ktx.git
synced 2026-07-13 11:22:11 +02:00
feat(connectors): generalize readiness and constraint handling (#212)
* feat(connectors): add postgres maxConnections * feat(connectors): add mysql maxConnections * feat(connectors): add sqlserver maxConnections * feat(connectors): rename snowflake pool config * docs: document connector maxConnections * feat(scan): add constraint discovery warning helper * feat(scan): carry structural warnings through reports * feat(postgres): soft-fail denied constraint discovery * feat(mysql): soft-fail denied constraint discovery * feat(sqlserver): soft-fail denied constraint discovery * feat(bigquery): soft-fail denied primary key discovery * feat(snowflake): report denied primary key discovery * test(scan): verify constraint discovery warnings * feat(historic-sql): use shared readiness probes * docs: document query history readiness probes * test(historic-sql): verify readiness probe registry * test(ingest): account for live database warnings artifact * Add skip option for agent setup
This commit is contained in:
parent
cfd1749ab9
commit
78b8a0c025
42 changed files with 2763 additions and 554 deletions
|
|
@ -180,6 +180,13 @@ function fetchOnlyAdapter(options: { extractedAt?: () => string; snapshot?: KtxS
|
|||
'utf-8',
|
||||
);
|
||||
await writeFile(join(stagedDir, 'foreign-keys.json'), '{"foreignKeys":[]}\n', 'utf-8');
|
||||
if (scanSnapshot.warnings?.length) {
|
||||
await writeFile(
|
||||
join(stagedDir, 'warnings.json'),
|
||||
`${JSON.stringify({ warnings: scanSnapshot.warnings })}\n`,
|
||||
'utf-8',
|
||||
);
|
||||
}
|
||||
for (const table of scanSnapshot.tables) {
|
||||
await writeFile(join(stagedDir, 'tables', `${table.name}.json`), `${JSON.stringify(table)}\n`, 'utf-8');
|
||||
}
|
||||
|
|
@ -336,6 +343,48 @@ describe('local scan', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('threads structural snapshot warnings into the final scan report', async () => {
|
||||
const result = await runLocalScan({
|
||||
project,
|
||||
adapters: [
|
||||
fetchOnlyAdapter({
|
||||
snapshot: {
|
||||
...defaultFetchSnapshot(),
|
||||
warnings: [
|
||||
{
|
||||
code: 'constraint_discovery_unauthorized',
|
||||
message: 'Skipped primary-key discovery in public (insufficient grants on system catalogs)',
|
||||
recoverable: true,
|
||||
metadata: { schema: 'public', kind: 'primary_key' },
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
connectionId: 'warehouse',
|
||||
jobId: 'scan-run-structural-warnings',
|
||||
now: () => new Date('2026-04-29T09:01:00.000Z'),
|
||||
});
|
||||
|
||||
expect(result.report.warnings).toEqual([
|
||||
{
|
||||
code: 'constraint_discovery_unauthorized',
|
||||
message: 'Skipped primary-key discovery in public (insufficient grants on system catalogs)',
|
||||
recoverable: true,
|
||||
metadata: { schema: 'public', kind: 'primary_key' },
|
||||
},
|
||||
]);
|
||||
await expect(
|
||||
readFile(
|
||||
join(
|
||||
project.projectDir,
|
||||
'raw-sources/warehouse/live-database/2026-04-29-090100-scan-run-structural-warnings/scan-report.json',
|
||||
),
|
||||
'utf-8',
|
||||
),
|
||||
).resolves.toContain('"constraint_discovery_unauthorized"');
|
||||
});
|
||||
|
||||
it('passes enabled_tables as fetch context tableScope and does not post-filter staged snapshots', async () => {
|
||||
project.config.connections.warehouse = {
|
||||
...project.config.connections.warehouse,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue