Catch module uninstalled + code removed in same push (reroll of #120)#131
Open
bserem wants to merge 1 commit into
Open
Catch module uninstalled + code removed in same push (reroll of #120)#131bserem wants to merge 1 commit into
bserem wants to merge 1 commit into
Conversation
- Add critical_fail() / bail_if_critical() helpers and CRITICAL_ERRORS counter to the main sanity-check command - Extract the module safe-uninstall check into _lib/check-drupal-safe-uninstall.sh, sourced after check-drupal-extensions.sh (which sets EXT_FILE) - Update the pre-push hook to expose GIT_PUSH_RANGE_BASE/TIP so the check can diff only the committed changes being pushed; capture sanity-check output and block unconditionally on CRITICAL: lines https://claude.ai/code/session_01KWHPaEeFbQ9MKU2wLzaKNU
Collaborator
Author
|
@dimitriskr can you do a functional review here please? You'll have to simulate the problem: Thanks |
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.
$(cat <<'EOF'
Summary
Reroll of #120 — the original PR added the safe-uninstall check directly into the monolithic
sanity-checkfile, butsanity-checkhas since been refactored into a modular_lib/architecture. This PR ports the same logic to fit that new structure.critical_fail(),bail_if_critical(), andCRITICAL_ERRORScounter tocommands/host/sanity-checkcommands/host/_lib/check-drupal-safe-uninstall.sh, sourced right aftercheck-drupal-extensions.sh(which setsEXT_FILE)scripts/git-hooks/pre-pushto exposeGIT_PUSH_RANGE_BASE/GIT_PUSH_RANGE_TIPfrom the push ref stdin, and blocks the push unconditionally (no bypass prompt) when aCRITICAL:line appears in sanity-check outputWhat it catches
When a developer tries to push a commit that simultaneously:
config/sync/core.extension.yml, anddrupal/<module>package fromcomposer.lock(or the module directory is already gone from disk)…the check flags it as
CRITICALandbail_if_criticalexits with code 2. The pre-push hook detects theCRITICAL:string in the output and blocks the push with no option to continue — unlike normal sanity-check errors which can be bypassed with ayprompt.The correct workflow is: uninstall the module → deploy → remove the code in a separate change.
Test plan
core.extension.ymlremoves a module ANDcomposer.lockremovesdrupal/<that_module>— push should be blocked with a CRITICAL messageddev sanity-checkwith no git changes — safe-uninstall section is silently skippedhttps://claude.ai/code/session_01KWHPaEeFbQ9MKU2wLzaKNU
EOF
)
Generated by Claude Code