Skip to content

Identity: add subscription events and subscribe-mode for subscription getters#1069

Open
victorhahncastell wants to merge 1 commit into
mainfrom
codex/update-tests-and-implement-subscription-getters
Open

Identity: add subscription events and subscribe-mode for subscription getters#1069
victorhahncastell wants to merge 1 commit into
mainfrom
codex/update-tests-and-implement-subscription-getters

Conversation

@victorhahncastell

Copy link
Copy Markdown
Collaborator

Motivation

  • New subscriptionAdded / subscriptionRemoved events were introduced on Identity and the subscription-related APIs needed to surface the same "subscribe"/continuous behavior already provided for getPosts().
  • Tests needed to be updated to assert the new event semantics and to cover subscribe-mode behavior for subscription getters.

Description

  • Emit subscriptionAdded when a new public subscription is actually added and emit subscriptionRemoved only when a subscription is actually deleted (guarded to avoid spurious events); adjusted removePublicSubscription accordingly.
  • Added GetPublicSubscriptionsOptions and GetPublicSubscriptionsGenerator types to identity.definitions.ts to mirror getPosts() subscribe-mode semantics (including existingYielded).
  • Implemented a shared helper getPublicSubscriptions() in Identity that reuses resolveAndYield, eventsToGenerator and mergeAsyncGenerators to combine existing subscription retrieval with live subscriptionAdded event streaming, and exposed it via getPublicSubscriptionCubeInfos() and getPublicSubscriptionIdentities() with an optional subscribe flag.
  • Expanded unit tests to cover the new event emissions and subscribe-mode for subscription getters in test/cci/identity/identity.base.test.ts and test/cci/identity/identity.cubeInfoGenerators.test.ts (cases for initial data, newly arriving subscriptions, and initially-empty subscribe-mode generators).

Testing

  • Ran type checking with npm run typecheck and it passed.
  • Ran focused tests with npx vitest run test/cci/identity/identity.base.test.ts and npx vitest run test/cci/identity/identity.cubeInfoGenerators.test.ts, both passed (subscribe-mode and event tests exercised).
  • Ran the full identity test suite with npx vitest run test/cci/identity and all identity tests passed; no regressions observed.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant