@@ -442,27 +442,44 @@ security:advisory-sync:
442442 script :
443443 - bash scripts/check-advisory-sync.sh
444444
445- # Default-branch gate: `docs/plans/` is the branch-lifetime home for design
446- # docs + backlogs. They are distilled into ADRs (`docs/adr/`) and the
447- # Diátaxis set (`docs/architecture/`) and removed before merging. This gate
448- # fails the pipeline if the folder survived a merge onto the default branch.
449- # Plain bash, no image deps.
445+ # No-plans gate (D7): `docs/plans/` is the branch-lifetime home for design docs
446+ # + backlogs, distilled into `docs/adr/` + `docs/architecture/` and removed
447+ # before they reach main. Runs PRE-MERGE on every MR to a protected branch:
448+ # - MR to main → HARD FAIL (plans must be gone before main).
449+ # - MR to develop → WARNING only (plans may ride into integration; non-blocking).
450+ # Plus a post-merge backstop on the default branch (a fail). `exit 2` is the
451+ # allowed-failure (warning) code; `exit 1` is a hard fail. Plain bash, no deps.
450452quality:no-plans-on-default-branch :
451453 stage : quality
452454 image : ${RUST_IMAGE}
453455 needs : []
454456 rules :
455- - if : $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
457+ # Pre-merge gate: any MR targeting a protected branch.
458+ - if : ' $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^(main|develop)$/'
459+ # Post-merge backstop on the default branch (direct push / bypassed MR).
460+ - if : ' $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
461+ # exit 2 → allowed failure (yellow "warning", non-blocking) on MRs to develop;
462+ # any other non-zero (exit 1) is a hard fail (blocks the merge to main).
463+ allow_failure :
464+ exit_codes :
465+ - 2
456466 script :
457467 - |
458468 if [ -d docs/plans ] && [ -n "$(ls -A docs/plans 2>/dev/null)" ]; then
459- echo "ERROR: docs/plans/ exists on the default branch ($CI_DEFAULT_BRANCH)."
460- echo "Branch-lifetime planning docs must be distilled into docs/adr/ +"
461- echo "docs/architecture/ and removed before merge. Offending entries:"
469+ target="${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-$CI_COMMIT_BRANCH}"
470+ echo "docs/plans/ is present. Offending entries:"
462471 ls -A docs/plans
472+ if [ "$target" = "develop" ]; then
473+ echo "WARNING: docs/plans/ on an MR to develop — allowed during integration,"
474+ echo "but it MUST be distilled into docs/adr/ + docs/architecture/ and removed"
475+ echo "before reaching main (the MR to main will FAIL otherwise)."
476+ exit 2
477+ fi
478+ echo "ERROR: docs/plans/ would land on main (D7). Distil the durable decisions"
479+ echo "into docs/adr/ + docs/architecture/ and remove docs/plans/ before merging."
463480 exit 1
464481 fi
465- echo "OK: no docs/plans/ on the default branch ."
482+ echo "OK: no docs/plans/ present ."
466483
467484# cargo-deny gate. Runs the four sections in `deny.toml`: advisory floor,
468485# license allowlist, banned crates (openssl-sys, native-tls, wasmtime*),
0 commit comments