Skip to content

ci: add a report-only DuckDB schema-review pilot - #1092

Open
PresentJay wants to merge 2 commits into
elementary-data:masterfrom
PresentJay:ci/dbt-plan-duckdb-pilot
Open

PresentJay wants to merge 2 commits into
elementary-data:masterfrom
PresentJay:ci/dbt-plan-duckdb-pilot

Conversation

@PresentJay

@PresentJay PresentJay commented Oct 26, 2026 •

Copy link
Copy Markdown

This PR adds a per-PR report of predicted column changes to Elementary's persisted artifact tables. The intended benefit is that a reviewer can see a named column removal and decide whether it belongs in the change, before updating an existing installation.

I maintain dbt-plan. This is a report-only pilot proposal; Elementary's maintainers have not agreed to adopt it.

Why this fits Elementary

dbt_models and dbt_snapshots both call get_dbt_models_empty_table_query(), and both use incremental with on_schema_change="sync_all_columns". One edit to the shared macro can therefore change the schemas of two persisted artifact tables even though neither model SQL file changed.

In a controlled local change, I removed only the description entry from that macro. The released analyzer then reported:

DESTRUCTIVE dbt_models (incremental, sync_all_columns)
  DROP COLUMN description
DESTRUCTIVE dbt_snapshots (incremental, sync_all_columns)
  DROP COLUMN description

This was an injected control, not a bug or production incident discovered in Elementary. An intentional removal is still useful review context: the report makes its persisted-schema effect explicit.

The existing warehouse integration tests continue to check runtime behavior. This job adds a comparison between the PR base and current compiled schemas directly to the Actions summary. It does not claim to validate uploaded values, hooks, all consumer projects, or every warehouse-specific schema.

What maintainers would take on

  • One separate pull_request job with read-only repository permissions. It uses the existing DuckDB profile generator and an in-memory database, with no cloud credentials or external analysis service.
  • Dependencies are installed before each of two compiles. The workflow analyzes the package root's models rather than the integration project's harness models.
  • Risk findings are informational (fail-on: never). Installation, compilation and invalid-report failures remain visible job failures. The PR does not change branch protection or make this a required check.
  • The Action commit, dbt Core, DuckDB adapter and Python package are pinned, so future upgrades are explicit maintenance work.

Validation with the published release

Both the Action commit and installed package are pinned to v0.18.3. The derived-table improvement from dbt-plan #312 is now published; this proposal no longer depends on unreleased code.

At upstream e3ab23d8c2e3bd7ad455de8bb1d23bf7ee84e675, using Core 1.11.14, dbt-duckdb 1.10.1 and SQLGlot 30.24.0:

  • The original package compiled 30 root models. Recompiling unchanged input produced no model changes and exit 0.
  • The macro-removal control produced two manifest-fallback warnings with 0.18.2 (exit 2). The published 0.18.3 package identified description drops in both models (exit 1) and retained a separate unresolved downstream warning.
  • After uninstalling the local build, the v0.18.3 Action installed the published package from PyPI and completed its dependency install, existing profile generation, both compiles, comparison and report-only gate locally. The new schema-plan run passed on this PR head in 47 seconds, including setup, installs and two compiles. This is one unchanged-schema observation, not a latency guarantee. actionlint and the project's existing Prettier hook passed.

The SQL control is not part of this PR. Full cloud integration was not run locally, and existing cloud CI still requires maintainer approval.

Feedback sought: does a named macro-generated schema delta add useful review context for this package, and is the extra CI job worth its installation and compile overhead?

Summary by CodeRabbit

  • Chores
    • Pull requests now trigger an automated review of compiled database schema changes. The review runs with a local configuration, and its findings are informational rather than blocking. When a new run starts for a pull request, any earlier run is canceled so results stay current. Each review is limited to 10 minutes.

@github-actions

Copy link
Copy Markdown
Contributor

👋 @PresentJay
Thank you for raising your pull request.
Please make sure to add tests and document all user-facing changes.
You can do this by editing the docs files in the elementary repository.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ff2b0a46-da86-4ae8-bc1c-25b7eb533b6a
Commits

Reviewing files that changed from the base of the PR and between e3ab23d and 17c0b08.

Files selected for processing: 1
  • .github/workflows/schema-plan.yml

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

Adds a pull-request workflow that sets up dbt with DuckDB and runs a pinned dbt-plan action to review compiled schema changes. The workflow uses read-only repository access, cancels earlier runs for the same pull request, and has a 10-minute timeout.

Changes: Schema review workflow

Layer / File(s) Summary
Configure and run the schema plan
.github/workflows/schema-plan.yml
Adds a pull-request workflow that installs pinned dbt dependencies, creates a local DuckDB profile, and runs the pinned dbt-plan action with fail-on: never.

Priority: Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Feature

Merge Risk: Minimal · up to 17c0b

The report-only schema check appears mergeable after normal checks; no actionable issue is established.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding a report-only DuckDB schema-review CI pilot.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@PresentJay
PresentJay marked this pull request as ready for review October 26, 2026 08:50

This branch is waiting to be deployed

1 waiting deployment
elementary_test_env — 17c0b086 Waiting Oct 26, 2026 by PresentJay via approve-fork #5303
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant