refactor: auto incidents #45

Merged
tygrdev merged 3 commits from auto-incid-rework into main 2025-05-28 04:09:05 +02:00
Owner
Closes https://github.com/nord-studio/miru/issues/40
netlify[bot] commented 2025-05-28 03:55:45 +02:00 (Migrated from github.com)

Deploy Preview for miru-docs ready!

Name Link
Latest commit 5dc2e8d375
Latest deploy log https://app.netlify.com/projects/miru-docs/deploys/68366fdd820ae20008aafaff
Deploy Preview https://deploy-preview-45--miru-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

### <span aria-hidden="true">✅</span> Deploy Preview for *miru-docs* ready! | Name | Link | |:-:|------------------------| |<span aria-hidden="true">🔨</span> Latest commit | 5dc2e8d3755a3c06e9cbcbb6e5a15894826fa081 | |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/miru-docs/deploys/68366fdd820ae20008aafaff | |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-45--miru-docs.netlify.app](https://deploy-preview-45--miru-docs.netlify.app) | |<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTQ1LS1taXJ1LWRvY3MubmV0bGlmeS5hcHAifQ.KFQYQJsc0iOl4-FJV0BTUa9PURrz-cnv0fQUp93tVFw)<br /><br />_Use your smartphone camera to open QR code link._</details> | --- <!-- [miru-docs Preview](https://deploy-preview-45--miru-docs.netlify.app) --> _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/miru-docs/configuration/notifications#deploy-notifications)._
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-05-28 03:58:02 +02:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

Introduces a configurable “graceful pings” threshold for auto-resolving incidents, updates the database schema and migrations to track ping success, and wires the new setting through the UI and monitoring service.

  • Add ping_threshold setting to config and UI (grace_pings)
  • Extend tracked_incidents schema/migrations with success, monitoring_created, investigating_created
  • Update Rust monitor logic to use a full threshold of pings before opening/resolving incidents

Reviewed Changes

Copilot reviewed 12 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
config.toml Disable email and add ping_threshold default
apps/web/types/config.ts Add grace_pings config type
apps/web/lib/db/schema/incidents.ts Add success, monitoring_created and investigating_created columns
apps/web/lib/db/migrations/meta/_journal.json Register new migrations 0026 and 0027
apps/web/lib/db/migrations/0026_curious_shadow_king.sql Add success column migration
apps/web/lib/db/migrations/0027_nostalgic_sunspot.sql Add monitoring_created and investigating_created columns
apps/web/app/config/form.tsx Add form fields/UI for “Graceful Pings” setting
apps/monitor/src/lib.rs Add pings_threshold to config struct and defaults
apps/monitor/src/cron/health.rs Use full ping threshold and success count logic
apps/monitor/package.json Adjust dev script log level to info
Files not reviewed (3)
  • .sqlx/query-5fc9dfef2e1d244b48a53be7f181603dabc718aba3f27e5b2fa5c86a50bfab53.json: Language not supported
  • .sqlx/query-6d4273454ce6dbe93047bc220593e09da7b7c6becd581f9c2aab0e20102d8c48.json: Language not supported
  • .sqlx/query-c31d5dc273f96cd77e2ad5d6921fb06cbb2d33a84bb74109f31710aebdebc026.json: Language not supported
## Pull Request Overview Introduces a configurable “graceful pings” threshold for auto-resolving incidents, updates the database schema and migrations to track ping success, and wires the new setting through the UI and monitoring service. - Add `ping_threshold` setting to config and UI (`grace_pings`) - Extend `tracked_incidents` schema/migrations with `success`, `monitoring_created`, `investigating_created` - Update Rust monitor logic to use a full threshold of pings before opening/resolving incidents ### Reviewed Changes Copilot reviewed 12 out of 15 changed files in this pull request and generated 4 comments. <details> <summary>Show a summary per file</summary> | File | Description | |-------------------------------------------------|---------------------------------------------------| | config.toml | Disable email and add `ping_threshold` default | | apps/web/types/config.ts | Add `grace_pings` config type | | apps/web/lib/db/schema/incidents.ts | Add `success`, `monitoring_created` and `investigating_created` columns | | apps/web/lib/db/migrations/meta/_journal.json | Register new migrations 0026 and 0027 | | apps/web/lib/db/migrations/0026_curious_shadow_king.sql | Add `success` column migration | | apps/web/lib/db/migrations/0027_nostalgic_sunspot.sql | Add `monitoring_created` and `investigating_created` columns | | apps/web/app/config/form.tsx | Add form fields/UI for “Graceful Pings” setting | | apps/monitor/src/lib.rs | Add `pings_threshold` to config struct and defaults | | apps/monitor/src/cron/health.rs | Use full ping threshold and success count logic | | apps/monitor/package.json | Adjust dev script log level to `info` | </details> <details> <summary>Files not reviewed (3)</summary> * **.sqlx/query-5fc9dfef2e1d244b48a53be7f181603dabc718aba3f27e5b2fa5c86a50bfab53.json**: Language not supported * **.sqlx/query-6d4273454ce6dbe93047bc220593e09da7b7c6becd581f9c2aab0e20102d8c48.json**: Language not supported * **.sqlx/query-c31d5dc273f96cd77e2ad5d6921fb06cbb2d33a84bb74109f31710aebdebc026.json**: Language not supported </details>
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-05-28 03:58:02 +02:00

[nitpick] Grammar: change "We looking into this now." to "We’re looking into this now." or "We are looking into this now." for clarity.

                    format!("{} is failing to ping again. We’re looking into this now.", monitor.name.to_string()),
[nitpick] Grammar: change "We looking into this now." to "We’re looking into this now." or "We are looking into this now." for clarity. ```suggestion format!("{} is failing to ping again. We’re looking into this now.", monitor.name.to_string()), ```
@ -32,6 +32,7 @@ pub struct MiruConfigIncident {
#[derive(Deserialize, Default)]
pub struct MiruConfigIncidentAuto {
pub enabled: bool,
pub pings_threshold: u64,
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-05-28 03:58:01 +02:00

This field name (pings_threshold) should match the config key in your TOML and the UI naming (grace_pings/ping_threshold) to ensure the threshold is actually deserialized.

    pub ping_threshold: u64,
This field name (`pings_threshold`) should match the config key in your TOML and the UI naming (`grace_pings`/`ping_threshold`) to ensure the threshold is actually deserialized. ```suggestion pub ping_threshold: u64, ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-05-28 03:58:01 +02:00

The property grace_pings does not match the key in config.toml (ping_threshold). Align the naming or add a mapping layer so the UI value is correctly loaded from the TOML.

			ping_threshold: number;
The property `grace_pings` does not match the key in config.toml (`ping_threshold`). Align the naming or add a mapping layer so the UI value is correctly loaded from the TOML. ```suggestion ping_threshold: number; ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-05-28 03:58:01 +02:00

The key ping_threshold in config.toml doesn’t match the Rust struct field pings_threshold (and the TS field grace_pings). Rename it to pings_threshold or update the code to use ping_threshold so the setting is read correctly.

pings_threshold = 3
The key `ping_threshold` in config.toml doesn’t match the Rust struct field `pings_threshold` (and the TS field `grace_pings`). Rename it to `pings_threshold` or update the code to use `ping_threshold` so the setting is read correctly. ```suggestion pings_threshold = 3 ```
Sign in to join this conversation.
No description provided.