Skip to content

fix(notifications): drop the legacy context union and the rollback lever - #404

Merged
pavlo-flamingo merged 3 commits into
mainfrom
fix/notifications-drop-legacy-context
Sep 14, 2026
Merged

pavlo-flamingo merged 3 commits into
mainfrom
fix/notifications-drop-legacy-context

Conversation

@pavlo-flamingo

@pavlo-flamingo pavlo-flamingo commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Problem

A live NATS push without a context key made the store updater call node.setLinkedRecord(null, 'context'). Relay's RecordProxy rejects a null link, the throwing updater stayed queued, and every later store commit failed until a reload: "Failed to mark as read", the presence error every 10 s. It never fired before because the backend dual-wrote the context on every push.

Fix

The backend has retired the typed context union in favour of the flat type + attributes pair, so the frontend stops reading it everywhere.

  • notificationFields_notification no longer selects context; the live NATS path writes only type and attributes and links nothing.
  • mapNotificationNode reads one contract. meta.notificationType replaces meta.contextType; the notifications-legacy-path lever is removed from feature-flags.ts.
  • Routing drops CONTEXT_TYPENAME_BY_TYPE and the context fallback on the NATS envelope. Approval types come from the core lib (isApprovalNotificationType, fix(notifications): gate the approval tile on meta.notificationType openframe-oss-lib#2182), bumped to 0.0.632.
  • schema.graphql is re-fetched from tst-notifications via npm run fetch-schema. Notification.context, NotificationContext and its implementations, ApprovalToolCall and the ApprovalType/ApprovalResolution enums are gone on the backend; the software schedule types and the paginated package search come along with the refresh. Nothing in src/ references what was removed.

Rows without type/attributes (not yet swept by the backfill) still map to a plain tile, as they did with the lever off.

Companion PRs (every other consumer of the retired context)

Caveats

  • Backend notifications.legacy-path must not be flipped on after this ships: the frontend has no legacy reader any more, so context-only pushes would render as plain tiles.
  • The backend has already dropped context from its schema, so any bundle still selecting it fails the notifications query there. Native shells carry the bundle in the binary; this needs to reach them.

Verification

  • npm run type-check, npm run lint:ci, npm run format clean; npm run relay compiles every document against the fetched schema.
  • Vitest: 185/185 (contract and navigation suites rewritten for the single contract, plus "a legacy context on the NATS envelope is ignored").
  • Backend contract checked against origin/main: attribute key names, spec approval types, NATS payload fields and FCM data keys match what the frontend reads.
  • Not reproduced live: a NATS push without context against a running backend still needs a manual check (no "Failed to mark as read" / presence errors in the console).

A live NATS push without a `context` key made the store updater call
`node.setLinkedRecord(null, 'context')`. Relay's RecordProxy rejects a null
link, the throwing updater stayed queued, and every later store commit failed
until a reload: "Failed to mark as read", the presence error every 10 s. It
never fired before because the backend dual-wrote the context on every push.

The typed `context` union is retired on the backend in favour of the flat
`type` + `attributes` pair, so the frontend stops reading it everywhere:

- the row fragment no longer selects `context`; the live path writes only
  `type` and `attributes` and links nothing;
- `mapNotificationNode` reads one contract, `meta.notificationType` replaces
  `meta.contextType`, and the `notifications-legacy-path` lever is gone;
- routing drops `CONTEXT_TYPENAME_BY_TYPE` and the `context` fallback on the
  NATS envelope; the approval types come from the core lib
  (`isApprovalNotificationType`, bumped to 0.0.632);
- `schema.graphql` drops `Notification.context`, `NotificationContext`, its
  twelve implementations and `ApprovalToolCall`.

Rows without `type`/`attributes` still map to a plain tile, as before.
@pavlo-flamingo
pavlo-flamingo requested review from a team as code owners September 14, 2026 16:33
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

🦩 Flamingo Code Review

No findings on the current head.

Mode: advisory


Need another pass? Commits pushed after this review are not reviewed automatically.

  • Review the new commits — the commits added since this review
  • Review the whole diff again — ignoring what was already reviewed

Prefer typing? Comment @flamingo-review, or @flamingo-review full. To review every push on this pull request, add the flamingo-review-always label.

React 👍/👎 on inline comments to teach the reviewer.

Started 2026-09-14 16:33 UTC · updated 2026-09-14 16:33 UTC · workflow run

Replaces the hand-pruned SDL with the backend's own: `Notification.context`,
`NotificationContext` and its implementations, `ApprovalToolCall` and the
`ApprovalType`/`ApprovalResolution` enums are gone there too. The software
schedule types and the paginated package search come along with the refresh;
nothing in `src/` references what was removed, and every Relay document
compiles against it.
@pavlo-flamingo
pavlo-flamingo merged commit 1fe258e into main Sep 14, 2026
8 of 9 checks passed
@pavlo-flamingo
pavlo-flamingo deleted the fix/notifications-drop-legacy-context branch September 14, 2026 18:40
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.

2 participants