Skip to content

[Feature] ActorPath as branded type (not just a string) #278

Description

@pathosDev

Size / Priority

  • Size: S (~100 lines)
  • Category: C.3 Type-Safety.
  • Risk: medium — heavily-used type.

Affected files

  • src/ActorPath.ts.
  • All sites that construct or compare ActorPath.

Background

ActorPath.toString() returns a string. Many sites pass it around as string — losing the type distinction.

Branded ActorPath-string would let TypeScript catch:

  • Passing arbitrary string where ActorPath expected.
  • Constructing ActorPath from arbitrary string without going through validation.
declare const ACTOR_PATH_BRAND: unique symbol;
export type ActorPathString = string & { readonly [ACTOR_PATH_BRAND]: true };

// Smart constructor on ActorPath:
toString(): ActorPathString {
  return this._cached as ActorPathString;
}

// Parser:
parseActorPath(s: string): ActorPathString {
  // validate + cast
}

Coordination

Integration / risk

  • Public API change.
  • Migration: per-site cast or parse.

Test plan

  1. Regression: ActorPath tests pass.
  2. Type discipline: bare string can't substitute for ActorPathString.
  3. Cross-coordination with [Security] ActorPath.child(name) doesn't reject path-traversal segments #126/[Security] Actor names accept control chars, allowing log injection #134 — validation happens at the brand boundary.

Acceptance criteria

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: lowNice-to-have / niche / demand-driven

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions