ktx/packages/context/src/scan
Andrey Avtomonov 0958bc03dc
fix: surface silent failures and drop unused dead-code paths (#193)
Address overengineering audit findings across cli/context/connector packages:

- F1 Snowflake `query`: drop bare catch that flattened all errors to empty result
- F2 memory-agent: treat LLM `stopReason === 'error'` as crash (skip squash-merge)
- F3 WikiSearchTool: description honest about token-only fallback vs sqlite-fts5 hybrid
- F5 Scan enrichment provider resolution: return discriminated status and surface
  distinct `llm_unavailable` / `embedding_unavailable` warnings per failure mode
- F6 Relationship validation budget: drop dead `tableCount === undefined → 'all'`
  branch; update tests to pass `tableCount` like production
- F8 `ktx sql`: use canonical `resolveOutputMode` (now honors KTX_OUTPUT/CI/TTY)
- F9 MCP stdio server: default `protocolIo.stderr` to `process.stderr` so
  memory_ingest startup failures are visible
- F13/F14 Scan/setup JSON readers: distinguish ENOENT from corruption instead of
  silently treating both as missing
- F15 `createKtxCliScanConnector`: throw config-shape error when driver matches
  but type guard rejects, instead of "no native connector"
- F16 ContextEvidenceSearchTool: surface `embedding_unhealthy:<reason>` instead
  of silently dropping the semantic lane
- F17 PromptService: default partials to `[]` (removes stale `clinical_policy`
  reference from a prior product)
- F20 `contextBuildCommands`: drop unused `runId` parameter

Dead-code removal:

- F4 Delete `AgentRunnerService` (duplicated `RuntimeAgentRunner`, only test-used);
  migrate tests to exercise `AiSdkKtxLlmRuntime.runAgentLoop` directly
- F7 Delete `KtxScanOrchestrator` and its test (no production callers; the
  inline pipeline in `runLocalScan` is the single source of truth)
- F18 Delete `generateKtxText`/`generateKtxObject` pass-through helpers; inline
  the single `runtime.generateObject` call at its caller

Plus a clarifying comment on the SQLite `resolveStringReference` `file:` carve-out
(load-bearing for SQLite URI form, not a bug).
2026-05-21 02:38:18 +02:00
..
credentials.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
credentials.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
data-dictionary.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
data-dictionary.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
description-generation.test.ts feat: add claude-code llm backend with runtime port (#115) 2026-05-16 12:06:34 +02:00
description-generation.ts feat: add claude-code llm backend with runtime port (#115) 2026-05-16 12:06:34 +02:00
embedding-text.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
embedding-text.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
enabled-tables.ts feat(ingest): adapter-owned finalization replaces post-processor escape hatch (#136) 2026-05-20 14:17:10 +02:00
enrichment-state.test.ts fix: remove deterministic embedding backend (#146) 2026-05-19 16:40:01 +02:00
enrichment-state.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
enrichment-summary.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
enrichment-summary.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
enrichment-types.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
enrichment-types.ts chore: add TypeScript dead-code checks (#60) 2026-05-13 13:33:28 +02:00
entity-details.test.ts feat(mcp):added MCP server (#97) 2026-05-15 02:35:09 +02:00
entity-details.ts feat(mcp):added MCP server (#97) 2026-05-15 02:35:09 +02:00
index.ts fix: surface silent failures and drop unused dead-code paths (#193) 2026-05-21 02:38:18 +02:00
local-enrichment-artifacts.test.ts fix: remove project from ktx config (#95) 2026-05-14 17:39:31 +02:00
local-enrichment-artifacts.ts Improve schema setup and Notion ingest UX (#14) 2026-05-12 22:56:58 +02:00
local-enrichment.test.ts fix(cli): resolve embedding provider explicitly and surface lane status in sl search (#192) 2026-05-21 02:21:22 +02:00
local-enrichment.ts fix: remove deterministic embedding backend (#146) 2026-05-19 16:40:01 +02:00
local-scan.test.ts fix: remove deterministic embedding backend (#146) 2026-05-19 16:40:01 +02:00
local-scan.ts fix: surface silent failures and drop unused dead-code paths (#193) 2026-05-21 02:38:18 +02:00
local-structural-artifacts.test.ts fix: remove project from ktx config (#95) 2026-05-14 17:39:31 +02:00
local-structural-artifacts.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-artifacts.test.ts fix: remove project from ktx config (#95) 2026-05-14 17:39:31 +02:00
relationship-artifacts.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-benchmark-report.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-benchmark-report.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-benchmarks.test.ts refactor: remove legacy compatibility paths (#64) 2026-05-13 15:55:00 +02:00
relationship-benchmarks.ts feat: add claude-code llm backend with runtime port (#115) 2026-05-16 12:06:34 +02:00
relationship-budget.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-budget.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-candidates.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-candidates.ts [codex] Add Conductor workspace scripts (#2) 2026-05-11 09:55:42 +02:00
relationship-composite-candidates.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-composite-candidates.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-diagnostics.test.ts refactor: remove legacy compatibility paths (#64) 2026-05-13 15:55:00 +02:00
relationship-diagnostics.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-discovery.test.ts feat: add claude-code llm backend with runtime port (#115) 2026-05-16 12:06:34 +02:00
relationship-discovery.ts feat: add claude-code llm backend with runtime port (#115) 2026-05-16 12:06:34 +02:00
relationship-feedback-calibration.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-feedback-calibration.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-feedback-export.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-feedback-export.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-formal-metadata.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-formal-metadata.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-graph-resolver.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-graph-resolver.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-llm-proposal.test.ts feat: add claude-code llm backend with runtime port (#115) 2026-05-16 12:06:34 +02:00
relationship-llm-proposal.ts fix: surface silent failures and drop unused dead-code paths (#193) 2026-05-21 02:38:18 +02:00
relationship-locality.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-locality.ts [codex] Add Conductor workspace scripts (#2) 2026-05-11 09:55:42 +02:00
relationship-name-similarity.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-name-similarity.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-profiling.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-profiling.ts misc 2026-05-10 20:44:07 -07:00
relationship-review-apply.test.ts fix: remove project from ktx config (#95) 2026-05-14 17:39:31 +02:00
relationship-review-apply.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-review-decisions.test.ts fix: remove project from ktx config (#95) 2026-05-14 17:39:31 +02:00
relationship-review-decisions.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-scoring.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-scoring.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-threshold-advice.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-threshold-advice.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
relationship-validation.test.ts fix: surface silent failures and drop unused dead-code paths (#193) 2026-05-21 02:38:18 +02:00
relationship-validation.ts fix: surface silent failures and drop unused dead-code paths (#193) 2026-05-21 02:38:18 +02:00
sqlite-local-enrichment-state-store.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
type-normalization.test.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
type-normalization.ts rename klo to ktx 2026-05-10 23:51:24 +02:00
types.test.ts misc 2026-05-10 20:44:07 -07:00
types.ts fix(context): merge overlay columns onto manifest columns by name (#94) 2026-05-15 02:11:04 +02:00
warehouse-catalog.test.ts feat(mcp):added MCP server (#97) 2026-05-15 02:35:09 +02:00
warehouse-catalog.ts feat(mcp):added MCP server (#97) 2026-05-15 02:35:09 +02:00