mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-07 07:55:13 +02:00
Fast mode (the ktx ingest --fast/--deep database-ingest depth toggle) is removed.
ktx ingest now always builds the full enriched ("deep") context. There is no
structural fallback: a database connection without a configured model and
embeddings fails the enrichment-readiness preflight before any work runs, with
a 'Run ktx setup to configure a model and embeddings' hint.
- Remove --fast/--deep flags, the per-connection context.depth field, and the
ktx setup depth prompt (delete setup-database-context-depth.ts).
- Rename ingest-depth.ts -> connection-drivers.ts; ingest always requests scan
mode 'enriched'; readiness gate (enrichmentReadinessGaps) runs for every
database target.
- Drop the database-context-depth telemetry step (Node + Python schema mirrors
regenerated).
- Update CLI, setup, context-build view, docs, the public ktx skill, and the
release-smoke / artifacts scripts (now assert the no-LLM guard failure).
ktx status --fast (a separate network-probe flag) is unchanged.
Follow-ups: KLO-726 (live progress for ktx ingest --all), KLO-727 (restore
credentialed successful-ingest release smoke coverage).
107 lines
3 KiB
JavaScript
107 lines
3 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { describe, it } from 'node:test';
|
|
|
|
import {
|
|
buildDockerRunArgs,
|
|
buildKtxYaml,
|
|
buildLiveDatabaseIngestArgs,
|
|
buildPostgresUrl,
|
|
buildPostgresReadyArgs,
|
|
buildSeedSql,
|
|
smokeContainerName,
|
|
} from './installed-live-database-smoke.mjs';
|
|
|
|
describe('installed live-database artifact smoke helpers', () => {
|
|
it('builds a deterministic disposable Postgres container command', () => {
|
|
assert.deepEqual(
|
|
buildDockerRunArgs({
|
|
containerName: 'ktx-live-db-smoke-test',
|
|
hostPort: 15432,
|
|
image: 'postgres:16-alpine',
|
|
}),
|
|
[
|
|
'run',
|
|
'--rm',
|
|
'-d',
|
|
'--name',
|
|
'ktx-live-db-smoke-test',
|
|
'-e',
|
|
'POSTGRES_PASSWORD=postgres', // pragma: allowlist secret
|
|
'-e',
|
|
'POSTGRES_USER=ktx',
|
|
'-e',
|
|
'POSTGRES_DB=warehouse',
|
|
'-p',
|
|
'127.0.0.1:15432:5432',
|
|
'postgres:16-alpine',
|
|
],
|
|
);
|
|
});
|
|
|
|
it('uses a collision-resistant Docker container name prefix', () => {
|
|
assert.match(smokeContainerName(1234, 5678), /^ktx-live-db-smoke-1234-5678$/);
|
|
});
|
|
|
|
it('builds the Postgres URL used by ktx.yaml and daemon introspection', () => {
|
|
assert.equal(
|
|
buildPostgresUrl(15432),
|
|
'postgresql://ktx:postgres@127.0.0.1:15432/warehouse', // pragma: allowlist secret
|
|
);
|
|
});
|
|
|
|
it('writes a public database ingest KTX project config with SQLite local state', () => {
|
|
assert.equal(
|
|
buildKtxYaml('postgresql://ktx:postgres@127.0.0.1:15432/warehouse'), // pragma: allowlist secret
|
|
[
|
|
'connections:',
|
|
' warehouse:',
|
|
' driver: postgres',
|
|
' url: "postgresql://ktx:postgres@127.0.0.1:15432/warehouse"', // pragma: allowlist secret
|
|
'storage:',
|
|
' state: sqlite',
|
|
' search: sqlite-fts5',
|
|
'',
|
|
].join('\n'),
|
|
);
|
|
});
|
|
|
|
it('seeds comments and a foreign key for daemon catalog introspection', () => {
|
|
const sql = buildSeedSql();
|
|
|
|
assert.match(sql, /CREATE TABLE customers/);
|
|
assert.match(sql, /CREATE TABLE orders/);
|
|
assert.match(sql, /REFERENCES customers\(id\)/);
|
|
assert.match(sql, /COMMENT ON TABLE orders IS 'Orders captured by the artifact smoke'/);
|
|
assert.match(sql, /COMMENT ON COLUMN orders.amount IS 'Order amount in cents'/);
|
|
assert.match(sql, /INSERT INTO orders/);
|
|
});
|
|
|
|
it('waits for a real SQL connection to the target Postgres database', () => {
|
|
assert.deepEqual(buildPostgresReadyArgs('ktx-live-db-smoke-test'), [
|
|
'exec',
|
|
'ktx-live-db-smoke-test',
|
|
'psql',
|
|
'-U',
|
|
'ktx',
|
|
'-d',
|
|
'warehouse',
|
|
'-v',
|
|
'ON_ERROR_STOP=1',
|
|
'-c',
|
|
'SELECT 1;',
|
|
]);
|
|
});
|
|
|
|
it('builds the installed CLI public database ingest command', () => {
|
|
assert.deepEqual(buildLiveDatabaseIngestArgs('/tmp/project', 'http://127.0.0.1:8765'), [
|
|
'exec',
|
|
'ktx',
|
|
'ingest',
|
|
'warehouse',
|
|
'--project-dir',
|
|
'/tmp/project',
|
|
'--no-input',
|
|
]);
|
|
|
|
});
|
|
});
|