Skip to content

pm-stack: #1744 alerts P1 schema contract (agg_alerts_incidents / agg_alerts_incident_events / agg_alerts_notification_sends) - #16983

Merged
developing-today-fleet[bot] merged 7 commits into
mainfrom
archer/1522f-1744-agg-alerts
Nov 29, 2026
Merged

developing-today-fleet[bot] merged 7 commits into
mainfrom
archer/1522f-1744-agg-alerts

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

#1744 Move 1 step 2, fourth store group: P1 schema contract for the alerts stores — alerts.incidents / alerts.incident_events / alerts.notification_sends (aggregator/src/alerts.ts) → public.agg_alerts_incidents + public.agg_alerts_incident_events + public.agg_alerts_notification_sends. Same established pattern as #16975 (roadmap annotations) and #16978 (views). Schema-only: no writer/reader cutover, no rows copied, criterion 3 untouched.

Contract points, mirroring alerts.ts and the store's own SQL:

  • Incidents: severity/status enums, occurrences >= 1, lifecycle timestamps nullable, and the intake dedupe invariant as a partial unique index — at most one non-closed incident per (source, incident_key), exactly the ON CONFLICT target openIncident names; a closed incident does not block a reopened key.
  • Incident events: the seven lifecycle kinds, detail as a jsonb object-or-null, FK to incidents with ON DELETE RESTRICT.
  • Notification sends: append-only ledger shape (class / object_ref / outcome non-empty, incident FK nullable), acted_on_at as the only update target — grants follow: incidents SELECT/INSERT/UPDATE (never DELETE), events SELECT/INSERT, sends SELECT/INSERT/UPDATE.
  • The push-subscription registry is deliberately excluded: it holds Web Push key material (p256dh/auth) that never belongs in the shared schema.
  • Paired down migration refuses to drop any non-empty table; drops in reverse dependency order.

Verification:

  • Golden generated with the repo translator (turso_migrations.py) and pinned under golden/.
  • Full test_turso_migrations.py suite run locally against the assembled schema dir: 41 tests OK, including the golden-translation test and four new ConstraintTests (severity/status, open-key uniqueness until closed, event kinds + FK, send shape + FK).
  • A disposable-SQLite probe of the translated DDL exercised valid/invalid rows for every new check before pushing (all accepted/refused as contracted).
  • test-migration.sh extended with the PostgreSQL-side assertions (RLS/grants probe, five rejection cases, down-refusal, clean rollback); it runs in the repo's disposable-Postgres harness.
  • Full diff read against the PM stack #1744: define schema contract for the first shared action/event store #6103/shared_comments pattern before merge.

Refs #1744 (P1 remains open for the projector pmp_* groups/location decision; Move 1 execution slices and criterion 3 follow separately).

Lane 1522-F (Archer, delta PRESS run 2026-11-29). Claim: #1744 (comment)

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-29T21:36:10Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": null,
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": null,
    "auth_subject": "archer",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 22d9728e-2c45-43c7-a75d-f9f640d98ffc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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.

0 participants