Skip to content

Commit ef46adb

Browse files
fix(skills/update-stack): switch drift gate scan to git diff (catches missing-locally case)
Replace `git ls-files` iteration (locally-present files only) with `git diff --name-only devkit-node/master HEAD` (bidirectional). Adds a second BLOCK arm for files present upstream but absent locally — the previous scan silently skipped deleted stack files. Closes #3779
1 parent cdacb9b commit ef46adb

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,21 @@ git fetch devkit-node master --quiet
9797

9898
drift_found=0
9999
while IFS= read -r f; do
100-
upstream_blob=$(git ls-tree devkit-node/master -- "$f" 2>/dev/null | awk '{print $3}')
101-
[ -z "$upstream_blob" ] && continue # downstream-only file — skip
102-
local_blob=$(git rev-parse "HEAD:$f" 2>/dev/null)
103-
if [ "$upstream_blob" != "$local_blob" ]; then
104-
echo "BLOCK: drift on shared stack file: $f"
100+
# Both sides exist + differ → drift
101+
if git cat-file -e "devkit-node/master:$f" 2>/dev/null && git cat-file -e "HEAD:$f" 2>/dev/null; then
102+
echo "BLOCK: drift on shared file: $f"
105103
echo " Fix A — revert to upstream: git checkout devkit-node/master -- $f"
106104
echo " Fix B — promote upstream: open a devkit PR with the change, merge, /update-stack here"
107105
echo " Fix C — relocate: move logic to a downstream-only module or config/defaults/<project>.config.js"
108106
drift_found=1
107+
# Upstream has it, local doesn't → missing-locally
108+
elif git cat-file -e "devkit-node/master:$f" 2>/dev/null; then
109+
echo "BLOCK: missing locally (was on upstream): $f"
110+
echo " Fix — restore: git checkout devkit-node/master -- $f"
111+
drift_found=1
109112
fi
110-
done < <(git ls-files modules lib config 2>/dev/null \
113+
# Downstream-only file (not in upstream) → skip silently
114+
done < <(git diff --name-only devkit-node/master HEAD -- modules lib config 2>/dev/null \
111115
| grep -vE "/(tests|__tests__)/" | grep -vE "\.(test|spec)\.(js|jsx|ts|tsx)$")
112116

113117
[ "$drift_found" -eq 1 ] && exit 1
@@ -116,7 +120,7 @@ echo "3ter: no drift — OK"
116120

117121
**Rules:**
118122
- Block on ANY shared-file divergence. No "declare and skip" path — the `DOWNSTREAM_PATCHES.md` ledger model was abandoned 2026-06-02 (memory `feedback_no_dev_in_shared_modules`).
119-
- Scan covers the full stack tree (`modules`, `lib`, `config`) — auto-discovers every shared module. Per-file `git ls-tree` on upstream filters downstream-only files.
123+
- Scan source is `git diff --name-only devkit-node/master HEAD` (bidirectional) — catches both files that differ AND files present upstream but missing locally (deleted downstream). The previous `git ls-files` approach only saw locally-present files.
120124
- Test files (paths containing `/tests/` or `/__tests__/`, or filenames ending `.test.{js,jsx,ts,tsx}` / `.spec.{js,jsx,ts,tsx}`) are excluded — downstream test adaptations are acceptable.
121125
- This gate runs **after** `/verify` (never blocks on transient verify failures) and **before** Phase 2 (failure is recoverable — no merge commit yet).
122126
- Ref: plan `2026-05-30-trawl-devkit-perfect-alignment.md` Tasks E.1 + E.2.

0 commit comments

Comments
 (0)