Skip to content

fix(cli): make --canary-bot reachable on init - #247

Open
ignaciocanosa wants to merge 1 commit into
theam:mainfrom
ignaciocanosa:fix/canary-bot-flag-unreachable
Open

fix(cli): make --canary-bot reachable on init#247
ignaciocanosa wants to merge 1 commit into
theam:mainfrom
ignaciocanosa:fix/canary-bot-flag-unreachable

Conversation

@ignaciocanosa

Copy link
Copy Markdown

Fixes #229.

What was broken

init's closing checklist tells the user to re-run it with --canary-bot=<your-app>[bot] to enable the weekly canary, but the flag was missing from validateLocalFlags's allowlist in cli.mjs — the CLI rejected it with Unknown option: --canary-bot before init() ever ran. The documented path to enable the canary was unreachable, and the watchtower reports the resulting default-skip as healthy rather than as a misconfiguration.

Fix

Added canary-bot to the init allowlist, to the value-taking flags list (it takes a value), and to the global help text.

Verification

  • New tests in packages/cli/test/init.test.mjs: one runs init with --canary-bot=my-app[bot] and asserts it's rendered into facility-crew.yml (and that the default doesn't leak in when overridden); the other asserts a valueless --canary-bot still errors correctly and that --canary-bot is documented in global help.
  • Reverted the fix locally and reran: both new tests fail with exactly Unknown option: --canary-bot, nothing else. Reapplied — both pass.
  • Ran the full packages/cli suite (108 tests): no new failures. 12 tests already fail on a clean checkout of main on this machine (chmod-permission assertions, fixtures needing infra unavailable here) — confirmed against an unmodified checkout with the same command, unrelated to this change.
  • Manually reproduced the issue's exact repro command end to end against a temp repo, before and after the fix.

The closing checklist init prints tells the user to re-run it with
--canary-bot=<your-app>[bot] to enable the weekly canary, but the flag
was missing from validateLocalFlags's allowlist in cli.mjs (and from
the value-taking list, and from the global help text). The documented
command failed with "Unknown option: --canary-bot" before init() ever
ran, so the canary stays on its default forever and the watchtower
reports that as a healthy skip rather than a misconfiguration.

Added init to the allowlist and value-taking list for the init
command, and to the help text.

Added two tests: one renders init with --canary-bot=my-app[bot] and
asserts it lands in facility-crew.yml (and the default does not leak
in), the other asserts a valueless --canary-bot still errors and that
global help documents the flag. Reverted the fix locally and reran:
both fail with exactly the reported error; reapplied it, both pass.

Ran the full packages/cli suite: no new failures. 12 tests already
fail on a clean checkout of main on this machine (chmod semantics,
fixtures needing infra this environment doesn't have) — confirmed via
the same suite on an unmodified checkout, unrelated to this change.

Fixes theam#229

@adrian-lorenzo adrian-lorenzo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the contribution!

Making this flag reachable also makes its value a new input to the generated crew workflow. It is currently accepted verbatim and interpolated into both the Actions if: expression and a Bash comparison. A value containing quotes can therefore produce executable shell syntax in facility-crew.yml.

Please validate it as a supported GitHub App bot login, or safely encode it for every output context, and add regression tests covering quotes, newlines, and other hostile values. Because this workflow runs agents with elevated permissions, the unsafe input case needs to be covered before merge.

With that fixed, this should be ready.

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.

init advertises --canary-bot but the flag validator rejects it, so the canary can never be enabled

2 participants