Skip to content

refactor(rds): make CreateDBInstance async, drop 180s SDK timeout#808

Merged
vieiralucas merged 1 commit intomainfrom
worktree-rds-async-create
Apr 28, 2026
Merged

refactor(rds): make CreateDBInstance async, drop 180s SDK timeout#808
vieiralucas merged 1 commit intomainfrom
worktree-rds-async-create

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Apr 28, 2026

Summary

CreateDBInstance returns a creating placeholder ~immediately. The container start (and any underlying postgres image pull/build) runs in a background task; DescribeDBInstances flips to available once the container is up, or removes the row and emits RDS-EVENT-0058 ("DB instance failed to create") on failure. Matches real AWS RDS behavior.

  • <Endpoint> suppressed from XML while status is creating.
  • Persistence load drops creating rows from captured snapshots (background task didn't survive restart).
  • New helpers::wait_for_db_available test helper; existing rds tests + sdk tests bridge into it.
  • TypeScript SDK e2e drops the 180_000 ms blanket timeout for an explicit poll loop on DescribeDBInstances.

Test plan

  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo fmt --all
  • cargo test -p fakecloud-rds (120 unit tests)
  • Full E2E + TS SDK e2e in CI (Docker-bound)

Summary by cubic

Make RDS CreateDBInstance asynchronous: it returns creating immediately and starts the container in the background; DescribeDBInstances flips to available when ready or emits RDS-EVENT-0058 on failure. Tests, SDK e2e, and docs now poll for readiness; the <Endpoint> field is hidden until the instance is live.

  • New Features

    • Async create flow matching AWS RDS; background task marks instances available or cleans up and emits RDS-EVENT-0058 on failure.
    • <Endpoint> omitted while status is creating.
    • Persistence load drops stuck creating rows captured mid-create.
    • New helpers::wait_for_db_available for tests; e2e and heavy-engine tests updated.
    • TypeScript e2e replaces the 180s blanket timeout with a DescribeDBInstances poll loop (test timeout 300s).
  • Migration

    • After CreateDBInstance, poll DescribeDBInstances until status is available. Do not expect Endpoint during creating.
    • Replace fixed timeouts with a poll loop; use the new test helper where applicable.

Written for commit 31e89bf. Summary will update on new commits. Review in cubic

CreateDBInstance now returns a `creating` placeholder ~immediately and
runs the container start (and any underlying postgres image pull/build)
in a background tokio task. DescribeDBInstances flips the row to
`available` once the container is up, or removes it and emits
RDS-EVENT-0058 ("DB instance failed to create") on failure. Matches
real AWS RDS behavior — CreateDBInstance never blocks on the container.

- The `<Endpoint>` element is suppressed from the Create/Describe XML
  while the instance is in `creating` so SDK callers don't try to dial
  an empty host:0.
- Persistence load drops any `creating` rows from a captured snapshot;
  the background task didn't survive the restart and the placeholder
  would otherwise be stuck forever.
- New `helpers::wait_for_db_available` for tests that need the
  endpoint after Create. Existing rds e2e tests + sdk e2e bridge into
  it; the heavy-engine and aws_lambda/aws_s3 tests pass through too.
- TypeScript SDK e2e drops the 180_000 ms blanket timeout in favor of
  an explicit poll loop on DescribeDBInstances, matching what users
  will write themselves.
@vieiralucas vieiralucas merged commit c814564 into main Apr 28, 2026
12 of 15 checks passed
@vieiralucas vieiralucas deleted the worktree-rds-async-create branch April 28, 2026 01:29
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

❌ Patch coverage is 26.05634% with 105 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/fakecloud-rds/src/service.rs 29.60% 88 Missing ⚠️
crates/fakecloud-server/src/main.rs 0.00% 17 Missing ⚠️

📢 Thoughts on this report? Let us know!

vieiralucas added a commit that referenced this pull request Apr 28, 2026
fix(rds): forward fmt + SDK e2e poll fixes from PR #808
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