feat(#125): rename GITEA_URL to VCS_URL with deprecated fallback #126
Reference in New Issue
Block a user
Delete Branch "issue-125"
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?
Summary
Implements issue #125: rename
GITEA_URLenv var to genericVCS_URLfor multi-host support.Plan
Problem
The
GITEA_URLenvironment variable (and--gitea-urlflag) implies the binary only works with Gitea. Now that review-bot supports both Gitea and GitHub/GHES, the name is misleading.Constraints
GITEA_URL— deprecated fallback with warning--gitea-url→--vcs-urlINTEGRATION_GITEA_URL→INTEGRATION_VCS_URLgitea-url→vcs-urlBackward Compatibility
GITEA_URLenv varVCS_URL--gitea-urlflag--vcs-urlgitea-urlaction inputvcs-urlINTEGRATION_GITEA_URLINTEGRATION_VCS_URLDeprecation Behavior
If
GITEA_URLis set andVCS_URLis not, binary logs:If
--gitea-urlis used and--vcs-urlis not, binary logs:Error Cases
VCS_URLandGITEA_URLset:VCS_URLwins (primary takes precedence)--vcs-urland--gitea-urlprovided:--vcs-urlwinsFiles Changed
cmd/review-bot/main.go--vcs-urlflag +VCS_URLenv, deprecated--gitea-url/GITEA_URLfallback.gitea/actions/review/action.ymlgitea-url→vcs-url, envGITEA_URL→VCS_URL.gitea/workflows/ci.ymlGITEA_URL→VCS_URLcmd/review-bot/integration_test.goINTEGRATION_GITEA_URL→INTEGRATION_VCS_URLintegration_test.goREADME.mdProgress
VCS_URLis read first;GITEA_URLis fallback with deprecation warning--vcs-urlflag is primary;--gitea-urlis deprecated alias with warning--vcs-urlnot--gitea-urlaction.ymlpassesVCS_URL(notGITEA_URL) to the binaryci.ymlpassesVCS_URL(notGITEA_URL) to the binaryINTEGRATION_VCS_URLgo test ./...passesgo vet ./...passesgo build ./cmd/review-botsucceedsOriginal reviewSuperseded — see current review for up-to-date findings.
Previous findings (commit
4f70f423)Sonnet Review
Summary
Clean, well-scoped rename of GITEA_URL to VCS_URL with proper backward-compatibility fallback. The implementation correctly defers the deprecated env var check until after
flag.Parse()andsetupLogger()so the warning routes through slog. All affected files (action YAML, CI workflow, integration tests, README) are consistently updated.Findings
PLAN-125.md*.mdplan files to.gitignore.README.md--gitea-urlin the code block. The env var table was updated correctly, but the example command itself was not changed to--vcs-url. Users reading the quick-start example will see the deprecated flag.cmd/review-bot/main.gogiteaURLAliasflag uses description"Deprecated: use --vcs-url"but the PR description and plan say it should be visible with the deprecation note. This is fine, though the description could be slightly more informative:"Deprecated: use --vcs-url instead"matches the slog warning text for consistency.Recommendation
APPROVE — Approve with minor follow-up suggestions. The core logic is correct: VCS_URL is read at flag registration time via
os.Getenv, the GITEA_URL and --gitea-url fallbacks are checked post-parse after slog is initialized (so warnings are properly structured), and all callers of the URL variable are updated consistently. The only actionable item before merge is updating the CLI example in README.md to show--vcs-urlinstead of--gitea-url— the env var table was fixed but the example command block was missed. The PLAN-125.md file should ideally not be committed to the repo.Review by sonnet
Evaluated against
4f70f423@@ -0,0 +1,175 @@# Plan: Issue #125 — Rename GITEA_URL → VCS_URL[NIT] PLAN-125.md is a planning artifact committed to the repository. Planning docs typically don't belong in version control alongside source code; they belong in the issue tracker or a wiki. Consider removing it before merge or adding
*.mdplan files to.gitignore.@@ -299,7 +299,7 @@ All flags have environment variable equivalents:[NIT] The CLI Usage example (around line 253 in README.md) still shows
--gitea-urlin the code block. The env var table was updated correctly, but the example command itself was not changed to--vcs-url. Users reading the quick-start example will see the deprecated flag.@@ -55,3 +55,3 @@verbosity := flag.String("verbosity", envOrDefault("LOG_VERBOSITY", "info"), "Log verbosity: debug, info, warn, error")// CLI flagsgiteaURL := flag.String("gitea-url", envOrDefault("GITEA_URL", ""), "Gitea instance URL")vcsURL := flag.String("vcs-url", os.Getenv("VCS_URL"), "VCS server URL (e.g. https://gitea.example.com)")[NIT]
giteaURLAliasflag uses description"Deprecated: use --vcs-url"but the PR description and plan say it should be visible with the deprecation note. This is fine, though the description could be slightly more informative:"Deprecated: use --vcs-url instead"matches the slog warning text for consistency.Original reviewSuperseded — see current review for up-to-date findings.
Previous findings (commit
4f70f423)Gpt Review
Summary
The changes correctly introduce VCS_URL/--vcs-url with proper deprecation fallbacks for GITEA_URL/--gitea-url, update the composite action and CI workflow, and adjust integration tests accordingly. Implementation order ensures deprecation warnings go through slog and precedence rules are handled correctly.
Findings
README.mdRecommendation
APPROVE — Overall, this PR cleanly implements the migration to VCS_URL/--vcs-url while maintaining backward compatibility and clear deprecation warnings. The precedence behavior (new flag/env wins over deprecated ones) is correct, and action/workflow updates align with the code. Please update the README’s CLI Usage example to reflect --vcs-url to keep documentation consistent with the new interface. Otherwise, the changes look solid and ready to merge.
Review by gpt
Evaluated against
4f70f423@@ -299,7 +299,7 @@ All flags have environment variable equivalents:[MINOR] README’s Env Var table reflects the new --vcs-url/VCS_URL mapping, but the earlier CLI Usage example still shows --gitea-url. Consider updating the CLI Usage section to use --vcs-url to avoid confusion.
Original reviewSuperseded — see current review for up-to-date findings.
Previous findings (commit
4f70f423)Security Review
Summary
The changes implement a backward-compatible rename of GITEA_URL/--gitea-url to VCS_URL/--vcs-url and update related action/workflow/test references. CI passed and no exploitable vulnerabilities were introduced by this diff.
Findings
.gitea/actions/review/action.yml(...), bash would execute it even within quotes. Although typically controlled by trusted workflow authors, consider validating inputs against an allowlist (e.g., owner/name pattern) or sanitizing to strip, backticks, and parentheses to reduce risk.cmd/review-bot/main.goRecommendation
APPROVE — Approve the PR. The rename to VCS_URL/--vcs-url with deprecation fallback is implemented cleanly and does not introduce security issues. For future hardening, consider validating the VCS_URL to require HTTPS, and in the composite action add input validation/sanitization for repo and vcs-url to prevent potential command substitution in bash if those values were ever influenced by untrusted sources.
Review by security
Evaluated against
4f70f423@@ -112,10 +112,10 @@ runs:id: version[MINOR] Inputs (repo, vcs-url) are used directly in double-quoted bash strings for curl URLs. If these inputs contained command substitution syntax like
(...), bash would execute it even within quotes. Although typically controlled by trusted workflow authors, consider validating inputs against an allowlist (e.g., owner/name pattern) or sanitizing to strip, backticks, and parentheses to reduce risk.@@ -91,12 +92,24 @@ func main() {[MINOR] VCS_URL is accepted as-is without validation. As a defense-in-depth measure, validate that the URL uses HTTPS (and a sane host) to avoid accidentally sending reviewer tokens over insecure transport.
4f70f423b4tob80a1517edSonnet Review
Summary
Clean, well-executed rename from GITEA_URL/--gitea-url to VCS_URL/--vcs-url with proper backward compatibility. The implementation follows the design outlined in the plan, CI passes, and the deprecation warnings are correctly placed post-flag-parse so they go through slog. No functional regressions identified.
Findings
PLAN-125.mdREADME.md--gitea-url(not--vcs-url). The env var table was updated but the example command block further up in the document was not changed. Users following the example will get the deprecated flag warning.cmd/review-bot/main.go--gitea-urlflag description reads"Deprecated: use --vcs-url"which is useful, but per the plan's open question the decision was to keep it visible with a deprecation note. This is fine, but it could be slightly more helpful with the full flag name:"Deprecated: use --vcs-url instead"(matches the slog warning wording at line 101).Recommendation
APPROVE — Approve with minor nits. The core implementation is correct: backward compatibility is preserved via post-parse env var and flag fallbacks, slog warnings are emitted at the right time (after setupLogger), all references to the old names are updated in CI config and action YAML, and the error message now references --vcs-url. The only actionable item worth fixing before merge is the stale
--gitea-urlin the README CLI usage example — users copy-pasting it will get a deprecation warning on every run. The PLAN-125.md file should also be cleaned up from the repo. Neither is a blocker, but both are worth addressing.Review by sonnet
Evaluated against
b80a1517@@ -0,0 +1,175 @@# Plan: Issue #125 — Rename GITEA_URL → VCS_URL[NIT] PLAN-125.md is a planning/design artifact committed to the repository. Typically, implementation plans live in issues/wikis rather than the codebase itself. Consider removing it before merge or moving it to the issue tracker.
@@ -299,7 +299,7 @@ All flags have environment variable equivalents:[NIT] The CLI usage example in README.md still shows
--gitea-url(not--vcs-url). The env var table was updated but the example command block further up in the document was not changed. Users following the example will get the deprecated flag warning.@@ -55,3 +55,3 @@verbosity := flag.String("verbosity", envOrDefault("LOG_VERBOSITY", "info"), "Log verbosity: debug, info, warn, error")// CLI flagsgiteaURL := flag.String("gitea-url", envOrDefault("GITEA_URL", ""), "Gitea instance URL")vcsURL := flag.String("vcs-url", os.Getenv("VCS_URL"), "VCS server URL (e.g. https://gitea.example.com)")[NIT] The
--gitea-urlflag description reads"Deprecated: use --vcs-url"which is useful, but per the plan's open question the decision was to keep it visible with a deprecation note. This is fine, but it could be slightly more helpful with the full flag name:"Deprecated: use --vcs-url instead"(matches the slog warning wording at line 101).Security Review
Summary
Changes cleanly rename GITEA_URL/--gitea-url to VCS_URL/--vcs-url with proper deprecation warnings and precedence handling. No new security-relevant risks are introduced, and CI has passed.
Recommendation
APPROVE — The migration logic in main.go correctly prioritizes VCS_URL and --vcs-url while providing clear deprecation warnings for legacy env/flag usage. The composite action and CI workflow updates are consistent with the new naming and do not introduce additional security exposure beyond existing behavior. Consider, in future hardening, validating external download URLs and signature verification for binaries in the action, but this is outside the scope of the renaming change. Overall, the changes are secure and backward-compatible.
Review by security
Evaluated against
b80a1517Gpt Review
Summary
Overall the refactor from GITEA_URL/--gitea-url to VCS_URL/--vcs-url is implemented cleanly across the CLI, action, workflow, and tests, with appropriate deprecation warnings. However, there is a precedence bug in main.go where the deprecated --gitea-url flag does not override the GITEA_URL env var, which is surprising and contrary to typical flag-over-env precedence.
Findings
cmd/review-bot/main.goRecommendation
REQUEST_CHANGES — Address the precedence of configuration sources so that explicit flags override environment variables, even for the deprecated alias. A simple fix is to reorder the post-parse fallback logic to check the deprecated flag before the deprecated env var, e.g.:
Concretely, replace the block starting at line 92 with:
if *vcsURL == "" && *giteaURLAlias != "" {
slog.Warn("--gitea-url is deprecated; use --vcs-url instead")
*vcsURL = *giteaURLAlias
}
if *vcsURL == "" {
if v := os.Getenv("GITEA_URL"); v != "" {
slog.Warn("GITEA_URL is deprecated; rename the environment variable to VCS_URL")
*vcsURL = v
}
}
This yields a consistent precedence: --vcs-url > --gitea-url > VCS_URL env > GITEA_URL env. After this change, re-run tests and verify the deprecation warnings still surface as intended. Everything else in the PR (action/workflow env updates, integration test env var renames, README env table update) looks good.
Review by gpt
Evaluated against
b80a1517@@ -91,12 +92,24 @@ func main() {[MAJOR] Precedence issue: when both deprecated --gitea-url flag and GITEA_URL env var are provided (with --vcs-url unset), the code prefers the env var over the flag. Typical CLI semantics are that flags override environment variables. Current fallback order is: --vcs-url > VCS_URL env > GITEA_URL env > --gitea-url. The alias flag should take precedence over env fallback.