-
Notifications
You must be signed in to change notification settings - Fork 0
2: dbt manifest loader (plan) #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
08b5820
Add super plan for #2 (manifest loader) and vendored dbt research
wjduenow b3d9135
Fill in Beads Manifest for #2 plan (Phase 7 devolve)
wjduenow c3efa9d
bd_1-scaffolding-28p.1: US-001 — add Pydantic v2 + dbt-core deps and …
wjduenow 12af6f5
bd_1-scaffolding-28p.3: US-003 — manifest errors module (TDD)
wjduenow 9e7b8e1
bd_1-scaffolding-28p.2: US-002 — test fixtures (small × 4 schemas, me…
wjduenow 594fc6e
Merge bead bd_1-scaffolding-28p.2: US-002 — test fixtures (small × 4 …
wjduenow 448fdd1
bd_1-scaffolding-28p.4: US-004 — manifest Pydantic models module (TDD)
wjduenow 28cff91
bd_1-scaffolding-28p.5: US-005 — manifest loader module (TDD)
wjduenow c8d5e62
bd_1-scaffolding-28p.6: US-006 — public __init__.py re-exports
wjduenow 2f515b7
bd_1-scaffolding-28p.7: US-007 — documentation (research index, ops g…
wjduenow 37468fb
bd_1-scaffolding-28p.8: Quality gate — fix bugs from code-reviewer pa…
wjduenow dfaa093
bd_1-scaffolding-28p.9: US-009 — patterns & memory
wjduenow 61b38ff
Address Copilot review comments on PR #15
wjduenow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # External-format readers (Pydantic v2) | ||
|
|
||
| Established by issue #2 (manifest loader). Apply to any module in this repo that parses an externally-defined JSON/YAML format (dbt's `manifest.json`, `catalog.json`, `run_results.json`, BigQuery `INFORMATION_SCHEMA` snapshots, etc.). | ||
|
|
||
| ## Pydantic v2: frozen + extra=ignore in production | ||
|
|
||
| ```python | ||
| from pydantic import BaseModel, ConfigDict | ||
|
|
||
| _BASE = ConfigDict(frozen=True, extra="ignore", populate_by_name=True) | ||
| ``` | ||
|
|
||
| `frozen=True` makes models immutable post-construction. `extra="ignore"` survives upstream schema additions (e.g. dbt Fusion v20 fields) without code changes. `populate_by_name=True` lets callers use either the field name or the alias when constructing. | ||
|
|
||
| Do **not** use `extra="forbid"` in production. Reserve it for *test-only* `StrictModel(BaseModel)` subclasses constructed inline in drift-detector tests — those catch silent schema expansion before a live manifest does. | ||
|
|
||
| ## Symlink-hardened path resolution | ||
|
|
||
| Any function that takes a user-supplied path and reads from disk MUST canonicalise via: | ||
|
|
||
| ```python | ||
| def _canonicalise_path(input_path: Path | str, project_dir: Path) -> Path: | ||
| try: | ||
| project_resolved = project_dir.resolve(strict=True) | ||
| if not Path(input_path).is_absolute(): | ||
| p = project_resolved / input_path | ||
| else: | ||
| p = Path(input_path) | ||
| resolved = p.resolve(strict=False) | ||
| except RuntimeError as exc: # symlink loop | ||
| raise ModelPathOutsideProjectError(...) from exc | ||
| if not resolved.is_relative_to(project_resolved): | ||
| raise ModelPathOutsideProjectError(...) | ||
| return resolved | ||
| ``` | ||
|
|
||
| Three traps to remember: | ||
|
|
||
| 1. `Path.relative_to()` does **not** follow symlinks. Use `.resolve()` first. | ||
| 2. `Path.resolve()` raises `RuntimeError` on cycles regardless of `strict=`. Wrap. | ||
| 3. The "default" path (e.g. `target/manifest.json`) must go through the same gate as a user-supplied override. Don't trust convention. | ||
|
|
||
| Issue #2's pass-2 review caught all three by accident; they're now baked into the loader and its regression tests. | ||
|
|
||
| ## Errors carry remediation | ||
|
|
||
| Every typed exception in an external-format reader subclasses a module base (e.g. `ManifestError`) and accepts a `remediation: str` kwarg. `__str__` renders both the message and a `↳ Remediation:` line. This makes "explainable diffs" (CLAUDE.md commitment #5) load-bearing from the very first stage of the pipeline. | ||
|
|
||
| ## No logging / metrics in stage-0 modules | ||
|
|
||
| Reader modules are deterministic JSON-to-typed-objects. They do not emit logs or metrics in v0.1. Observability lives in the stage that *consumes* the data (LLM drafting, prune, grade) — that's where signal-vs-volume tradeoffs surface. Adding logs here just generates noise. | ||
|
|
||
| ## Reference | ||
|
|
||
| `plans/super/2-manifest-loader.md` — DEC-001, DEC-007, DEC-008, DEC-013, DEC-014, DEC-017. `src/signalforge/manifest/loader.py` — current implementation of all three traps. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # Manifest loader — operations guide | ||
|
|
||
| Operational reference for users of `signalforge.manifest`. Companion to | ||
| [`tests/fixtures/README.md`](../tests/fixtures/README.md) and the design | ||
| record in [`plans/super/2-manifest-loader.md`](../plans/super/2-manifest-loader.md). | ||
|
|
||
| ## Memory profile | ||
|
|
||
| The loader's soft-size warning uses a 3× expansion ratio between on-disk | ||
| manifest bytes and resident Python memory; size your CI runner accordingly. | ||
|
|
||
| | Manifest size on disk | Approx. resident memory | | ||
| | --------------------- | ----------------------- | | ||
| | small (~50 KB) | ~5 MB | | ||
| | medium (~5 MB) | ~50–150 MB | | ||
| | large (~30+ MB) | ~300–500+ MB | | ||
|
|
||
| ## Soft size warning (DEC-008) | ||
|
|
||
| The loader exposes `MAX_MANIFEST_BYTES = 200 * 1024 * 1024` at module scope. | ||
| If `os.path.getsize(manifest_path)` exceeds it, `load()` emits a single | ||
| `UserWarning` (not an exception) and proceeds — v0.1 has no hard ceiling. | ||
| Tests that need to exercise the threshold can monkeypatch: | ||
|
|
||
| ```python | ||
| import signalforge.manifest.loader as loader_mod | ||
| loader_mod.MAX_MANIFEST_BYTES = 1024 # force the warning on tiny fixtures | ||
| ``` | ||
|
|
||
| The warning text includes the 3× rule of thumb so users can plan capacity. | ||
|
|
||
| ## Multi-version fixture regeneration (DEC-009 / DEC-012) | ||
|
|
||
| Cross-link: [`tests/fixtures/README.md`](../tests/fixtures/README.md) holds | ||
| the canonical recipe, including the per-schema-version `uvx dbt-core==X.Y.x` | ||
| incantation for v9 / v10 / v11. | ||
|
|
||
| - v12 can be regenerated with the in-`[dev]` `dbt-core>=1.8` install — no | ||
| `uvx` needed; `pip install -e ".[dev]"` is sufficient. | ||
| - v9 / v10 / v11 use ephemeral `uvx` installs of dbt-core 1.5.x / 1.6.x / | ||
| 1.7.x; the older lines need `--python 3.11` because they import the | ||
| removed `distutils` module. | ||
| - `bash tests/fixtures/regenerate.sh` drives the full matrix and strips | ||
| non-deterministic metadata fields via `jq` so PR diffs don't churn. | ||
|
|
||
| ## Supported schema versions | ||
|
|
||
| | Manifest schema | dbt-core lines | Notes | | ||
| | --------------- | -------------------- | ------------------------------ | | ||
| | v9 | 1.5.x | regen via `uvx` | | ||
| | v10 | 1.6.x | regen via `uvx` | | ||
| | v11 | 1.7.x | regen via `uvx` | | ||
| | v12 | 1.8 / 1.9 / 1.10 / 1.11 | regen via in-`[dev]` install | | ||
|
|
||
| Schema **v20** (Fusion engine) is tracked as future work and currently | ||
| raises `UnsupportedManifestVersionError`. | ||
|
|
||
| ## Error class quick reference | ||
|
|
||
| Public API: `from signalforge.manifest import errors`. | ||
|
|
||
| - **`ManifestNotFoundError`** — `load()` was given a path that does not | ||
| exist or is not a regular file. | ||
| - **`UnsupportedManifestVersionError`** — `metadata.dbt_schema_version` | ||
| resolves to a schema outside v9–v12 (e.g. v8 or v20/Fusion). | ||
| - **`ModelNotFoundError`** — `Manifest.get_model(unique_id)` was called | ||
| with a unique_id absent from `nodes` and `disabled`. | ||
| - **`ModelDisabledError`** — `get_model()` matched a node, but it lives | ||
| in the `disabled` dict; callers must opt in to disabled nodes | ||
| explicitly. | ||
| - **`ModelPathOutsideProjectError`** — the resolver detected a model | ||
| whose `original_file_path` (after symlink resolution) escapes the | ||
| project root. | ||
| - **`ModelMissingSqlError`** — a model node has `raw_code: ""` or no | ||
| resolvable SQL on disk. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Research snapshot | ||
|
|
||
| This folder is a pinned snapshot of seven dbt research files vendored from | ||
| [clauditor](https://github.com/wjduenow/clauditor)'s `docs/temp/` directory | ||
| (per DEC-006 of `plans/super/2-manifest-loader.md`). The originals live in | ||
| clauditor's gitignored `docs/temp/` tree, so without this copy, anyone outside | ||
| the maintainer's machine could not read the references that informed | ||
| SignalForge's manifest-loader design. Treat this folder as a snapshot — not a | ||
| sync source — and update it deliberately. | ||
|
|
||
| ## Files | ||
|
|
||
| - **`dbt-claude-technical-surface.md`** — implementer-facing reference for | ||
| Claude-powered dbt tooling: artifact schemas, MCP surface, SDK options, | ||
| warehouse integration, CI shapes, token economics. **Section 1.1 is the | ||
| canonical schema reference for the manifest module** — it informed | ||
| DEC-001 (manifest-only scope), DEC-011 (schema-version detection via the | ||
| `metadata.dbt_schema_version` URL), DEC-012 (fixture matrix shape), and | ||
| DEC-017 (the resolver / `iter_models` / `schema_version` API surface). | ||
| - **`dbt-research-index.md`** — master index across the five research | ||
| artifacts; the entry point if you're skim-reading the corpus. | ||
| - **`dbt-research.pdf`** — binary PDF compilation of the underlying research; | ||
| supplementary, not load-bearing for code. | ||
| - **`dbt-ai-tools-deep-dive.md`** — survey of every meaningful AI/LLM tool in | ||
| or adjacent to dbt as of April 2026 (Copilot, codegen, DinoAI, datapilot, | ||
| Cortex Code), with user complaints and gap analysis. | ||
| - **`dbt-pain-deep-dive.md`** — direct quotes and failure stories from HN, | ||
| Reddit, Substack, and dbt Slack about what hurts when running dbt in | ||
| production; the source for SignalForge's "signal over volume" framing. | ||
| - **`dbt-tool-design-sketches.md`** — three concrete tool designs evaluated | ||
| for viability; SignalForge is the design that survived. | ||
| - **`dbt-tooling-opportunity-report.md`** — product-framing synthesis, | ||
| including the top-10 ranked pain points; the companion to | ||
| `dbt-claude-technical-surface.md`. | ||
|
|
||
| ## Refreshing this snapshot | ||
|
|
||
| If the originals update in clauditor, the maintainer can refresh this folder | ||
| in place: | ||
|
|
||
| ```bash | ||
| cp clauditor/docs/temp/dbt-*.md docs/research/ | ||
| cp clauditor/docs/temp/dbt-research.pdf docs/research/ | ||
| ``` | ||
|
|
||
| Contributors outside the maintainer's machine can read this committed | ||
| snapshot but cannot reach the live clauditor copy — that's the point of | ||
| vendoring per DEC-006. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.