Skip to content

chore: contract-copy drift check (dspack-gen#7 companion)#11

Merged
ryandmonk merged 1 commit into
mainfrom
chore/drift-check
Jul 3, 2026
Merged

chore: contract-copy drift check (dspack-gen#7 companion)#11
ryandmonk merged 1 commit into
mainfrom
chore/drift-check

Conversation

@ryandmonk

Copy link
Copy Markdown
Contributor

Companion to dspack-gen#13: the same boring no-dependency script byte-compares input/shadcn-ui.dspack.json against the spec repo's source of truth in CI, failing loudly with re-sync instructions (npm run check:sync, --write to sync). After a sync, regenerate derived artifacts (catalogs, json-render goldens) and commit together.

🤖 Generated with Claude Code

…pack-gen#7)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 3, 2026 03:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.mjs to fetch and byte-compare the upstream contract copy (with an optional --write resync mode).
  • Adds npm run check:sync as 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 thread scripts/check-sync.mjs
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 thread scripts/check-sync.mjs
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
@ryandmonk ryandmonk merged commit 1e03b19 into main Jul 3, 2026
2 checks passed
@ryandmonk ryandmonk deleted the chore/drift-check branch July 3, 2026 03:27
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.

2 participants