mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-10 08:05:14 +02:00
feat(ingest): route direct-write connectors through isolated diffs
This commit is contained in:
parent
a00285fd42
commit
449db1d42a
4 changed files with 91 additions and 1 deletions
|
|
@ -0,0 +1,40 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
defaultIsolatedDiffSourceKeys,
|
||||
isIsolatedDiffDirectWriteSourceKey,
|
||||
ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEYS,
|
||||
} from './source-routing.js';
|
||||
|
||||
describe('isolated-diff source routing', () => {
|
||||
it('keeps the runner-owned direct-write connector list explicit', () => {
|
||||
expect(ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEYS).toEqual([
|
||||
'metabase',
|
||||
'notion',
|
||||
'lookml',
|
||||
'looker',
|
||||
'dbt',
|
||||
'metricflow',
|
||||
]);
|
||||
});
|
||||
|
||||
it('returns a mutable copy for runtime settings', () => {
|
||||
const keys = defaultIsolatedDiffSourceKeys();
|
||||
keys.push('fake');
|
||||
|
||||
expect(defaultIsolatedDiffSourceKeys()).toEqual([
|
||||
'metabase',
|
||||
'notion',
|
||||
'lookml',
|
||||
'looker',
|
||||
'dbt',
|
||||
'metricflow',
|
||||
]);
|
||||
});
|
||||
|
||||
it('recognizes migrated connector source keys only', () => {
|
||||
expect(isIsolatedDiffDirectWriteSourceKey('notion')).toBe(true);
|
||||
expect(isIsolatedDiffDirectWriteSourceKey('metricflow')).toBe(true);
|
||||
expect(isIsolatedDiffDirectWriteSourceKey('historic-sql')).toBe(false);
|
||||
expect(isIsolatedDiffDirectWriteSourceKey('live-database')).toBe(false);
|
||||
});
|
||||
});
|
||||
22
packages/context/src/ingest/isolated-diff/source-routing.ts
Normal file
22
packages/context/src/ingest/isolated-diff/source-routing.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
export const ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEYS = [
|
||||
'metabase',
|
||||
'notion',
|
||||
'lookml',
|
||||
'looker',
|
||||
'dbt',
|
||||
'metricflow',
|
||||
] as const;
|
||||
|
||||
export type IsolatedDiffDirectWriteSourceKey = (typeof ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEYS)[number];
|
||||
|
||||
const ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEY_SET = new Set<string>(ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEYS);
|
||||
|
||||
export function defaultIsolatedDiffSourceKeys(): string[] {
|
||||
return [...ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEYS];
|
||||
}
|
||||
|
||||
export function isIsolatedDiffDirectWriteSourceKey(
|
||||
sourceKey: string,
|
||||
): sourceKey is IsolatedDiffDirectWriteSourceKey {
|
||||
return ISOLATED_DIFF_DIRECT_WRITE_SOURCE_KEY_SET.has(sourceKey);
|
||||
}
|
||||
|
|
@ -29,6 +29,14 @@ type RuntimeWithSlValidationDeps = {
|
|||
};
|
||||
};
|
||||
|
||||
type RuntimeWithSettingsDeps = {
|
||||
deps: {
|
||||
settings: {
|
||||
isolatedDiffSourceKeys?: string[];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
function testAgentRunner(): AgentRunnerPort {
|
||||
return { runLoop: vi.fn().mockResolvedValue({ stopReason: 'natural' as const }) };
|
||||
}
|
||||
|
|
@ -258,6 +266,25 @@ describe('createLocalBundleIngestRuntime', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('enables isolated-diff routing for direct durable-write connectors', () => {
|
||||
const runtime = createLocalBundleIngestRuntime({
|
||||
project,
|
||||
adapters: [new FakeSourceAdapter()],
|
||||
agentRunner: testAgentRunner(),
|
||||
});
|
||||
|
||||
const settings = (runtime.runner as unknown as RuntimeWithSettingsDeps).deps.settings;
|
||||
|
||||
expect(settings.isolatedDiffSourceKeys).toEqual([
|
||||
'metabase',
|
||||
'notion',
|
||||
'lookml',
|
||||
'looker',
|
||||
'dbt',
|
||||
'metricflow',
|
||||
]);
|
||||
});
|
||||
|
||||
it('accepts a debug LLM request file when constructing the default agent runner', async () => {
|
||||
await writeFile(
|
||||
join(project.projectDir, 'ktx.yaml'),
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ import { ContextEvidenceIndexService, SqliteContextEvidenceStore } from './conte
|
|||
import { DiffSetService } from './diff-set.service.js';
|
||||
import { ingestTracePathForJob, type IngestTraceLevel } from './ingest-trace.js';
|
||||
import { IngestBundleRunner } from './ingest-bundle.runner.js';
|
||||
import { defaultIsolatedDiffSourceKeys } from './isolated-diff/source-routing.js';
|
||||
import { PageTriageService } from './page-triage/index.js';
|
||||
import { createWarehouseVerificationTools } from './tools/warehouse-verification/index.js';
|
||||
import type {
|
||||
|
|
@ -722,7 +723,7 @@ export function createLocalBundleIngestRuntime(
|
|||
workUnitMaxConcurrency: options.project.config.ingest.workUnits.maxConcurrency,
|
||||
workUnitStepBudget: options.project.config.ingest.workUnits.stepBudget,
|
||||
workUnitFailureMode: options.project.config.ingest.workUnits.failureMode,
|
||||
isolatedDiffSourceKeys: ['metabase'],
|
||||
isolatedDiffSourceKeys: defaultIsolatedDiffSourceKeys(),
|
||||
ingestTraceLevel: ingestTraceLevelFromEnv(),
|
||||
},
|
||||
skillsRegistry: new SkillsRegistryService({ skillsDir, logger }),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue