# `Pixir.SessionId`
[🔗](https://github.com/Ranvier-Technologies/pixir/blob/main/lib/pixir/session_id.ex#L1)

Canonical validation for Pixir Session identifiers.

Session ids become Registry keys, filename components, recovery-command arguments,
and durable evidence references. This module is therefore the only grammar authority:
callers validate before any Registry lookup, path construction, filesystem operation,
command rendering, or Provider projection.

Valid ids are 1..235 bytes of valid UTF-8. The first codepoint is a Unicode letter,
number, or underscore; later codepoints may additionally be Unicode combining marks,
hyphens, or dots. The 235-byte ceiling leaves room for Pixir's longest generated Log
suffix, `.ndjson.tmp-<8 hex>`, inside a 255-byte filename component.

Invalid-id errors deliberately never echo, normalize, decode, clean, or basename-reduce
the caller's value. The stable `reason` and bounded metadata are sufficient for agents
and presenters to correct the input without reflecting hostile content.

# `reason`

```elixir
@type reason() ::
  :not_string
  | :empty
  | :invalid_utf8
  | :too_long
  | :invalid_start
  | :invalid_character
```

# `max_bytes`

```elixir
@spec max_bytes() :: pos_integer()
```

Maximum accepted UTF-8 byte length for a Session id.

# `valid?`

```elixir
@spec valid?(term()) :: boolean()
```

Whether a value satisfies the canonical Session-id grammar.

# `validate`

```elixir
@spec validate(term()) :: :ok | {:error, map()}
```

Validate a Session id without returning or echoing the supplied value.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
