Skip to content

fix: instance health reflects in db state - #461

Open
GabriellePoncey wants to merge 1 commit into
mainfrom
fix/PLAT-333/db-status-instance-aware
Open

fix: instance health reflects in db state#461
GabriellePoncey wants to merge 1 commit into
mainfrom
fix/PLAT-333/db-status-instance-aware

Conversation

@GabriellePoncey

@GabriellePoncey GabriellePoncey commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Updated storedToDtabase to inspect the database's instance and update the database to degraded if instance states indicate this is appropriate. Delete database modified to check "from" state via the stored state rather than etcd to prevent mismatch.

Changes

  • storedToDatabase downgrades an available database to degraded if any of its instances is degraded, failed, unknown, or stopped.
  • database_test.go covers and tests this logic
  • DeleteDatabase now uses GetStoredDatabaseState (raw stored value) instead of db.State (computed) for its state-transition guard

PLAT-333

Updated storedToDtabase to inspect the database's instance and update the database to degraded if instance states indicate this is appropriate. Delete database modified to check "from" state via the stored state rather than etcd to prevent mismatch.

PLAT-333
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 2795b78a-9436-43d1-83c5-e7b7b183b264

📥 Commits

Reviewing files that changed from the base of the PR and between 9a17694 and bb1254a.

📒 Files selected for processing (3)
  • server/internal/api/apiv1/post_init_handlers.go
  • server/internal/database/database.go
  • server/internal/database/database_test.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Database lifecycle

Layer / File(s) Summary
Derive effective database state
server/internal/database/database.go, server/internal/database/database_test.go
storedToDatabase marks an available database as degraded when an instance is degraded, failed, unknown, or stopped. Tests cover these states and preserve availability for creating instances.
Use raw state during deletion
server/internal/api/apiv1/post_init_handlers.go
DeleteDatabase retrieves the raw stored state before transitioning the database to deleting and returns lookup errors first.

Poem

A rabbit checks each instance state
And marks the database before it is too late
Raw state guides the deletion trail
Failed lookups stop the sail
Tests hop through every case
The control plane keeps its place

Merge Risk: ⚪ Minimal · up to bb125

This change updates database status handling to reflect instance health and uses the stored state for deletion checks; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the primary change: database state now reflects instance health. It is concise and follows the repository's Conventional Commits format.
Description check ✅ Passed The description accurately covers the database state change, DeleteDatabase behavior, and added tests. It includes the issue reference, but it omits the template's Testing and Checklist sections and d…
Full details: Description check

Explanation

The description accurately covers the database state change, DeleteDatabase behavior, and added tests. It includes the issue reference, but it omits the template's Testing and Checklist sections and does not list test commands.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/PLAT-333/db-status-instance-aware

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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