fix: add include guard to shared-constants.sh and remove duplicate source lines#483
fix: add include guard to shared-constants.sh and remove duplicate source lines#483marcusquinn merged 1 commit intomainfrom
Conversation
…urce lines PR #480 (shared-constants adoption) added source lines to scripts that already had them from PR #479 (sed portability), causing double-sourcing. Under set -euo pipefail, the second source fails on readonly re-declaration, silently breaking supervisor-helper.sh (batch, help, all commands return 1). Fix: Add include guard (_SHARED_CONSTANTS_LOADED) so shared-constants.sh is safe to source multiple times. Also remove 5 duplicate source lines.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
WalkthroughThe PR refactors shell script initialization in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 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. Comment |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Feb 7 21:02:30 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|



Summary
shared-constants.shso it's safe to source multiple timessource shared-constants.shlines introduced by PR refactor: increase shared-constants.sh adoption from 17% to 93% (t135.8) #480 merging on top of PR fix(portability): replace sed -i with portable sed_inplace wrapper (t145) #479Problem
PR #479 (sed portability) added
source shared-constants.shto 7 scripts. PR #480 (shared-constants adoption) independently added the same line to 155 scripts. When both merged, 5 scripts ended up with two source lines. Underset -euo pipefail, the second source fails onreadonlyre-declaration, causing all supervisor-helper.sh commands to silently exit 1 (batch, help, status, pulse — everything broken).Root Cause
shared-constants.shdeclares 81readonlyvariables. Sourcing it twice triggersreadonly variableerrors. Withset -e, this kills the script even when the second source has|| true(bash propagates errors from within sourced files).Fix
shared-constants.sh:[[ -n "${_SHARED_CONSTANTS_LOADED:-}" ]] && return 0— makes it idempotentTesting
Summary by CodeRabbit