chore: contract-copy drift check (dspack-gen#7 companion)#11
Merged
Conversation
…pack-gen#7) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a CI-enforced “contract copy drift” gate so this repo’s checked-in input/shadcn-ui.dspack.json is byte-identical to the upstream spec repo’s source-of-truth, preventing silent divergence across the dspack ecosystem.
Changes:
- Introduces
scripts/check-sync.mjsto fetch and byte-compare the upstream contract copy (with an optional--writeresync mode). - Adds
npm run check:syncas a first-class script entrypoint. - Runs the drift check in the GitHub Actions test workflow.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| scripts/check-sync.mjs | New no-deps Node script to detect (and optionally fix) upstream/local contract drift via byte-compare. |
| package.json | Adds check:sync script to run the drift check consistently. |
| .github/workflows/test.yml | Integrates the drift check into CI so drift fails PRs/pushes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+28
to
+39
| async function fetchSource(url) { | ||
| for (let attempt = 1; ; attempt++) { | ||
| try { | ||
| const response = await fetch(url); | ||
| if (!response.ok) throw new Error(`HTTP ${response.status}`); | ||
| return Buffer.from(await response.arrayBuffer()); | ||
| } catch (error) { | ||
| if (attempt >= 2) throw new Error(`fetching ${url}: ${error.message ?? error}`); | ||
| await new Promise((resolve) => setTimeout(resolve, 2000)); | ||
| } | ||
| } | ||
| } |
Comment on lines
+60
to
+62
| console.error(`DRIFT ${entry.local} (${entry.note})`); | ||
| console.error(` differs from ${entry.source}`); | ||
| console.error(` fix: node scripts/check-sync.mjs --write, regenerate derived goldens, commit together.`); |
Comment on lines
+27
to
+28
| - name: Contract-copy drift check (dspack-gen#7) | ||
| run: npm run check:sync |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Companion to dspack-gen#13: the same boring no-dependency script byte-compares
input/shadcn-ui.dspack.jsonagainst the spec repo's source of truth in CI, failing loudly with re-sync instructions (npm run check:sync,--writeto sync). After a sync, regenerate derived artifacts (catalogs, json-render goldens) and commit together.🤖 Generated with Claude Code