ktx/packages/cli/test/context/ingest
Matt Senick (Sigma) acd20ac248
feat(sigma): add Sigma Computing context-source adapter (#316)
* feat(sigma): add Sigma Computing context-source adapter

Closes #168

Adds a full ingest adapter for Sigma Computing so `ktx ingest` can pull
data model specs and workbook summaries into the ktx context layer. The
implementation follows the same fetch → chunk → project → LLM pattern
used by the Looker, Metabase, and MetricFlow adapters.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(sigma): address PR review comments

- Remove manifest from rawFiles; moves to peerFileIndex so fetchedAt
  changes don't mark all work units dirty every run
- Fix workbookFilter.updatedSince eviction bug: fetch full universe first,
  apply filter client-side, evict only on archived/deleted
- Remove measure projection entirely; project() writes measures: [] and
  the sigma_ingest skill surfaces Lookup/aggregation formulas as wiki prose
- Remove joins projection (v1 limitation); project() writes joins: [] and
  Lookup relationships are described in wiki prose instead
- Remove write-back dead code: createDataModel, updateDataModel,
  SigmaDataModelPushResult, mutate/post/put
- Fix emitBatches notes pluralization bug ('2 data modelss' → '2 data models')
- Add tokenInflight dedup on ensureToken to coalesce concurrent auth requests
- Retry spec fetch when existing staged spec is null (transient failure cache)
- Drop unused WorkbookFilter import from client-port.ts
- Note in docs that joins are not projected from Sigma data models in this release

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* updates

* fix(sigma): restore sigma in local adapter test + small cleanups

The gdrive↔sigma merge dropped 'sigma' from the expected adapter source
list in local-adapters.test.ts while keeping gdrive, so the slow TS suite
failed even though the source registers both. Add 'sigma' back at its
registration position (after metabase, before gdrive).

Also:
- Move the orphaned SigmaPullConfig docstring onto the schema it documents
  and drop the stale BullMQ reference (standalone ktx has no BullMQ; the
  config lives in the ingest job's bundleRef.config).
- Drop an O(n^2) find() round-trip in fetch() when building the active
  data-model list; filter once and reuse for the eviction id set.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Andrey Avtomonov <andreybavt@gmail.com>
Co-authored-by: Luca Martial <48870843+luca-martial@users.noreply.github.com>
2026-07-01 01:14:57 +02:00
..
adapters feat(sigma): add Sigma Computing context-source adapter (#316) 2026-07-01 01:14:57 +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 Resumable and fault-tolerant source ingest (spec #22) (#315) 2026-06-30 01:29:28 +02:00
memory-flow refactor: enforce ktx naming and AGENTS.md compliance sweep (#289) 2026-06-11 13:49:45 +02:00
page-triage refactor: enforce ktx naming and AGENTS.md compliance sweep (#289) 2026-06-11 13:49:45 +02:00
stages Resumable and fault-tolerant source ingest (spec #22) (#315) 2026-06-30 01:29:28 +02:00
tools Add gdrive context source adapter (#209) 2026-06-27 23:41:32 +02:00
action-identity.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
artifact-gates.test.ts Resumable and fault-tolerant source ingest (spec #22) (#315) 2026-06-30 01:29:28 +02:00
canonical-pins.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
diff-set.service.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
final-gate-prune.test.ts Resumable and fault-tolerant source ingest (spec #22) (#315) 2026-06-30 01:29:28 +02:00
finalization-scope.test.ts fix: read semantic sources safely (#284) 2026-06-10 14:06:13 +02:00
historic-sql-probes.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
ingest-bundle.runner.isolated-diff.test.ts Resumable and fault-tolerant source ingest (spec #22) (#315) 2026-06-30 01:29:28 +02:00
ingest-bundle.runner.test.ts Resumable and fault-tolerant source ingest (spec #22) (#315) 2026-06-30 01:29:28 +02:00
ingest-profile.test.ts feat(cli): profile ingest runs and split model vs tool time (#249) 2026-06-01 15:49:17 +02:00
ingest-prompts.test.ts refactor: enforce ktx naming and AGENTS.md compliance sweep (#289) 2026-06-11 13:49:45 +02:00
ingest-runtime-assets.test.ts Add gdrive context source adapter (#209) 2026-06-27 23:41:32 +02:00
ingest-trace.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
local-adapters.test.ts feat(sigma): add Sigma Computing context-source adapter (#316) 2026-07-01 01:14:57 +02:00
local-bundle-ingest.test.ts refactor: enforce ktx naming and AGENTS.md compliance sweep (#289) 2026-06-11 13:49:45 +02:00
local-bundle-runtime.test.ts Resumable and fault-tolerant source ingest (spec #22) (#315) 2026-06-30 01:29:28 +02:00
local-embedding-provider.integration.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
local-mapping-reconcile.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
local-metabase-ingest.test.ts fix(cli): treat artifact-producing ingests with failures as partial (#238) 2026-05-30 00:42:59 +02:00
local-stage-ingest.test.ts refactor: enforce ktx naming and AGENTS.md compliance sweep (#289) 2026-06-11 13:49:45 +02:00
manifest-federated-join.test.ts feat(duckdb): cross-database federation via derived DuckDB connection (#295) 2026-06-15 15:01:39 +00:00
raw-sources-paths.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
repo-fetch.test.ts refactor: enforce ktx naming and AGENTS.md compliance sweep (#289) 2026-06-11 13:49:45 +02:00
report-snapshot.test.ts Resumable and fault-tolerant source ingest (spec #22) (#315) 2026-06-30 01:29:28 +02:00
reports.test.ts Resumable and fault-tolerant source ingest (spec #22) (#315) 2026-06-30 01:29:28 +02:00
semantic-layer-target-policy.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
source-adapter-registry.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
sqlite-bundle-ingest-store.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
sqlite-local-ingest-store.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
wiki-body-refs.test.ts Resumable and fault-tolerant source ingest (spec #22) (#315) 2026-06-30 01:29:28 +02:00
wiki-sl-ref-repair.test.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
work-unit-cache.test.ts Resumable and fault-tolerant source ingest (spec #22) (#315) 2026-06-30 01:29:28 +02:00