The Avenx trace data model.
A trace is a flat, ordered array of nodes. Causality is expressed with a
parent pointer rather than nesting, so a trace stays cheap to append to,
cheap to serialize, and stable to truncate: dropping the oldest nodes from a
ring buffer can never corrupt the array, only orphan a subtree.
The node types mirror Avenx's own execution model — event, action, bridge action, write, watcher, computed, DOM patch, resource, navigation — rather than the browser's. A trace is meant to answer "why did this component re-render", which is a question about the framework, not about the DOM.
- Source:
Members
(static, constant) Determinism :string
Whether a recorded session can be faithfully replayed.
Type:
- string
- Source:
(static, constant) INPUT_TYPES :Set:.<string:>
Node types replay feeds back into the application to reproduce a session.
Everything else in a trace is an observation: replay re-derives it by running the real framework, and compares what it observed against what was recorded. Driving a non-input node directly would make replay a puppet show rather than a reproduction.
Type:
- Source:
(static, constant) NonDeterminismReason :string
Stable reasons a trace was downgraded to Determinism.BEST_EFFORT.
These are the detectable escapes. They are not exhaustive, which is why
replay independently verifies determinism by comparing observations rather
than trusting this list. See replay.js.
Type:
- string
- Source:
(static, constant) OBSERVATION_TYPES :Set:.<string:>
Node types replay compares against the recording to detect divergence.
Type:
- Source:
(static, constant) REDACTED :string
The placeholder substituted for a value a redaction rule matched.
Type:
- string
- Source:
(static, constant) ROOT_TYPES :Set:.<string:>
Node types that begin a causal chain rather than continuing one.
Type:
- Source:
(static, constant) TRACE_VERSION :number
The trace format version.
Bump this whenever the meaning of an existing field changes or a field the reader depends on is removed. Adding a new optional field does not require a bump; readers must tolerate unknown fields.
Type:
- number
- Source:
(static, constant) TraceNodeType :string
Node types that can appear in a trace.
ROOT_TYPES below marks the subset that begins a causal chain, and
INPUT_TYPES marks the subset replay feeds back into the application.
Type:
- string
- Source:
(inner) dropped
How many nodes the ring buffer dropped, if any.
- Source:
(inner) globals
Recorded non-deterministic global values, keyed by source (now, random).
- Source:
(inner) redactions
Property path patterns whose values were withheld from this trace.
- Source:
Methods
(static) createTrace(metaopt) → {object}
Creates an empty trace envelope.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
meta |
object |
<optional> |
Free-form metadata describing where the trace came from. |
- Source:
Returns:
A trace with no nodes.
- Type
- object
(static) groupChildren(trace) → {Map:.<(number:|null:), Array:.<object:>>}
Groups a trace's nodes into parentId -> children order-preserving lists.
Parameters:
| Name | Type | Description |
|---|---|---|
trace |
object | A trace. |
- Source:
Returns:
Children keyed by parent id.
(static) indexNodes(trace) → {Map:.<number:, object:>}
Indexes a trace's nodes by id, so callers can walk parent pointers.
Parameters:
| Name | Type | Description |
|---|---|---|
trace |
object | A trace. |
- Source:
Returns:
Nodes keyed by id.
(static) rootNodes(trace) → {Array:.<object:>}
Returns the trace's causal roots: nodes whose parent is absent from the trace, either because they started a chain or because truncation orphaned them.
Parameters:
| Name | Type | Description |
|---|---|---|
trace |
object | A trace. |
- Source:
Returns:
Root nodes, in recorded order.
(static) validateTrace(trace) → {Object}
Validates that a value looks like a trace this build can read.
Parameters:
| Name | Type | Description |
|---|---|---|
trace |
any | The candidate trace. |
- Source:
Returns:
Why it was rejected, when it was.
- Type
- Object