-
Notifications
You must be signed in to change notification settings - Fork 6
feat(ingestion): cross-connector silver-contract parity gate (git commits) #1344
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
Draft
mitasovr
wants to merge
1
commit into
constructorfabric:main
Choose a base branch
from
mitasovr:feat/silver-contract-parity-gate
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
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,57 @@ | ||
| name: Silver Contract Parity | ||
|
|
||
| # Offline cross-connector silver-contract consistency gate. | ||
| # | ||
| # Verifies that every connector feeding a `silver:<class>` tag declares exactly | ||
| # the columns the silver class contract declares — same names, ORDER and types | ||
| # (catches "column added/reordered/retyped in one connector, forgotten in | ||
| # another" before merge). Reads the dbt manifest produced by `dbt parse` — NO | ||
| # warehouse needed, runs in seconds. | ||
| # | ||
| # This is the offline declaration-consistency gate (layer 2). The dbt contracts | ||
| # themselves (layer 1: SQL output == declared schema) are enforced wherever the | ||
| # models are built with `dbt build` (e2e / Argo). | ||
| # | ||
| # No `paths:` filter on purpose: meant to be a required status check on main — | ||
| # a path-filtered required check never reports on PRs outside the filter, which | ||
| # leaves them stuck on "Expected". | ||
| # | ||
| # Script: src/ingestion/scripts/check_silver_contract_parity.py | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| parity: | ||
| name: Silver contract parity | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| # Pinned so an unrelated dbt-core/adapter release can't break this gate. | ||
| - name: Install dbt-clickhouse | ||
| run: pip install "dbt-core==1.10.15" "dbt-clickhouse==1.9.6" | ||
|
|
||
| # Self-test the gate's own logic (no warehouse, no manifest needed). | ||
| - name: Unit-test the parity gate | ||
| run: python3 src/ingestion/scripts/tests/test_check_silver_contract_parity.py | ||
|
|
||
| - name: dbt parse (offline, no warehouse) | ||
| working-directory: src/ingestion/dbt | ||
| env: | ||
| # profiles.yml renders env_var('CLICKHOUSE_PASSWORD'); `dbt parse` | ||
| # never opens a connection, so any non-empty value lets it render. | ||
| CLICKHOUSE_PASSWORD: parse-only | ||
| run: dbt parse --profiles-dir . | ||
|
|
||
| - name: Check silver contract parity | ||
| run: | | ||
| python3 src/ingestion/scripts/check_silver_contract_parity.py \ | ||
| --manifest src/ingestion/dbt/target/manifest.json | ||
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: constructorfabric/insight
Length of output: 9507
Pin GitHub Actions to immutable SHAs and disable checkout credential persistence.
Using moving major tags (
@v4,@v5) weakens supply-chain guarantees. Addpersist-credentials: falseto the checkout action unless authenticated git operations are required later in the job.Affected lines
Replace with:
And pin both actions to full commit SHAs instead of version tags.
🧰 Tools
🪛 zizmor (1.25.2)
[warning] 32-32: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 32-32: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
[error] 34-34: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents
Source: Linters/SAST tools