ktx/packages/cli/src/context/ingest
Andrey Avtomonov f5dea9a089
fix(ingest): recover textual-conflict gate failures; fix query-history adapter (#255)
* fix(ingest): recover textual-conflict gate failures; fix query-history adapter

Two latent gaps in the isolated-diff local-ingest pipeline that can abort an
otherwise-successful ingest:

- Metabase: when a work-unit patch hit both a textual conflict and a post-merge
  dangling sl_ref, the after-textual-resolution branch returned a hard
  semantic_conflict and rolled back the whole job. It now runs the same
  repairGateFailure recovery the clean-apply branch already uses (re-validate,
  then commit the union of resolved + repaired paths), reaching parity.

- Query history: the historic-sql adapter was registered only when ktx.yaml had
  context.queryHistory.enabled=true, so `--query-history` threw "Adapter not
  available for local ingest". Registration now resolves the dialect from driver
  capability, since the explicit --query-history request is itself the opt-in;
  the config-gated helper is unchanged for status/setup/probes.

Adds the previously-missing tests for both paths.

* chore: sync uv.lock to 0.8.0 (regenerated with pinned uv 0.11.11)

* fix(ingest): drop ktx's own scan probes and dedup tables in query history

Query history (historic-sql) mined two kinds of noise back into context:

- ktx's own warehouse scan emits relationship- and column-profiling probes
  (the relationship_profile_values aggregation and the child_values/parent_values
  FK-overlap CTEs) into pg_stat_statements. shouldDropBySql now filters these
  ktx-owned, dialect-stable signatures so ktx introspection is not ingested as
  usage history.

- The same physical table appears both bare (accounts, via search_path) and
  schema-qualified (orbit_raw.accounts), producing duplicate per-table work
  units. canonicalizeTableIdentifiers collapses a bare name into its unique
  qualified form before work-unit keying; ambiguous names are left untouched.

On the orbit demo this removes ~35% of sampled query templates (ktx self-probes)
and ~45 duplicate per-table work units.

* docs(agents): add Design Reasoning Defaults section
2026-06-03 13:05:59 +02:00
..
adapters fix(ingest): recover textual-conflict gate failures; fix query-history adapter (#255) 2026-06-03 13:05:59 +02:00
clustering test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
context-candidates test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
context-evidence test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
dbt-shared test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
historic-sql-probes test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
isolated-diff fix(ingest): recover textual-conflict gate failures; fix query-history adapter (#255) 2026-06-03 13:05:59 +02:00
memory-flow fix(cli): treat artifact-producing ingests with failures as partial (#238) 2026-05-30 00:42:59 +02:00
page-triage test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
stages feat(cli): profile ingest runs and split model vs tool time (#249) 2026-06-01 15:49:17 +02:00
tools feat(cli): profile ingest runs and split model vs tool time (#249) 2026-06-01 15:49:17 +02:00
action-identity.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
artifact-gates.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
canonical-pins.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
diff-set.service.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
final-gate-repair.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
finalization-scope.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
git-env.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
historic-sql-probes.ts feat(connectors): generalize readiness and constraint handling (#212) 2026-05-24 19:30:06 +02:00
ingest-bundle.runner.ts feat(cli): profile ingest runs and split model vs tool time (#249) 2026-06-01 15:49:17 +02:00
ingest-profile.ts feat(cli): profile ingest runs and split model vs tool time (#249) 2026-06-01 15:49:17 +02:00
ingest-trace.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
local-adapters.ts refactor: remove legacy ktx compatibility shims (#211) 2026-05-24 16:57:23 +02:00
local-bundle-runtime.ts feat: add codex llm backend for ktx runtime work (#253) 2026-06-02 13:57:11 +02:00
local-ingest.ts fix(cli): treat artifact-producing ingests with failures as partial (#238) 2026-05-30 00:42:59 +02:00
local-mapping-reconcile.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
local-stage-ingest.ts fix(snowflake): unblock multi-schema ingest and relationship discovery (#204) 2026-05-23 10:41:30 +02:00
parsed-target-table.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
ports.ts feat(cli): profile ingest runs and split model vs tool time (#249) 2026-06-01 15:49:17 +02:00
raw-sources-paths.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
repo-fetch.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
report-snapshot.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
reports.ts fix(cli): treat artifact-producing ingests with failures as partial (#238) 2026-05-30 00:42:59 +02:00
semantic-layer-target-policy.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
source-adapter-registry.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
sqlite-bundle-ingest-store.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
sqlite-local-ingest-store.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
types.ts fix(snowflake): unblock multi-schema ingest and relationship discovery (#204) 2026-05-23 10:41:30 +02:00
wiki-body-refs.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
wiki-sl-ref-repair.ts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00