refactor: remove hedging tag, use mongodb directly for heartbeats#893
Conversation
Now that the migration is complete, remove the 'hedging' case from the HEARTBEAT_DB_BACKEND switch. Only 'mongodb' is supported going forward. - Update DI container to only recognize 'mongodb' case - Update integration test .env.test to use HEARTBEAT_DB_BACKEND=mongodb Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
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.
Greptile SummaryThis PR completes the MongoDB migration for heartbeat data by removing the
Confidence Score: 3/5Safe to merge only if the production env var is updated atomically with the deploy; deploying ahead of the env var change will silently route heartbeat traffic to the old GORM backend. Both repository factory methods now fall through to the GORM backend for any value that isn't exactly "mongodb", including the "hedging" string that production currently holds. There is no log warning, panic, or error when an unrecognised value hits the default branch, so a deployment-before-env-var-update scenario fails invisibly. api/pkg/di/container.go — the default branches in both heartbeat repository constructors need a guard for unrecognised configuration values. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Container.HeartbeatRepository / HeartbeatMonitorRepository] --> B{HEARTBEAT_DB_BACKEND env var}
B -- "mongodb" --> C[NewMongoHeartbeatRepository\nNewMongoHeartbeatMonitorRepository]
B -- "hedging" (old value)\nor anything else --> D[default: NewGormHeartbeatRepository\nNewGormHeartbeatMonitorRepository]
D --> E[⚠️ Silent fallback to GORM\nif env var not updated before deploy]
C --> F[✅ MongoDB backend]
|
Summary
Now that the migration is deployed and stable, remove the hedging case from the HEARTBEAT_DB_BACKEND switch. Only mongodb is recognized going forward.
Changes
Deployment
Update the production environment variable from HEARTBEAT_DB_BACKEND=hedging to HEARTBEAT_DB_BACKEND=mongodb after merging.