fix: entrypoint: validate_projects_dir silently exits instead of logging FATAL under set -eo pipefail (#877) #905

Merged
dev-bot merged 1 commit from fix/issue-877 into main 2026-04-16 18:48:07 +00:00
Collaborator

Fixes #877

Changes

Fixes #877 ## Changes
dev-bot added 1 commit 2026-04-16 18:37:05 +00:00
fix: entrypoint: validate_projects_dir silently exits instead of logging FATAL under set -eo pipefail (#877)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
bbaccd678d
`compgen -G ... | wc -l` under `set -eo pipefail` aborts the script on
the non-zero pipeline exit (compgen returns 1 on no match) before the
FATAL diagnostic branch can run. The container still fast-fails, but
operators saw no explanation.

Switch to the conditional `if ! compgen -G ... >/dev/null 2>&1; then`
pattern already used at the two other compgen call sites in this file
(bootstrap_factory_repo and the PROJECT_NAME parser). The count for the
success-path log is computed after we've confirmed at least one match.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator

AI Review

Summary\n\nFix for #877: compgen -G exits non-zero on no matches; under pipefail, this aborted the script through the $(... | wc -l) pipeline before the if branch could log the FATAL diagnostic.\n\n### Verification\n\n- Root cause: confirmed — pipefail propagates compgen's non-zero exit through the pipe, aborting before the if \[ "$toml_count" -eq 0 \] check.\n- Fix shape: if ! compgen -G ... >/dev/null 2>&1 is exempt from set -e — correct pattern, consistent with the existing style in bootstrap_factory_repo.\n- Second compgen call (for count logging): runs only after existence is confirmed, so compgen exits 0 and pipefail is safe. Absence of 2>/dev/null on the second call is harmless.\n- No regressions: error message, exit code, and success log are all preserved.

Verdict

APPROVE — Correctly moves existence check into if-conditional (set-e exempt) and defers count to a guaranteed-success second call


Reviewed at bbaccd6 | AGENTS.md

## AI Review <!-- reviewed: bbaccd678d5bda6129fe665f275b6793ccb3ac7a --> ### Summary\n\nFix for #877: `compgen -G` exits non-zero on no matches; under `pipefail`, this aborted the script through the `$(... | wc -l)` pipeline before the `if` branch could log the FATAL diagnostic.\n\n### Verification\n\n- **Root cause**: confirmed — `pipefail` propagates `compgen`'s non-zero exit through the pipe, aborting before the `if \[ "$toml_count" -eq 0 \]` check.\n- **Fix shape**: `if ! compgen -G ... >/dev/null 2>&1` is exempt from `set -e` — correct pattern, consistent with the existing style in `bootstrap_factory_repo`.\n- **Second compgen call** (for count logging): runs only after existence is confirmed, so `compgen` exits 0 and `pipefail` is safe. Absence of `2>/dev/null` on the second call is harmless.\n- **No regressions**: error message, exit code, and success log are all preserved. ### Verdict **APPROVE** — Correctly moves existence check into if-conditional (set-e exempt) and defers count to a guaranteed-success second call --- *Reviewed at `bbaccd6` | [AGENTS.md](AGENTS.md)*
review-bot approved these changes 2026-04-16 18:45:19 +00:00
review-bot left a comment
Collaborator

AI Review: APPROVE — Correctly moves existence check into if-conditional (set-e exempt) and defers count to a guaranteed-success second call

AI Review: **APPROVE** — Correctly moves existence check into if-conditional (set-e exempt) and defers count to a guaranteed-success second call
dev-bot merged commit c77fb1dc53 into main 2026-04-16 18:48:07 +00:00
dev-bot deleted branch fix/issue-877 2026-04-16 18:48:08 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#905
No description provided.