feat(design-sync): make design:pin a validated contract with the shared sync - #222
Merged
Merged
Conversation
JG2547
enabled auto-merge (squash)
September 12, 2026 00:36
JG2547
added a commit
that referenced
this pull request
Sep 12, 2026
…istent The sync moved the gitlink to 08024a1 and its pin hook rolled the citations to 793d3cf, so this pull request bumped the submodule and simultaneously broke the check that keeps the two in step. "Build & Test" failed on e846047. The hook derived the SHA from git ls-files -s design-system, which reads the superproject INDEX. At hook time the index still recorded the previous commit, because the gitlink is staged in the following step; only the submodule working tree had moved. Fixed at the source in two places, both open: 1132-Fixer/design-system#8 passes \ to the hook. #222 makes the roller read the submodule's own HEAD and refuse a SHA that disagrees with it. This commit repairs the pull request in front of us so it can merge. All three citations now read 08024a1, matching the gitlink this pull request sets. npm test exits 0.
patricktobias86
approved these changes
Sep 12, 2026
…ed sync #220 added a roller; this makes it safe for automation to call unattended and covers it with tests. The shared sync in 1132-Fixer/design-system will invoke pm run design:pin -- <sha> right after it moves the gitlink, so the pins and the submodule pointer land in one pull request instead of leaving CI red, as they did on #219 and again on main after #221. Contract npm run design:pin roll to the current gitlink npm run design:pin -- <40-hex sha> roll to an explicit commit npm run design:pin -- --check report, write nothing, exit 1 if stale The script name is the whole interface. The shared repository hardcodes no path of ours. Explicit, not broad Citations are declared as PIN_SITES with the prose that introduces them: the "pinned to <sha>" note in AGENTS.md, and each "Pinned design source: design-system @ <sha>" line in DESIGN-SYNC.md. A bare 40-hex string elsewhere is not a pin and is never rewritten, so this repository's own commit references survive. Fails instead of guessing - the SHA is not 40 lowercase hex characters - the SHA disagrees with the gitlink - a declared citation is missing, so a silent no-op would hide a shape change - citations disagree with each other - a pin is malformed in an otherwise-declared location - a design-system citation appears where PIN_SITES does not cover it That last one closes the drift hole: design-sync-pin-smoke.js now imports PIN_SITES and the scanner from roll-design-pin.js, so the gate and the roller cannot diverge. Adding a citation the roller does not know about now fails the roller loudly rather than leaving the gate to fail later. Tests tools/roll-design-pin-smoke.js, wired into npm test, covers a normal roll, multiple occurrences in one file, five invalid-SHA shapes, a missing expected pin in each document, mixed old pins, a malformed pin, protection of unrelated hashes, an undeclared citation location, and idempotence. 30 checks. Verified: npm test exits 0. Command line exercised end to end - a disagreeing SHA and a short SHA are both refused with exit 1; reverting the pins makes --check exit 1 and name both files; rolling restores them byte-identically and the gate passes again.
… index The hook merged in 1132-Fixer/design-system#7 ran on the very next sync and still produced a broken pull request. #223 moved the gitlink to 08024a1 but rolled the citations to 793d3cf, and "Build & Test" failed on a pull request the automation had just repaired. Cause: the sync moves the submodule working tree, runs the hook, and stages the gitlink afterwards. git ls-files -s design-system reads the superproject INDEX, so during the hook it reports the PREVIOUS commit. The roller trusted it. readGitlink now prefers git -C design-system rev-parse HEAD, the commit the submodule is actually on, and falls back to the staged gitlink only when the submodule is not checked out. Both agree in a normal developer checkout; they differ exactly during the hook, which is the case that matters. Reproduced and verified against that state - submodule moved to 08024a1 while the index still said 793d3cf: index gitlink : 793d3cf57e3ba87a1e8c32eb88c487dccd81eb9a submodule HEAD: 08024a12c4560d695263dbc662ee4864e1593ca7 readGitlink : 08024a12c4560d695263dbc662ee4864e1593ca7 With an explicit SHA the roller writes 08024a1 and exits 0; given the stale 793d3cf it refuses with exit 1 rather than producing a mismatched commit. npm test exits 0.
JG2547
force-pushed
the
ci/roll-pin-793d3cf
branch
from
September 12, 2026 04:47
be21867 to
c60c07d
Compare
JG2547
added a commit
to 1132-Fixer/design-system
that referenced
this pull request
Sep 12, 2026
#7 called the hook with no argument. The next sync proved that is not enough: 1132-Fixer/windows#223 moved the gitlink to 08024a1 while its citations rolled to 793d3cf, and the consumer's own "Build & Test" failed on a pull request this workflow had just repaired. At hook time the submodule WORKING TREE is at \ but the superproject INDEX still records the previous commit, because the gitlink is staged in the next step. A hook that reads the index therefore sees the old value. Passing the SHA removes the ambiguity entirely. The contract is now the script name and one argument, the full 40-hex design-system commit. This repository still knows nothing about which files a consumer keeps in step, and hardcodes no consumer path. 1132-Fixer/windows#222 hardens the receiving end: it validates the argument as 40 lowercase hex, refuses when it disagrees with the submodule's actual HEAD, and fails rather than guessing when a citation is missing, ambiguous, malformed or in an undeclared location. Verified: the workflow parses, the matrix is unchanged (macos, windows, browser, website), and the if/fi blocks balance.
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.
Rebased onto
mainafter #223 merged. The pin-roll commit this branch opened with is dropped: #223 already rolled the citations to08024a1, so replaying it would have reverted them. What remains is tooling only.What this is
The shared design-system sync moves the submodule gitlink and knows nothing about the prose this repository keeps in step, so a bump alone leaves
Build & Testred. It happened three times: #219 (ac0f1b1),mainafter #221 (793d3cf), and #223 (08024a1). #220 added a roller; this makes it safe for automation to call unattended and covers it with tests.Contract
The script name and one argument are the whole interface.
1132-Fixer/design-system#8calls it that way; nothing in the shared repository hardcodes a path of ours.Explicit, not broad
Citations are declared in
PIN_SITEStogether with the prose that introduces them: thepinned to \<sha>\note inAGENTS.md, and eachPinned design source: \design-system\ @ \<sha>\line inDESIGN-SYNC.md. A bare 40-hex string anywhere else is not a pin and is never rewritten, so this repository's own commit references survive.Fails instead of guessing
The SHA is not 40 lowercase hex; the SHA disagrees with the submodule's actual
HEAD; a declared citation is missing, so a silent no-op would hide a shape change; citations disagree with each other; a pin is malformed in an otherwise-declared location; a design-system citation appears wherePIN_SITESdoes not cover it.That last check closes the drift hole.
design-sync-pin-smoke.jsnow importsPIN_SITESand the scanner from the roller, so the gate and the tool that satisfies it cannot diverge.The index trap, and why it matters
git ls-files -s design-systemreads the superproject index. During the sync hook the index still records the previous commit, because the gitlink is staged in the next step; only the submodule working tree has moved. That is precisely how #223 was opened with its gitlink at08024a1and its citations at793d3cf.readGitlinknow prefersgit -C design-system rev-parse HEADand falls back to the staged gitlink only when the submodule is not checked out. Reproduced in a checkout holding that exact state:Tests
tools/roll-design-pin-smoke.js, wired intonpm test: a normal roll, multiple occurrences in one file, five invalid-SHA shapes, a missing citation in each document, mixed old pins, a malformed pin, protection of unrelated hashes, an undeclared citation location, idempotence, and index-versus-HEAD precedence. 30 checks, pure string transforms, no git or network.Verification
npm testexits 0 on the rebased head. The diff againstmainis five files and touches no citation line: the pins on this branch are the08024a1values inherited frommain.Command line exercised end to end: a short SHA and a SHA disagreeing with the submodule are both refused with exit 1; reverting the pins makes
--checkexit 1 naming both files; rolling restores them byte-identically and the gate passes again.Note on the earlier approval
@patricktobias86 approved
be21867. The rebase replaced it withc60c07d, so that approval no longer applies to the current head and a fresh one is needed. Same content, minus the dropped pin commit.Merge order: #223 (done), then this, then
1132-Fixer/design-system#8.