fix(opencode): say when `dbt_lineage` answers from a partial dbt Fusion parse

RA
2d ago
+503-9

Issue for this PR

Closes #1853

Type of change

  • Bug fix

What does this PR do?

A dbt Fusion parse with errors still writes manifest.json, without what failed. dbt-integration 0.3.21 marks that parse partial. While the dbt adapter is running, dbt_lineage now opens its answers and failures with a note naming each file and its error:

This graph is missing parts because models/customers.sql failed to parse.
  models/customers.sql: [error] [DependencyNotFound (dbt1048)]: Ref 'stg_orderz' not found in project. ...

It is also in metadata.partial_manifest and the MCP structured result, with the first 10 errors and a count of the rest.

Claims

  • C1. While the running adapter's last parse had errors, the manifest answer, its failure and the adapter's own lineage start with the note.
  • C2. A later clean parse removes it.
  • C3. Read-only calls (no --allow-write, MCP without writes, plan mode) are unchanged, even with an adapter running.
  • C4. No note when no adapter is running (dbt_lineage starts none to look), or for a manifest outside the adapter's project.
  • C5. The mark is per adapter.
  • C6. A cancelled call doesn't answer.

Residuals

  • R1. Read-only calls never start the adapter, so they can't see the mark (needs a dbt-integration change).
  • R2. A one-shot tool run starts no adapter, so no note.
  • R3. The note is the latest parse's: right after an edit, before the re-parse, it can show the previous state.
  • R4. altimate-dbt children/parents/schema-verify don't carry it yet.

How did you verify your code works?

CheckResult
New tests (dbt-tools, opencode)20/20 pass; on main's sources 8 fail
dbt-tools tests (234); dbt_lineage and MCP server testspass (MCP E2E skipped by env, as on main)
typecheck; marker guardclean
Live E2E: Fusion 2.0.12, DuckDB jaffle_shop, adapter kept in the tool daemonbroken ref, syntax error: note (main: silent); restored: gone; read-only: unchanged; dbt-core 1.11: unchanged

Cost side effects

None: the note reads the running adapter's last parse result from memory.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
  • I checked for cost side effects and described them

🤖 Generated with Claude Code

https://claude.ai/code/session_01BXxzvpmBim7nhBFZE99CaJ

Summary by CodeRabbit

  • New Features
    • Lineage results can include notes when a dbt parse has errors, with affected file paths and details of reported errors. When there are many affected files or errors, the notes summarize the additional items.
    • Partial-parse notes are also available in structured tool results when present.
  • Bug Fixes
    • Notes are cleared after a clean parse and only appear for the relevant adapter and project.