Contracts and limits
Understand result variants, diagnostic codes, schema versions and resource ceilings.
Results
Each public operation is synchronous and returns a discriminated result. Check ok before accessing the value.
type Result<T> =
| { readonly ok: true; readonly value: T }
| { readonly ok: false; readonly errors: readonly Diagnostic[] };Diagnostics contain a code and, where applicable, a safe field name or numeric limit. They do not carry raw learner payloads. A failure has no partial authoritative projection. Use your own user-facing messages for diagnostic codes.
| Code | Meaning |
|---|---|
| INVALID_EVENT | Event shape or event-related field is invalid. |
| SCOPE_MISMATCH | Supplied scope differs from the event or projection scope. |
| EVENT_ID_CONFLICT | Different event content shares an event ID. |
| SEQUENCE_CONFLICT | Different event IDs share a durable sequence. |
| INVALID_CORRECTION | A lifecycle target or decision chain is invalid. |
| MISSING_CORRECTION_TARGET | A required earlier credit decision is absent. |
| INVALID_POLICY | Policy shape or field is invalid. |
| POLICY_MISMATCH | The supplied policy is incompatible with the projection. |
| INVALID_RELATION | Relation shape, endpoint or prerequisite graph is invalid. |
| INVALID_TIMESTAMP | Timestamp or checked time arithmetic is invalid. |
| UNSUPPORTED_VERSION | Schema or algorithm version is unsupported. |
| REBUILD_REQUIRED | Advance cannot verify the supplied prior identity and history. |
| CALENDAR_PROFILE_MISMATCH | Supplied calendar coverage or resolution is insufficient. |
| RESOURCE_LIMIT_EXCEEDED | An input or derived bound was exceeded. |
Versions and identity
Schema version is the number 1; algorithm version is the string "1". Author policy and eligibility versions explicitly. Policy identity includes the complete normalized content with ordered arrays, so changing intervals under the same version still changes identity. Rebuild after a policy change.
Input limits
| Input | Bound |
|---|---|
| Raw event entries | 20,000 |
| Distinct events | 10,000 |
| Distinct concepts | 1,000 |
| Raw relations | 10,000 |
| Calendar transitions | 4,096 |
| Review intervals | 1 to 64 |
| Interval, retry or maintenance days | 1 to 3,650 |
| Identifier length | 128 ASCII characters |
| Reason code length | 1 to 256 UTF-16 code units |
| Ordinary aggregate string values | 4,000,000 UTF-16 code units per applicable operation |
| Support threshold and qualifying successes | 1 to 1,000 |
| Hints, ladder and ranking weights | 0 to 1,000 |
| Calendar offsets | -1,440 to 1,440 minutes |
| Unix millisecond instants | -8,640,000,000,000,000 to 8,640,000,000,000,000 |
Identifiers start with an ASCII letter or digit and may subsequently contain letters, digits, period, underscore, colon or hyphen. Sequences are nonnegative safe integers. The candidate qualifying span is checked against the supported instant bound; the eligibility minimum span accepts nonnegative safe integers. Derived identity encodings have separate size bounds.
Aggregate budgets depend on the operation and include raw duplicate entries where applicable. See events, replay and due ranking.
Validation boundary
Supply inert JSON data with own enumerable data properties and dense ordinary arrays. The host must limit untrusted serialized input before materialization. JavaScript reflection can allocate according to the width of malformed already-materialized objects. Validation is not a sandbox for hostile objects or proxies.
The public source contracts and installed declarations define the exact types. Retention does not authenticate the source of an event or prove a history complete.