Skip to content

Commit 8a6a1cb

Browse files
feat(skills/update-stack): block on undeclared drift vs upstream
Add gate 3ter to Phase 1: after /verify passes, diff each stack-module non-test file against devkit-node/master. Any file that diverges AND is not declared in DOWNSTREAM_PATCHES.md causes exit 1 with a clear fix message. Missing ledger = no declared divergences allowed. Prevents trawl-style silent drift (3 arch violations + 9 promote-up candidates found 2026-05-30 after weeks of unchecked accumulation). Closes #3759 — plan 2026-05-30-trawl-devkit-perfect-alignment.md (E.2)
1 parent 0a9db27 commit 8a6a1cb

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,39 @@ BODY
8888

8989
Proceed to Phase 2 and track the upstream fix separately — do not block downstream alignment on it.
9090

91+
### 3ter. Block on undeclared drift
92+
93+
After `/verify` passes, run a final diff sweep before starting Phase 2. Any stack file that diverges from upstream **and** is not declared in `DOWNSTREAM_PATCHES.md` blocks the flow.
94+
95+
```bash
96+
git fetch devkit-node master --quiet
97+
98+
drift_found=0
99+
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_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
105+
echo "BLOCK: undeclared drift on stack file: $f"
106+
echo " Fix A — revert to upstream: git checkout devkit-node/master -- $f"
107+
echo " Fix B — declare it: add '$f' + rationale to DOWNSTREAM_PATCHES.md"
108+
drift_found=1
109+
fi
110+
fi
111+
done < <(git ls-files modules/home modules/auth modules/users modules/tasks modules/uploads modules/billing lib config/defaults 2>/dev/null \
112+
| grep -v "/tests/" | grep -vE "\.(test|spec)\.js$")
113+
114+
[ "$drift_found" -eq 1 ] && exit 1
115+
echo "3ter: no undeclared drift — OK"
116+
```
117+
118+
**Rules:**
119+
- 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.
121+
- This gate runs **after** `/verify` (never blocks on transient verify failures) and **before** Phase 2 (failure is recoverable — no merge commit yet).
122+
- Ref: plan `2026-05-30-trawl-devkit-perfect-alignment.md` Tasks E.1 + E.2.
123+
91124
---
92125

93126
## Phase 2 — Project alignment

0 commit comments

Comments
 (0)