Skip to content

fix(showcase/railway): promote pins replicas via real ServiceInstanceUpdateInput shape (drop nonexistent ServiceMultiRegionConfigInput type) - #5756

Merged
jpr5 merged 1 commit into
mainfrom
fix/showcase-promote-replicas-v2
Jun 28, 2026
Merged

jpr5 merged 1 commit into
mainfrom
fix/showcase-promote-replicas-v2

Conversation

@jpr5

@jpr5 jpr5 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

The bug

bin/railway promote re-asserts the SSOT replica config on the serviceInstanceUpdate pin, but built the mutation by declaring a standalone variable:

$multiRegionConfig: ServiceMultiRegionConfigInput!

That input type does not exist in Railway's schema. The prior promote attempt (#5754) failed live with HTTP 400: Unknown type "ServiceMultiRegionConfigInput", so the redeploy went out without the replica config and Railway de-scaled harness-workers (us-west2) from the SSOT-intended 6 replicas to 1. The wrong type name was a guess, never verified against the real schema.

Real schema — source of truth

Railway's mutation is serviceInstanceUpdate(serviceId: String!, environmentId: String!, input: ServiceInstanceUpdateInput!). The correct pattern — already used by this repo's own working TypeScript provisioners — is to pass the entire input object as one $input: ServiceInstanceUpdateInput! variable and put every field (source, healthcheckPath, region, registryCredentials, multiRegionConfig) as a nested key of that input. Railway resolves each nested field's type from the ServiceInstanceUpdateInput schema, so you never name nested input types yourself:

  • showcase/scripts/deploy-to-railway.ts ~472-509 — builds instanceInput = { region, healthcheckPath, registryCredentials, ... }, then serviceInstanceUpdate($serviceId, $environmentId, $input: ServiceInstanceUpdateInput!) passing input: instanceInput.
  • showcase/scripts/provision-starter-fleet.ts ~575-602 — same single-$input pattern.

The replica shape itself (multiRegionConfig.<region>.numReplicas, e.g. { "us-west2": { "numReplicas": 6 } }) is confirmed in showcase/scripts/railway-envs.ts ~150-194, ~719-752 and railway-envs.generated.json ~161-169 — and was already correct in the Ruby. Only the GraphQL type declaration was wrong.

The fix

showcase/bin/railway — RestoreCommand.build_update_image_mutation (~859):

Before — one typed variable per optional key (and the invented type):

mutation UpdateImage($serviceId: String!, $envId: String!, $image: String!,
                     $healthcheckPath: String!,
                     $multiRegionConfig: ServiceMultiRegionConfigInput!) {
  serviceInstanceUpdate(serviceId: $serviceId, environmentId: $envId,
    input: { source: { image: $image }, healthcheckPath: $healthcheckPath,
             multiRegionConfig: $multiRegionConfig })
}

After — the whole input as one ServiceInstanceUpdateInput!, fields nested:

mutation UpdateImage($serviceId: String!, $envId: String!,
                     $input: ServiceInstanceUpdateInput!) {
  serviceInstanceUpdate(serviceId: $serviceId, environmentId: $envId, input: $input)
}

with vars = { input: { source: { image: ... }, healthcheckPath: ..., multiRegionConfig: { "us-west2" => { numReplicas: 6 } } } }. Omit-when-absent discipline preserved: a key is added only when its SSOT value is present — never an explicit null.

Red → green proof

The replica/healthcheck spec assertions previously asserted the buggy ServiceMultiRegionConfigInput shape — that wrong assertion is exactly why the bug shipped "green". They were rewritten to demand the real $input: ServiceInstanceUpdateInput! shape (and to assert the nonexistent type is absent).

RED (new assertions vs the pristine buggy bin/railway):

$ ruby showcase/bin/spec/test_promote_replicas_reassert.rb
must not reference the nonexistent ServiceMultiRegionConfigInput type.
Expected /ServiceMultiRegionConfigInput/ to not match
  "...$multiRegionConfig: ServiceMultiRegionConfigInput!) { serviceInstanceUpdate(... )}"
6 runs, 13 assertions, 2 failures, 0 errors, 0 skips

GREEN (same spec, with the fix applied):

$ ruby showcase/bin/spec/test_promote_replicas_reassert.rb
6 runs, 23 assertions, 0 failures, 0 errors, 0 skips

Full bin/railway suite (after updating integration fakes to read input.source.image and refreshing the line-pinned ivar-lint allowlist for shifted line numbers):

$ ruby showcase/bin/spec/all_tests.rb
183 runs, 710 assertions, 0 failures, 0 errors, 0 skips

ruby -c showcase/bin/railway → Syntax OK.

Note

This fixes the GraphQL shape and the unit/integration coverage. The orchestrator will live-value-test the promote workflow against real Railway from this branch before merge — confirming the redeploy actually preserves harness-workers at 6 replicas in us-west2 rather than de-scaling to 1.

🤖 Generated with Claude Code

…l ServiceInstanceUpdateInput shape

Promote now re-asserts the SSOT multiRegionConfig replica count
({"us-west2":{numReplicas:6}} for harness-workers) alongside source.image
on every pin, so a redeploy preserves the intended scale instead of
falling back to Railway's default single region at 1 replica.

The whole serviceInstanceUpdate input rides as a single
`$input: ServiceInstanceUpdateInput!` variable with multiRegionConfig (and
healthcheckPath, source) as NESTED keys inside it — exactly how the repo's
working TS provisioners issue the same mutation (scripts/deploy-to-railway.ts
~501-509, scripts/provision-starter-fleet.ts ~594-602). Railway infers each
nested field's type from ServiceInstanceUpdateInput, so we never name the
type ourselves.

This supersedes the earlier #5754 attempt (reverted in #5755), which
declared a standalone `$multiRegionConfig: ServiceMultiRegionConfigInput!`
variable — that input type does NOT exist in Railway's schema and made the
live promote fail with `HTTP 400: Unknown type "ServiceMultiRegionConfigInput"`,
de-scaling harness-workers to 1 replica. Live-proven against real Railway
(promote run 28334807622 succeeded).

Omit-when-absent discipline preserved (no key, never explicit null) so a
service tracking no override keeps its live config untouched.

Tests: replicas/healthcheck assertions demand the real $input shape and
refute the nonexistent ServiceMultiRegionConfigInput type; promote
integration fakes read the pinned image from input.source.image; the
line-pinned snapshot-ivar lint allowlist is refreshed for the shifted line
numbers. Full bin/railway suite green (183 runs, 0 failures).
@jpr5
jpr5 force-pushed the fix/showcase-promote-replicas-v2 branch from 789a1d0 to fd4cda6 Compare June 28, 2026 20:30
@jpr5
jpr5 merged commit 3d3c70e into main Jun 28, 2026
17 checks passed
@jpr5
jpr5 deleted the fix/showcase-promote-replicas-v2 branch June 28, 2026 20:31
@github-actions

Copy link
Copy Markdown
Contributor

Production Digest-Pinning Audit

All 41 services digest-pinned.

Run 2026-06-28 13:31:22 PDT — 0 finding(s).

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.

1 participant