PR #131: cleanEnv() does not strip VCS_TYPE or VCS_URL env vars #135
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was missed
cleanEnv()incmd/review-bot/main_test.gois used to build a clean subprocess environment for flag-validation tests. It stripsGITEA_*,LLM_*,REVIEWER_*, and other prefixes — but does not stripVCS_TYPEorVCS_URL.PR #131 added VCS type routing that reads
VCS_TYPEat startup. IfVCS_TYPE=githuborVCS_URLis set in the test runner's environment (e.g., in a CI environment where review-bot tests itself), subprocess tests likeTestMainSubprocess_MissingFlagswill see unexpected VCS routing behavior, potentially passing or failing for the wrong reason.For example,
TestMainSubprocess_MissingFlagspasses--gitea-url(the deprecated alias) as a flag; ifVCS_TYPE=githubleaks through from the environment, the routing path changes.Source
cmd/review-bot/main_test.goline 975 (cleanEnvfunction)What needs to happen
Add
VCS_TYPEandVCS_URLto thecleanEnv()filter:This prevents environment contamination in all current and future subprocess tests.
References