Skip to content

fix(skills/update-stack): switch drift gate scan to git diff (catches missing-locally case)#3783

Merged
PierreBrisorgueil merged 1 commit into
masterfrom
fix/drift-gate-scan-source-flip
Jun 3, 2026
Merged

fix(skills/update-stack): switch drift gate scan to git diff (catches missing-locally case)#3783
PierreBrisorgueil merged 1 commit into
masterfrom
fix/drift-gate-scan-source-flip

Conversation

@PierreBrisorgueil
Copy link
Copy Markdown
Contributor

@PierreBrisorgueil PierreBrisorgueil commented Jun 3, 2026

Summary

  • Replaces git ls-files modules lib config iteration (locally-present files only) with git diff --name-only devkit-node/master HEAD (bidirectional diff)
  • Adds a second BLOCK arm: files present upstream but absent locally → BLOCK: missing locally (was on upstream) with a restore hint
  • Downstream-only files (not in upstream) are still skipped silently
  • Updates the Rules bullet to explain why git diff was chosen over git ls-files

Root cause

The old gate iterated git ls-files which only enumerates files that exist in the working tree. A file deleted from a downstream (but still in upstream) was silently skipped — the gate could never detect the "missing locally" case.

Test plan

  • Smoke: bash -c '...' on the gate block — exits 0 on clean tree
  • Verify the gate runs to 3ter: no drift — OK on a clean downstream after /update-stack
  • Manually delete a stack file locally, re-run gate → should BLOCK with missing locally message

Closes #3779

Summary by CodeRabbit

  • Documentation
    • Enhanced drift detection in the /update-stack command to identify content mismatches and missing upstream files.

… 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
Copilot AI review requested due to automatic review settings June 3, 2026 14:59
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e275cd9c-3db7-4326-a108-6a531f12bceb

📥 Commits

Reviewing files that changed from the base of the PR and between cdacb9b and ef46adb.

📒 Files selected for processing (1)
  • .claude/skills/update-stack/SKILL.md

Walkthrough

Updated the /update-stack skill's drift-blocking step (3ter) to use bidirectional diff-based scanning instead of locally-enumerated files, detecting both shared-file divergence and upstream-present files missing locally.

Changes

Drift Gate Scan Refactoring

Layer / File(s) Summary
Drift gate scan logic and documentation
.claude/skills/update-stack/SKILL.md
Changed the drift-blocking loop to iterate git diff results restricted to modules/ lib/ config, replaced blob comparison with upstream-vs-HEAD existence checks using git cat-file -e, and updated the Rules bullet describing the scan source and detection of both divergent files and upstream-present missing-locally cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #3779: Directly addresses the same drift gate fix—switching scan source from local git ls-files to bidirectional upstream comparison to catch upstream-present files missing locally.

Possibly related PRs

  • pierreb-devkit/Node#3760: Also modifies the /update-stack "3ter. Block on drift" gate to detect upstream-vs-HEAD drift and missing files.
  • pierreb-devkit/Node#3778: Updates the same .claude/skills/update-stack/SKILL.md drift gate to change scan scope derivation and handle missing-locally/divergent file cases.

Suggested labels

Chore

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the essential sections: Summary (what changed, why), Root cause, and Test plan. Most required template sections are absent or incomplete. Add missing template sections: Scope (modules impacted, risk level), Validation (npm lint/test checklist), Guardrails checks, and fill in any Infra/Stack alignment details if applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: switching the drift gate scan to use git diff instead of the previous approach, and highlights the key benefit (catching missing-locally case).
Linked Issues check ✅ Passed The PR successfully implements the requirements from #3779: switches scan source from git ls-files to git diff, detects files missing locally, and adds appropriate BLOCK messaging with restore hints.
Out of Scope Changes check ✅ Passed All changes are narrowly scoped to updating the drift gate scan logic in the SKILL.md documentation file, directly aligned with issue #3779 requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/drift-gate-scan-source-flip

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@PierreBrisorgueil PierreBrisorgueil merged commit af80ac4 into master Jun 3, 2026
4 checks passed
@PierreBrisorgueil PierreBrisorgueil deleted the fix/drift-gate-scan-source-flip branch June 3, 2026 15:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the /update-stack skill’s “3ter: Block on drift” gate to detect stack-file drift using a symmetric upstream-vs-local diff, including the previously undetectable “present upstream but missing locally” case.

Changes:

  • Switches the drift scan source from git ls-files (local-only enumeration) to git diff --name-only devkit-node/master HEAD over modules/, lib/, and config/.
  • Adds an explicit BLOCK path for “missing locally (was on upstream)” with a restore command hint.
  • Updates the documented rule to explain why git diff is used (bidirectional change detection).

local_blob=$(git rev-parse "HEAD:$f" 2>/dev/null)
if [ "$upstream_blob" != "$local_blob" ]; then
echo "BLOCK: drift on shared stack file: $f"
# Both sides exist + differ → drift
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.

fix(skills/update-stack): switch drift gate scan source from local git ls-files to upstream git ls-tree

2 participants