Create Railway database with its volume attached before the first deployment - #4712
Create Railway database with its volume attached before the first deployment#4712infomiho wants to merge 1 commit into
Conversation
@wasp.sh/spec
@wasp.sh/wasp-cli
@wasp.sh/wasp-cli-darwin-arm64-unknown
@wasp.sh/wasp-cli-darwin-x64-unknown
@wasp.sh/wasp-cli-linux-arm64-glibc
@wasp.sh/wasp-cli-linux-x64-glibc
@wasp.sh/wasp-cli-linux-x64-musl
commit: |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed the Railway database deployment wait behavior introduced by this PR.
- Transient failure grace —
FAILEDandCRASHEDstatuses must now persist for 30 seconds before aborting database setup, allowing Railway's replacement deployment to take over after volume attachment. - Recovery and timeout behavior — A non-failure status resets the grace period,
SUCCESSstill returns immediately, and the existing five-minute deadline remains the final bound. - Scope and verification — The helper is used only by database setup; 37 Railway-focused tests and the deploy package TypeScript build pass.
GPT Sol | 𝕏
There was a problem hiding this comment.
Important
The new deployment sequence can target an environment other than the one where Railway attached the database volume.
Reviewed changes Reviewed the new volume-first Railway database setup added since the prior Pullfrog review.
- Replaced the transient-failure grace — Created the database service without an image, attached its volume, then set the image and explicitly started its first deployment.
- Routed the environment through setup — Extracted an environment ID from Railway project status and passed it to
serviceInstanceUpdateandserviceInstanceDeployV2. - Updated the CLI contract and coverage — Raised the minimum and CI-pinned Railway CLI version to 5.28.0 and added command-ordering and cleanup tests.
GPT Sol | 𝕏
There was a problem hiding this comment.
Important
No new issues were introduced by 03903d9; the existing linked-environment targeting finding remains open and still needs to be addressed.
Reviewed changes Reviewed the command-plumbing refactor pushed after the previous Pullfrog review.
- Reused one Railway command — Constructed the cwd-bound
railwayClicommand once per database operation and threaded it through the setup helpers. - Simplified helper contracts — Replaced repeated executable and project-directory option objects with the existing
Commandabstraction. - Preserved behavior and verification — Kept command ordering and cleanup behavior unchanged; all 38 Railway-focused tests and the deploy package TypeScript build pass.
GPT Sol | 𝕏
03903d9 to
0a24573
Compare
|
Not ready for a review yet |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed the Railway database creation changes through the final code-review restructuring.
- Selected the linked environment — Replaced positional environment selection with
railway environment list --jsonand its explicitisLinkedmarker. - Separated service-instance operations — Moved image updates and deployment starts into focused Railway service-instance helpers while preserving volume-first ordering and cleanup.
- Strengthened contracts and coverage — Tightened API response schemas and added a regression test that selects the linked environment even when it is not first; all 42 Railway-focused tests and the deploy package TypeScript build pass.
GPT Sol | 𝕏
4ec33f8 to
712d63a
Compare
There was a problem hiding this comment.
Important
The latest commit removes regression coverage for both defects this PR addresses.
Reviewed changes Reviewed the changes in 4ec33f834 since the prior Pullfrog review.
- Restored the grouped image contract — Reintroduced
imageSpecfor database creation and explicitly typed the Railway service instance passed to the API helpers. - Pruned and consolidated tests — Removed schema and linked-environment tests and folded the database setup assertions into one looser test.
- Verified the current tree — All 34 Railway-focused tests pass, and the deploy package TypeScript build succeeds.
⚠️ Linked-environment selection no longer has regression coverage
Deleting railwayEnvironment/cli.test.ts leaves no test that getLinkedEnvironmentId selects the isLinked environment when it is not first, or rejects a response with no linked environment. This removes the regression test for the environment-targeting bug fixed after the prior review.
Technical details
# Restore linked-environment behavior coverage
## Affected sites
- `waspc/data/packages/deploy/src/providers/railway/railwayEnvironment/cli.ts:17` — the linked-environment selection and error paths no longer have direct coverage.
## Required outcome
- A focused test must fail if selection returns to positional environment ordering or stops rejecting an unlinked directory.GPT Sol | 𝕏
712d63a to
687b28c
Compare

Description
railway add --imagestarts deploying immediately, before the volume attaches. The first deployment crashes and our wait logic could catch that crash and abort.railway api). One deployment, volume attached from the start.railway api.Type of change
Checklist
I tested my change in a Wasp app to verify that it works as intended.
🧪 Tests and apps:
examples/kitchen-sink/e2e-tests.waspc/data/Cli/templates, as needed.examples/, as needed.examples/tutorials) I updated the tutorial in the docs (and vice versa).📜 Documentation:
web/docs/.🆕 Changelog: (if change is more than just code/docs improvement)
waspc/ChangeLog.mdwith a user-friendly description of the change.web/docs/migration-guides/.versioninwaspc/waspc.cabalto reflect the changes I introduced.