Documentation
¶
Overview ¶
Package identity defines Harbor's load-bearing isolation key.
Every Runtime, Protocol, Memory, State, Skills, Tools, Planner and Governance code path scopes its work by the (TenantID, UserID, SessionID) triple. The triple is the isolation boundary; RunID is the per-execution scope inside a session and is carried by Quadruple — never substituted for Identity in scoping decisions.
Identity is mandatory: there is no opt-out knob (decisions.md D-001). Validate fails closed when any component is empty; With and WithRun validate at write time so bugs surface at the call site.
This package is dependency-free and holds no package-level mutable state beyond two unexported context-key sentinels. Concurrent reuse is safe by construction (decisions.md D-025).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrIdentityMissing — the context carries no Identity AND no // Quadruple. Both MustFrom and MustQuadrupleFrom panic with // this sentinel when their respective key is absent. ErrIdentityMissing = errors.New("identity: no Identity or Quadruple in context") // ErrIdentityIncomplete — one or more components empty. Identity is mandatory. ErrIdentityIncomplete = errors.New("identity: one or more components empty") )
Functions ¶
func Validate ¶
Validate returns an error wrapping ErrIdentityIncomplete when any of (TenantID, UserID, SessionID) is empty. Whitespace-only strings pass; the caller is responsible for input normalization.
Types ¶
type Identity ¶
Identity is the load-bearing isolation key. All three components are mandatory; an Identity with any empty component is rejected by Validate.
type Quadruple ¶
Quadruple is Identity + the per-execution RunID. Used in Envelopes and run-scoped state. Quadruple is NOT a substitute for Identity in scoping decisions: the triple is the isolation boundary; RunID is the per-execution scope inside a session.
func MustQuadrupleFrom ¶
MustQuadrupleFrom returns the Quadruple in ctx. Panics with ErrIdentityMissing when none is present. The Quadruple key is independent from the Identity key: a context attached via With does NOT satisfy MustQuadrupleFrom, and vice versa.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package conformancetest exposes the canonical identity-correctness suite that every identity-aware Harbor subsystem (StateStore drivers, MemoryStore drivers, Governance, Audit, Memory) must run.
|
Package conformancetest exposes the canonical identity-correctness suite that every identity-aware Harbor subsystem (StateStore drivers, MemoryStore drivers, Governance, Audit, Memory) must run. |