Skip to content

Add push subscription listing for authenticated users - #649

Merged
thomasluizon merged 2 commits into
redesign/mainfrom
feature/ticket-915-push-devices
Sep 29, 2026
Merged

thomasluizon merged 2 commits into
redesign/mainfrom
feature/ticket-915-push-devices

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

Change

Add GET api/notifications/subscriptions for the authenticated user. The response contains a newest first items list with id, transport, createdAtUtc, and a lowercase SHA-256 endpointHash, plus max from the existing subscription cap. It does not expose endpoints or keys.

The route in src/Orbit.Api/Controllers/NotificationController.cs dispatches the query in src/Orbit.Application/Notifications/Queries/GetPushSubscriptionsQuery.cs. Its validator lives in src/Orbit.Application/Notifications/Validators/GetPushSubscriptionsQueryValidator.cs. The existing repository filters by user before mapping to a response DTO. src/Orbit.Api/openapi.json was regenerated by the build. The action is registered in the notification read capability and app surface in src/Orbit.Infrastructure/Services/AgentCatalogService.Capabilities.cs and src/Orbit.Infrastructure/Services/AgentCatalogService.Surfaces.cs.

Tests in tests/Orbit.Application.Tests/Queries/Notifications/GetPushSubscriptionsQueryHandlerTests.cs cover 0, 1, and 5 subscriptions, isolation from another user, sorting, hash output, transport mapping, and serialized field safety. tests/Orbit.Infrastructure.Tests/Controllers/NotificationControllerTests.cs checks dispatch with the authenticated user ID.

Closes thomasluizon/orbit-tickets#915.

Assumptions

  • Used items for the list, matching the existing notifications response, instead of a subscriptions property.
  • Mapped FCM to native and Web Push to web, instead of exposing internal enum names.
  • Hashed the exact stored endpoint UTF-8 bytes, instead of normalizing the endpoint before hashing.

Test evidence

  • dotnet test tests/Orbit.Application.Tests --filter FullyQualifiedName~GetPushSubscriptionsQueryHandlerTests: 4 passed.
  • dotnet test tests/Orbit.Infrastructure.Tests --filter FullyQualifiedName~NotificationControllerTests: 18 passed.
  • Initial env -u LANG LC_ALL=en_US.UTF-8 dotnet test: the existing AgentCatalogServiceTests.EveryControllerAction_IsMappedToTheCatalog failed for NotificationController.GetSubscriptions; the catalog mapping was added and its focused rerun passed.
  • Final env -u LANG LC_ALL=en_US.UTF-8 dotnet build Orbit.slnx -v:q: 0 errors.
  • Final env -u LANG LC_ALL=en_US.UTF-8 dotnet test -v:q: 8,065 passed, 0 failed.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes in the authenticated subscription listing, its generated API schema, catalog mapping, and unit tests:

  • Subscription query: Filters by user, sorts newest first, and returns transport, timestamp, ID, and endpoint hash without exposing push credentials.
  • HTTP and catalog: Adds the authorized GET route and registers it on the notification surface.
  • Coverage: Exercises user isolation, response fields, transport mapping, ordering, and authenticated dispatch.

Pullfrog  | View workflow run | Using GPT Sol | 𝕏

@thomasluizon
thomasluizon merged commit 106de86 into redesign/main Sep 29, 2026
22 checks passed
@thomasluizon
thomasluizon deleted the feature/ticket-915-push-devices branch September 29, 2026 02:55
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