Skip to content

feat: channel metadata, notification versioning, validation, and archive#530

Open
success-OG wants to merge 1 commit into
Core-Foundry:mainfrom
success-OG:features
Open

feat: channel metadata, notification versioning, validation, and archive#530
success-OG wants to merge 1 commit into
Core-Foundry:mainfrom
success-OG:features

Conversation

@success-OG

Copy link
Copy Markdown

Summary

Implements four Notify-Chain improvements spanning the Soroban contract and listener:

  1. Channel metadata updates — Authorized channel creators can update description/custom fields without recreating the channel or touching subscribers.
  2. Notification versioning — Every notification payload carries a protocol version field (current: 1), documented on-chain and off-chain.
  3. Metadata validation — Required fields and format rules are enforced before storage; invalid metadata is rejected.
  4. Archive processed notifications — Processed notifications are moved out of active storage into an immutable archive (on-chain + listener), remaining queryable with no data loss.

Task 1 — Channel Metadata Updates

  • Added ChannelMetadata storage keyed by AutoShare/channel id (separate from membership/usage state).
  • New contract entrypoints: update_channel_metadata, get_channel_metadata.
  • Restricted to the channel creator; rejects unauthorized callers.
  • Emits ChannelMetadataUpdated.
  • Members, usage counts, and active status remain unchanged after updates.
  • Tests: channel_metadata_test.rs

Task 2 — Notification Versioning

  • Added CURRENT_NOTIFICATION_VERSION = 1 (documented in types.rs and NOTIFICATION_PAYLOAD_SCHEMA.md).
  • ScheduledNotification.version stamped on schedule/batch schedule.
  • Contract: get_notification_version().
  • Listener: ensureNotificationVersion() stamps/rejects versions in NotificationAPI.
  • Tests: notification_version_test.rs, notification-version.test.ts

Task 3 — Metadata Validation

  • Expanded on-chain validate_metadata (title required, length limits, custom field caps, size limit).
  • Wired into schedule_notification / batch creation.
  • Listener: validateNotificationMetadata() enforces required source when metadata is present; nested objects rejected.
  • Tests: metadata_validation_test.rs, unit tests in metadata_validation.rs, metadata-validator.test.ts

Task 4 — Archive Processed Notifications

  • On-chain: expired / cancelled / delivered notifications are moved to ArchivedNotification storage and emit NotificationArchived; query via get_archived_notification.
  • Listener: background ArchiveService retained; added archiveProcessedById() for immediate archival of terminal-state rows.
  • Archive remains readable via existing /api/archive endpoints.
  • Tests: archive_notification_test.rs, archive service unit tests

Test plan

  • cargo test -p hello-world --lib -- channel_metadata notification_version archive_notification metadata_validation
  • Listener: jest --testPathPattern="metadata-validator|notification-version|archive.test"
  • Manual: create AutoShare channel → update_channel_metadata as creator → confirm members unchanged
  • Manual: schedule notification → confirm version: 1 in payload; reject metadata without source
  • Manual: deliver/expire/cancel → confirm active storage cleared and archive queryable

Notes

  • Branch name: features
  • Some preexisting broken contract test modules remain excluded from the test harness so the new suites can compile; they are not part of this feature work.

closes #473
closes #475
closes #476
closes #484

@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@success-OG 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

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.

Archive Processed Notifications Implement Channel Metadata Updates Add Notification Versioning Add Metadata Validation

1 participant