Skip to content

refactor(storage): centralize safe persisted identifier validation #4926

Description

@seekskyworld

Problem

Several storage authorities independently validate persisted identity strings with the same /^[A-Za-z0-9_-]{1,128}$/ rule. The copies already differ in accepted input types, trimming, and error text, which makes a future policy change easy to apply to one authority while leaving another boundary weaker.

Scope

  • Add one storage-local safe identifier predicate/asserter.
  • Migrate runtime-event-invariants.ts, interaction-store.ts, session-bundle-policy.ts, session-copy-cleanup.ts, and goal-authority.ts while preserving each caller's trimming and public error contract.
  • Keep provider-specific external session identifiers and the independently evolving agent-run-store / message-admission-store paths out of this change.

Acceptance criteria

  • All migrated boundaries accept the same 1–128 character ASCII identifier language and reject empty, overlong, whitespace, path, and punctuation values.
  • Existing error classes/messages and normalization behavior remain unchanged.
  • A focused test covers the shared predicate at both length boundaries and representative invalid/non-string values.

This is a child slice of the storage consistency work identified in #1404.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions