Skip to content

feat(database): surface standby topology in apply and list (Phase 3) - #569

Open
guptadev21 wants to merge 8 commits into
feat/databasefrom
feat/database-standby-phase-3
Open

feat(database): surface standby topology in apply and list (Phase 3)#569
guptadev21 wants to merge 8 commits into
feat/databasefrom
feat/database-standby-phase-3

Conversation

@guptadev21

Copy link
Copy Markdown
Member

What

Brings rio up to the managed-database Phase 3 surface (standby replicas), matching rapyuta_io @ feat/managed-database-phase-3.

  • Sample manifest (rio explain database) — documents the optional standby block (primaryInterface + devices[]; primaryHost is server-resolved, do not set it).
  • Sample manifest, credentials fix — the block was keyed credentials: with a nested secretKeyRef, while the API field is users: with the ref inline as {name, key}. PostgresSpec ignores unknown keys, so the whole block was dropped silently and the server then rejected the apply with "database credentials are not specified". The backup user is dropped too — it is generated server-side and anything supplied is overwritten.
  • rio database list — a Standby column reporting running/desired standby devices, - when the database has none.

SDK pin

pyproject.toml is pinned at rapyuta-io-sdk-v2@feat/managed-database-phase-3 because @feat/database has no spec.postgres.standby yet — without the bump the topology is silently dropped and the Standby column reads - for every database.

Revert the pin to @feat/database once rapyuta-robotics/rapyuta-io-sdk-v2#67 merges.

Tests

  • tests/unit/test_database_util.py_standby_summary across no-standby / all-running / partially-running / no-status-reported.
  • tests/unit/test_database_list.pyrio database list renders the column as running/desired, and a primary-only database reads - rather than a misleading 0/0.

uv run ruff check . and ruff format --check clean; uv run pytest tests/unit/ — 294 passed. Verified the sample manifest round-trips through the apply model with standby uncommented.

Notes

  • No JSON schema was added: riocli/jsonschema/schemas/ has no database schema and Model.validate() is only called by riocli/device/model.py — v2 resources validate through the SDK pydantic model in Database.__init__.
  • Restore (kind: Restore) is Phase 4 and is not in this PR.
  • DELETE /v2/databases/{name}/?force=true (skip waiting for device ACKs) is a Phase-3 API addition left unexposed by decision — --force on rio database delete is the confirmation-skip flag and the name is taken.

Adjacent issue, not fixed here

riocli/database/util.fetch_databases uses the unpaginated client.list_databases().items while backup/util.py uses walk_pages, so rio database delete --all silently misses databases past the first page.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NBCzX6sbXL1Tt3zS8w4qb6

ankitrgadiya and others added 7 commits August 13, 2026 15:55
* feat(database): add Database CLI commands and apply support (Phase 1)

Adds the `rio database` command group and wires up the Database resource
into the declarative apply/delete workflow:
- `rio database list` — tabular listing with phase, device, version
- `rio database inspect` — YAML/JSON output via the existing inspect helper
- `rio database delete` — single, regex, or --all with parallel workers
- `riocli/database/model.py` — Model subclass for `rio apply` and `rio delete`
- `riocli/apply/manifests/database.yaml` — sample manifest for `rio explain database`
- KIND_TO_CLASS entry so `rio apply` dispatches Database manifests correctly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(deps): pin rapyuta-io-sdk-v2 to feat/database branch

Overrides the published SDK version with the feat/database git branch so the CLI
picks up the new Database models and client methods while this phase is under
review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
feat: database phase 2
…on (#561)

* chore(deps): pin rapyuta-io-sdk-v2 to feat/database-secrets-integration

feat/database-secrets-integration's database/backup secret-reference
work is already present on feat/database; only the SDK source pin
was unique to this branch.

* chore: update packages

* fix(dependencies): update rapyuta-io-sdk-v2 source to use feat/database branch
- Sample manifest: fix the credentials block, which was keyed `credentials`
  with a nested `secretKeyRef` while the API field is `users` with the ref
  inline. PostgresSpec ignores unknown keys, so the block was silently
  dropped and the server rejected the apply. Drop the backup user too — it
  is generated server-side and any caller-supplied value is overwritten.
- Sample manifest: document the optional `standby` block.
- `rio database list`: add a Standby column reporting running/desired
  standby devices, "-" when the database has none.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The cherry-picked standby work needs an SDK that models
`spec.postgres.standby`; the pinned `feat/database` ref does not have it, and
PostgresSpec ignores unknown keys, so the topology would be dropped silently
and the Standby column would read "-" for every database.

- pyproject: pin rapyuta-io-sdk-v2 at feat/managed-database-phase-3. Revert to
  @feat/database once rapyuta-io-sdk-v2#67 merges.
- tests: `rio database list` renders the Standby column as running/desired, and
  a primary-only database reads "-" rather than "0/0".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBCzX6sbXL1Tt3zS8w4qb6
@guptadev21
guptadev21 requested review from a team as code owners August 17, 2026 06:13
@guptadev21
guptadev21 requested review from ankitrgadiya and sharmayajush and removed request for a team August 17, 2026 06:13
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

🤖 Pull Request Artifacts (#32105231136) 🎉

@guptadev21 guptadev21 self-assigned this Aug 17, 2026
The pg_hba trust network is settable now. Left commented with its default so a
reader knows it exists without changing behaviour by uncommenting the block.
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.

2 participants