Skip to content

docs(jsdoc): Phase 4 — Annotate Actors runtime classes #795

@WhitWaldo

Description

@WhitWaldo

Summary

Add comprehensive JSDoc annotations to the Actor runtime subsystem. This includes the base actor class users extend, the runtime that manages actor lifecycle, and all supporting classes for state, timers, and reminders.

Scope

Files (src/actors/runtime/)

File Purpose
AbstractActor.ts Base class all user-defined actors extend
ActorRuntime.ts Singleton managing actor registration, activation, deactivation
ActorManager.ts Per-type actor instance management
ActorStateManager.ts Actor state read/write/remove with transactional batching
StateManager.ts Lower-level state management
StateProvider.ts State persistence provider interface
ActorReminderData.ts Reminder data model
ActorTimerData.ts Timer data model
ActorCallType.ts Enum of actor call types (method, reminder, timer)
ActorMethodContext.ts Context passed to actor method invocations
ActorStateChange.ts Represents a pending state mutation
StateChangeKind.ts Enum: add, update, remove
StateMetadata.ts Metadata attached to state entries
BufferSerializer.ts Serialization for actor state

Actor client (src/actors/client/)

  • ActorProxyBuilder.ts — Builds typed actor proxies for remote invocation
  • ActorClient.ts (if present)

Actor ID (src/actors/)

  • ActorId.ts — Actor identity value object

Requirements

  • AbstractActor: Document the lifecycle hooks (onActivate, onDeactivate), getStateManager(), and how users should extend this class
  • ActorRuntime: Document the singleton pattern, registerActor(), configuration options
  • ActorManager: Document actor instance lifecycle (creation, activation, reentrancy, deactivation, GC)
  • ActorStateManager: Document get, set, remove, contains, save and transactional semantics
  • ActorProxyBuilder: Document how to create typed proxies and the relationship between the proxy and the remote actor
  • All enums: Document each value's meaning
  • ActorId: Document creation (random vs. explicit), serialization, equality

Example

/**
 * Base class for all Dapr actor implementations.
 *
 * Extend this class and implement your actor's methods. The runtime will
 * manage the lifecycle (activation/deactivation) and provide access to
 * durable state, timers, and reminders.
 *
 * @example
 * ```ts
 * class MyActor extends AbstractActor {
 *   async sayHello(name: string): Promise<string> {
 *     const count = await this.getStateManager().getState<number>("count") ?? 0;
 *     await this.getStateManager().setState("count", count + 1);
 *     await this.getStateManager().saveState();
 *     return `Hello ${name}! (call #${count + 1})`;
 *   }
 * }
 * ```
 */

Acceptance Criteria

  • [ ]All actor runtime classes have class-level and method-level JSDoc
  • Lifecycle hooks clearly documented with when/why they're called
  • State manager transactional semantics explained
  • No logic changes — documentation only
  • Builds cleanly (npm run build)

Metadata

Metadata

Assignees

Labels

area/clientGeneral client-related issues not-specific to another building blockdocumentationImprovements or additions to documentationsdk-parity

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions