Skip to main content

Module dry_run_backend

Module dry_run_backend 

Source
Expand description

v1.0.84 (ADR-0042 / GAP-002): resolve and emit the LLM backend that WOULD be invoked for embedding without actually spawning the subprocess. Used by --dry-run-backend for CI audit and pre-flight sanity-check of --llm-backend before long ingestion sessions.

The output is a compact JSON envelope on stdout. stderr carries the human-friendly summary so operators can run sqlite-graphrag --dry-run-backend without piping through jaq.

§Schema (dry-run-backend.schema.json)

{
  "action": "dry_run_backend",
  "backend": "codex|claude|none",
  "binary": "/usr/local/bin/codex",
  "model": "gpt-5.5",
  "flavour": "codex|claude",
  "chain": "claude",
  "strict_env_clear": false
}

§Implementation notes

  • We deliberately do NOT depend on the private fields of LlmEmbedding. The struct’s binary and flavour fields are private to crate::extract::llm_embedding, so we re-probe the PATH here (cheap, idempotent) instead of forcing the core to add pub(crate) getters just for this audit path.
  • model comes from LlmEmbedding::model_label() which already exposes a stable public string of the form <flavour>:<model>. We strip the <flavour>: prefix to keep the schema flat.
  • When --llm-backend none is selected the envelope still emits the same shape with empty binary and model, so downstream pipelines can parse a single schema unconditionally.

Structs§

DryRunBackendOutput
Compact JSON envelope emitted by --dry-run-backend.

Functions§

emit_dry_run_backend
Resolve the LLM backend that would be used for embedding and emit the JSON envelope. Returns Err(AppError::Embedding) when the requested backend CLI is missing from PATH.