Skip to content

github-backup(deploy): reject unrecognized arguments before any side effect (#3287) - #4475

Merged
dezren39 merged 2 commits into
mainfrom
queue/5716-3287-github-backup-args
Nov 2, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/5716-3287-github-backup-args

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #3287 (phase 1 of #3352).

infra/github-backup/worker/deploy.mjs only membership-checked --dry-run / --deploy-version and silently ran the real deploy sequence (versions upload, secret put x2) for any typo'd or unknown argument with exit 0. This change accounts for every argument before any bws/wrangler/git subprocess or deploy side effect: only bare, --dry-run, and --deploy-version <id> are accepted; everything else (unknown flags, positionals, duplicates, trailing args, missing or flag-like --deploy-version values) aborts with a usage error naming the offender (exit 2). The --dry-run + --deploy-version combination keeps its #3474 rejection, now also as a usage error (exit 2).

Tests (stubbed CLIs only, no real deploy or secret operations):

  • new infra/github-backup/tests/test_deploy_unknown_args.py: 50/50
  • existing test_deploy_dry_run.py: 11/11
  • existing test_deploy_rollback_version.py: 16/16

Queue task 5716.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…effect (#3287)

Strictly account for every deploy.mjs argument before any bws, wrangler,
git, subprocess, network, file, lock, or deployment side effect. Only
bare, --dry-run, and --deploy-version <id> are accepted; unknown flags,
stray positionals, duplicates, trailing args, and missing or flag-like
--deploy-version values abort with a usage error naming the offender
(exit 2). The --dry-run + --deploy-version combination keeps its #3474
rejection, now also as a usage error (exit 2).

Regression coverage: infra/github-backup/tests/test_deploy_unknown_args.py
drives the real script with stubbed CLIs.
@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 17:08
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 34 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 439b6c92-6519-4a92-a512-52c10024b286
Commits

Reviewing files that changed from the base of the PR and between 5c49f48 and 4d05166.

Files selected for processing: 2
  • infra/github-backup/tests/test_deploy_unknown_args.py
  • infra/github-backup/worker/deploy.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T17:36:10.703295Z 4d05166 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9bc1fab6fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread infra/github-backup/worker/deploy.mjs Outdated
} else if (arg === "--deploy-version") {
if (deployVersion !== null) usageError("duplicate argument: --deploy-version");
const value = args[i + 1];
if (value === undefined) usageError("--deploy-version needs a version id");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject an empty deployment version before invoking subprocesses

When invoked as --deploy-version "$VERSION" with an empty variable, this check accepts the empty string as a version ID. The script then retrieves Bitwarden secrets and invokes wrangler versions view with an empty ID instead of reporting a usage error before external calls. The previous !deployVersion check rejected this input before those operations. Reject empty strings as well as undefined and cover the quoted-empty-value case in the regression tests.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4d05166 (queue task 5716, lane code-l): --deploy-version "" is now rejected with the same usage error (exit 2) before any bws/wrangler subprocess — the value check is value === undefined || value === "". Regression coverage added in test_deploy_unknown_args.py §3 (empty value: exit 2, error names --deploy-version, no stub call at all). Suites on the laptop at the new head: unknown-args 53/53, dry-run 11/11, rollback 16/16.

@dezren39

dezren39 commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 4d051661dc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dezren39
dezren39 merged commit 7992bfe into main Nov 2, 2026
2 checks passed
@dezren39
dezren39 deleted the queue/5716-3287-github-backup-args branch November 2, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

github-backup(worker deploy): unrecognized arguments are silently ignored — a typo'd --dry-rnu performs a real deploy (upload + secret reset)

1 participant