Skip to content

Fix/618 collapse kv layer - #703

Merged
Calebux merged 2 commits into
zintarh:mainfrom
AnnieIj:fix/618-collapse-kv-layer
Oct 1, 2026
Merged

Calebux merged 2 commits into
zintarh:mainfrom
AnnieIj:fix/618-collapse-kv-layer

Conversation

@AnnieIj

@AnnieIj AnnieIj commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Description

This PR refactors the notification KV integration to establish a clear storage boundary, remove the redundant KV re-export, and make storage failure behaviour predictable across notification routes.

Changes Made

  • Removed the redundant storage-client re-export from app/api/notifications/_lib/kv.ts.
  • Kept notification-specific key builders within the notifications module while importing the shared KV client directly.
  • Standardized error handling across kvGet, kvSet, kvKeys, and kvSRem.
  • Defined caller-specific failure behaviour: notification dispatch fails explicitly when KV is unavailable, while preferences reads can degrade gracefully.
  • Centralized documentation for the notification key namespace, including SUB_KEY, PERIOD_KEY, and LOG_KEY.

Expected Outcome

The application has one clearly defined KV storage module, one documented notification key namespace, and predictable failure handling for each notification operation.

Closes #618

…pace, define failure modes

Resolves the obscured storage boundary described in zintarh#618.

- app/api/notifications/_lib/kv.ts: now imports storage helpers directly from ../../_lib/kv (no re-export chain). Adds full JSDoc for the notif:sub:, notif:period:, and notif:log: key families. Adds KV_FAILURE_LOUD / KV_FAILURE_DEGRADE constants and KvFailureMode type.

- All six notification routes annotated with // KV_FAILURE: LOUD or DEGRADE at the import site. dispatch/subscribe/subscribe-email/confirm-email use ../_lib/kv; preferences/{wallet} and data/{wallet} use ../../_lib/kv (both resolve to the notifications _lib).

- app/api/notifications/__tests__/kv.test.ts: 39 tests covering key builders, namespace isolation, failure-mode constants, storage helper re-exports, and LOUD vs DEGRADE caller behaviour (all green).

Closes zintarh#618
@vercel

vercel Bot commented Sep 27, 2026

Copy link
Copy Markdown

@zintarh is attempting to deploy a commit to the zintarh Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Sep 27, 2026

Copy link
Copy Markdown

@AnnieIj Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Calebux
Calebux merged commit aa462f8 into zintarh:main Oct 1, 2026
3 of 14 checks passed
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.

fix(notifications): _lib/kv.ts re-exports a parent module and adds keys, obscuring the storage boundary

3 participants