Skip to content

Commit 3829536

Browse files
fix(skills/update-stack): use HEAD blob + quoted path match in drift gate
- Replace `git hash-object "$f"` with `git rev-parse HEAD:"$f"` — compares committed blobs rather than working-tree bytes (CRLF-safe, no false drift from uncommitted changes post-merge) - Replace `grep -qF "$f"` with `grep -qF "'$f'"` — matches the single-quoted token in DOWNSTREAM_PATCHES.md to prevent substring false-positives - Reword rules: remove misleading note about config/defaults auto-skip (those paths are simply not in the scanned directories), clarify that downstream-only files are never scanned Per Copilot review on #3760
1 parent 8a6a1cb commit 3829536

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

.claude/skills/update-stack/SKILL.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ drift_found=0
9999
while IFS= read -r f; do
100100
upstream_blob=$(git ls-tree devkit-node/master -- "$f" 2>/dev/null | awk '{print $3}')
101101
[ -z "$upstream_blob" ] && continue # downstream-only file — skip
102-
local_hash=$(git hash-object "$f" 2>/dev/null)
103-
if [ "$upstream_blob" != "$local_hash" ]; then
104-
if ! grep -qF "$f" DOWNSTREAM_PATCHES.md 2>/dev/null; then
102+
local_blob=$(git rev-parse "HEAD:$f" 2>/dev/null)
103+
if [ "$upstream_blob" != "$local_blob" ]; then
104+
if ! grep -qF "'$f'" DOWNSTREAM_PATCHES.md 2>/dev/null; then
105105
echo "BLOCK: undeclared drift on stack file: $f"
106106
echo " Fix A — revert to upstream: git checkout devkit-node/master -- $f"
107107
echo " Fix B — declare it: add '$f' + rationale to DOWNSTREAM_PATCHES.md"
@@ -117,7 +117,8 @@ echo "3ter: no undeclared drift — OK"
117117

118118
**Rules:**
119119
- Missing `DOWNSTREAM_PATCHES.md` = no declared divergences allowed (treat as empty).
120-
- `config/defaults/<project>.config.js` (downstream-only config file) will be absent from `devkit-node/master``upstream_blob` empty → auto-skipped.
120+
- Declare diverging paths in `DOWNSTREAM_PATCHES.md` as `'path/to/file'` (single-quoted) — the gate matches on the quoted token to avoid substring collisions.
121+
- Downstream-only files (new modules, helpers, lib additions) are not scanned — the sweep only covers the stack directories listed above.
121122
- This gate runs **after** `/verify` (never blocks on transient verify failures) and **before** Phase 2 (failure is recoverable — no merge commit yet).
122123
- Ref: plan `2026-05-30-trawl-devkit-perfect-alignment.md` Tasks E.1 + E.2.
123124

0 commit comments

Comments
 (0)