Skip to content

Implement a runtime capability registry for optional GuildPass SDK features #455

Description

@Lakes41

Difficulty: Advanced
Type: Feature
Recommended labels (if available in this repo): compatibility, type-safety, backend, advanced

Background

GuildPass SDK V2 is intentionally being rebuilt incrementally. Different backend deployments or future contract versions may expose different capabilities.

The SDK needs a safe way to represent and query supported capabilities without scattering string comparisons throughout client code.

This issue introduces a standalone runtime capability registry.

Problem

There is currently no canonical representation for SDK capabilities such as membership.read, access.check, or future Stellar-related functionality.

Free-form strings can produce typos, ambiguous feature detection, and inconsistent compatibility behaviour.

Expected Outcome

Implement a typed capability registry that validates capability identifiers, tracks supported versions, and provides deterministic capability checks.

Suggested Implementation

A capability may resemble:

interface CapabilityDefinition {
  id: string;
  version: string;
}

The registry should:

  • validate capability identifier syntax;
  • reject duplicate capability registrations with conflicting versions;
  • expose hasCapability(id);
  • expose getCapabilityVersion(id);
  • optionally expose version-aware checks such as minimum supported version;
  • preserve deterministic capability ordering when listing entries;
  • support immutable snapshot creation;
  • avoid mutating caller-provided input;
  • provide structured errors for malformed or conflicting definitions;
  • remain independent of remote discovery or API calls.

If semantic version comparison is implemented, it must be self-contained within this issue rather than depending on another campaign contribution.

Acceptance Criteria

  • Valid capability identifiers can be registered.
  • Invalid identifiers are rejected.
  • Duplicate identical definitions behave according to a documented policy.
  • Conflicting duplicate definitions are rejected.
  • Capability lookup is deterministic.
  • Capability listing has stable ordering.
  • Caller input mutation cannot mutate stored registry state.
  • Optional version checks are tested if included.
  • Unit tests cover valid, duplicate, malformed, ordering, and immutability scenarios.
  • pnpm typecheck passes.
  • pnpm build passes.
  • pnpm test passes.
  • No API discovery request or server capability endpoint is implemented.

Likely Affected Files/Directories

src/capabilities/ or equivalent focused module
src/types/
tests/

Independence Requirement

This issue must be independently implementable from the current SDK baseline and must not depend on transport, API, or server changes.

Activity

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

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesThird CampaignOfficial FWC26 campaign issue — eligible for campaign scoring and rewardsadvancedAdvanced difficulty tasks requiring significant domain knowledge and implementation effortbackendBackend services, application logic, persistence integration, and server-side functionalitycompatibilityCompatibility improvements across environments, versions, platforms, or integrationstype-safetyTypeScript type system improvements and strict type enforcement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions