Skip to content

fix(scale): derive the legacy arg normalizer's option list from clap - #1042

Open
codyde wants to merge 1 commit into
masterfrom
railway/scale-project-flag
Open

fix(scale): derive the legacy arg normalizer's option list from clap#1042
codyde wants to merge 1 commit into
masterfrom
railway/scale-project-flag

Conversation

@codyde

@codyde codyde commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Problem

railway scale --project <id> fails with Invalid replica count; -p <id> works.

normalize_legacy_scale_args rewrites unrecognized --foo bar into the positional foo=bar, to keep the legacy --<region> <count> spelling working. It kept a hand-maintained copy of scale's options that had drifted from Args: --project (added in #893, after the normalizer landed in #881) was missing, so it became project=<id> and was parsed as REGION=REPLICAS.

Closes #1024.

Resolution

  • Derive the long and short option sets from Args::command() instead of restating them, so a new option on Args cannot reintroduce this.
  • railway service scale reuses the same Args type — both entry forms now share one source of truth.
  • --version stays explicit: it is propagated from the root command, not declared on Args.

Verification

Against a live project, before = 5.30.4:

before after
scale --project <id> … Invalid replica count ok
scale --project=<id> … Invalid replica count ok
scale -p <id> … ok ok
service scale --project <id> … Invalid replica count ok
scale --us-west2 1 (legacy) ok ok

`railway scale --project <id>` failed with "Invalid replica count", while
`-p <id>` worked.

`normalize_legacy_scale_args` rewrites unrecognized `--foo bar` into the
positional `foo=bar` to keep the legacy `--<region> <count>` spelling working.
It kept its own hand-maintained list of scale's options, which had drifted from
`Args`: `--project` (added in #893, after the normalizer landed in #881) was
missing, so it became the positional `project=<id>` and was parsed as
`REGION=REPLICAS`.

Derive the long and short option sets from `Args::command()` instead of
restating them, so a new option on `Args` cannot reintroduce this. `railway
service scale` reuses the same `Args` type, so both entry forms share one
source of truth.
@codyde codyde added the release/patch Author patch release label Aug 5, 2026 — with Railway App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/patch Author patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

railway scale misclassifies the long --project option as a region assignment

1 participant