Skip to content

Revert "feat: add notifier delivery runtime"#63

Merged
AgentWrapper merged 1 commit into
mainfrom
revert-58-feat/55
May 31, 2026
Merged

Revert "feat: add notifier delivery runtime"#63
AgentWrapper merged 1 commit into
mainfrom
revert-58-feat/55

Conversation

@AgentWrapper

Copy link
Copy Markdown
Contributor

Reverts #58

@AgentWrapper AgentWrapper merged commit c4bbbf7 into main May 31, 2026
6 checks passed
@greptile-apps

greptile-apps Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR reverts #58 ("feat: add notifier delivery runtime"), removing the full notification dispatch runtime — the delivery scheduler, routing engine, retry policy, desktop delivery wiring, and the associated SQLite schema migration (0003_notification_deliveries.sql). The Enqueuer and its durable enqueue path are preserved.

  • Deletes 15+ files (delivery, dispatcher, routing, retry, settings, store, manager, notifier wiring, integration test) and their generated SQL counterparts, restoring the notification subsystem to enqueue-only mode.
  • Removes NotificationConfig and related types from config.Config, drops RoutedAt from domain.Notification, and removes EventNotificationDeliveryCreated/Updated CDC event constants.
  • The migration file 0003_notification_deliveries.sql is deleted outright rather than rolled back via a new forward migration, which is the chief operational concern for any deployment that already applied that schema version.

Confidence Score: 3/5

Safe to merge only if migration 0003 has never been applied to any live environment; any deployment that ran #58 will have orphaned schema objects and a potential Goose startup failure on next deploy.

The revert is internally consistent — all generated code, domain types, config types, and wiring are updated together. The two concerns that hold back full confidence: (1) deleting the migration file instead of adding a new forward migration means that databases carrying version 3 in goose_db_version cannot cleanly start with this binary, and (2) the error-path shutdown sequence in daemon.go that PR #58 had fixed (cdcPipe.Stop not called before store.Close on httpd.New/startLifecycle failures) is reintroduced. If #58 was never deployed, only concern (2) is active, which is a latent race in an error path. If #58 reached any deployed environment, concern (1) is an operational blocker.

backend/internal/storage/sqlite/migrations/ — the deleted 0003 file is the most operationally sensitive part of this revert; backend/internal/daemon/daemon.go — the error-path shutdown ordering for httpd.New and startLifecycle failures should be revisited.

Important Files Changed

Filename Overview
backend/internal/storage/sqlite/migrations/0003_notification_deliveries.sql Migration file deleted rather than rolled back via a new forward migration; any DB that applied version 3 retains orphaned schema objects and may cause Goose startup failures.
backend/internal/daemon/daemon.go Reintroduces pre-#58 resource management gap: cdcPipe goroutines are not explicitly drained before store.Close fires on httpd.New/startLifecycle error paths.
backend/internal/daemon/notifier_wiring.go Deleted cleanly; all callers in daemon.go were updated to remove the notifierStack reference.
backend/internal/notification/enqueuer.go EnqueueStore interface renamed to Store (no name collision after store.go deletion); logic unchanged and correct.
backend/internal/config/config.go NotificationConfig and all related types cleanly removed; ports import dropped; no dangling references remain.
backend/internal/storage/sqlite/gen/notifications.sql.go routed_at removed from all RETURNING/SELECT column lists; scanner destinations updated to match, so column-count alignment is correct even against a database that still has the column.
backend/internal/storage/sqlite/gen/querier.go Delivery-related queries removed from the Querier interface; consistent with deletion of notification_deliveries.sql.go.
backend/internal/domain/notification.go RoutedAt field removed cleanly from domain.Notification; all readers updated accordingly.
backend/internal/cdc/event.go EventNotificationDeliveryCreated and EventNotificationDeliveryUpdated constants removed; no remaining references in the codebase.
backend/internal/integration/notification_runtime_test.go Integration test for the reverted feature cleanly deleted alongside the feature code.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before["Before Revert (PR #58)"]
        A1[daemon.Run] --> B1[startCDC]
        A1 --> C1[startNotifier\nManager+Dispatcher]
        A1 --> D1[httpd.New]
        A1 --> E1[startLifecycle]
        D1 -- error --> F1[stop + notifier.Stop\n+ cdcPipe.Stop]
        E1 -- error --> F1
        C1 --> G1[RoutePending\nrouted_at tracking]
        G1 --> H1[notification_deliveries\ntable]
        H1 --> I1[Electron / AO-app\ndesktop toast claim]
    end

    subgraph After["After Revert (this PR)"]
        A2[daemon.Run] --> B2[startCDC]
        A2 --> D2[httpd.New]
        A2 --> E2[startLifecycle]
        D2 -- error --> F2[return err\ncdcPipe NOT stopped]
        E2 -- error --> F2
        A2 --> G2[Enqueuer only\nenqueue to notifications table]
    end

    subgraph Schema["DB Schema risk"]
        S1[0003 migration applied\nin existing DB] --> S2[routed_at column\norphaned]
        S1 --> S3[notification_deliveries\norphaned tables]
        S1 --> S4[Goose v3.27.1\napplied-but-missing\nmigration risk]
    end
Loading

Comments Outside Diff (1)

  1. backend/internal/storage/sqlite/migrations/0003_notification_deliveries.sql

    P1 Migration deleted without a forward rollback migration

    The embedded filesystem is built at compile time from migrations/*.sql. After this revert, any environment that has already applied migration 0003 will have its goose_db_version record version 3, but the compiled binary will only embed versions 1 and 2. Goose v3.27.1 (in use here) considers a migration that is applied in the DB but not found in the source to be a "missing" migration; depending on the exact code path taken in goose.Up, this can surface as a startup error, leaving the daemon unable to open the store on any database that saw deployment of feat: add notifier delivery runtime #58. Beyond the Goose concern, the routed_at column, notification_deliveries, notification_delivery_attempts tables, and their CDC triggers remain in those schemas with no automated cleanup path.

    The safe migration practice is to add a new forward migration (e.g., 0004_revert_notification_deliveries.sql) that executes the -- +goose Down steps explicitly, rather than deleting the original file.

Reviews (1): Last reviewed commit: "Revert "feat: add notifier delivery runt..." | Re-trigger Greptile

Comment on lines 72 to 83
@@ -86,11 +79,6 @@ func Run() error {
// trigger -> change_log -> poller -> broadcaster.
lcStack, err := startLifecycle(ctx, store, log)
if err != nil {
stop()
notifier.Stop()
if cdcErr := cdcPipe.Stop(); cdcErr != nil {
log.Error("cdc pipeline shutdown", "err", cdcErr)
}
return err
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 cdcPipe not drained before store.Close on early-return error paths

PR #58 had added stop() + cdcPipe.Stop() to both the httpd.New() and startLifecycle() error paths. The revert removes those calls, restoring the pre-#58 state where, if either call fails, return err fires and the deferred sequence runs as: termMgr.Close()stop()store.Close(). Cancelling the context causes the CDC poller goroutines to start winding down, but store.Close() fires immediately after stop() with no drain wait. Any CDC goroutine that is mid-query at that instant will attempt to use a closed DB. The fix that was added in #58 — calling stop() and cdcPipe.Stop() before returning — was correct independently of the notifier, and should be retained (without notifier.Stop()) to preserve the safe shutdown ordering.

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