fix(status-page): adopt existing environment monitors - #939
Merged
Conversation
📓 Changelog previewThis is what your commits will add to the generated ## [Unreleased]
### Fixed
- **status-page:** Adopt existing environment monitors
- **migrations:** Preserve newer monitor paths on rollback
- **migrations:** Distinguish monitor path changes
- **status-page:** Track monitor path revisions |
Greptile SummaryThe PR adopts existing reserved-name environment monitors, reconciles duplicate history, and adds revision-based health-path ownership so rollback can distinguish deployment writes from migration state.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| crates/temps-migrations/src/migration/m20260908_000001_reconcile_legacy_status_monitors.rs | Reconciles reserved-name monitor duplicates and implements reversible, revision-aware rollback without a remaining issue from the prior threads. |
| crates/temps-status-page/src/services/monitor_service.rs | Adopts existing reserved monitors, validates ownership, handles concurrent reconciliation, and atomically revisions managed path writes. |
| crates/temps-entities/src/status_monitors.rs | Adds the non-null check-path revision field required by the migration and service update logic. |
| crates/temps-migrations/tests/migration_tests.rs | Covers duplicate-history reconciliation and rollback/reapply behavior for unrelated edits, changed paths, equal-valued writes, and explicit clears. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Legacy reserved-name monitors] --> B[Select oldest monitor as canonical]
B --> C[Mark canonical managed]
C --> D[Move duplicate checks and incidents]
D --> E[Delete reserved duplicates]
E --> F[Deployment writes health path and increments revision]
F --> G{Migration rollback?}
G -- No later path write --> H[Restore original canonical path]
G -- Revision changed --> I[Preserve later path via duplicate handoff]
H --> J[Restore duplicate rows and references]
I --> J
Reviews (5): Last reviewed commit: "fix(status-page): track monitor path rev..." | Re-trigger Greptile
Signed-off-by: David Viejo <dviejo@kfs.es>
Signed-off-by: David Viejo <dviejo@kfs.es>
Signed-off-by: David Viejo <dviejo@kfs.es>
Signed-off-by: David Viejo <dviejo@kfs.es>
dviejokfs
force-pushed
the
fix/adopt-legacy-status-monitors
branch
from
September 8, 2026 12:47
fc24135 to
97bc70b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause
The is_managed rollout changed environment reconciliation from “reuse the existing environment monitor” to “reuse only an is_managed monitor.” Legacy rows remained unmanaged, so every restart created another reserved-name monitor. Deployment health-path updates then targeted only the replacement row, splitting configuration and uptime history.
The exact {environment} Monitor name is the reserved environment-monitor slot. is_managed now identifies which existing row receives automatic lifecycle and .temps.yaml updates; it is no longer used as a reason to create a duplicate.
Evidence
Runtime service: existing reserved-name monitor is adopted, keeps its ID, receives the deployment/YAML path, and no duplicate is inserted.
cargo test --lib -p temps-status-page ensure_monitor_for_environment_adopts_an_existing_default_name -- --nocapturePath-write tracking: changed, equal-valued, and cleared deployment paths each advance the managed monitor revision atomically; custom monitors remain unchanged.
cargo test --lib -p temps-status-page deployment_health_path_only_updates_and_clears_the_managed_monitor -- --nocaptureMigration: real TimescaleDB apply merges reserved-name monitor history, down restores every original row/reference, the prior migration rolls down without stale ownership replay, and both migrations reapply.
cargo test -p temps-migrations --test migration_tests test_legacy_monitor_reconciliation_merges_duplicates_and_preserves_history -- --nocaptureComplete verification:
Review gates