Skill Tracer
Skills › Archify › archify › README.md

README.md

73 lines · archify/renderers/waterfall/README.md at a406594

Open on GitHub
1# Execution Waterfall Renderer
2
3Render `diagram_type: "waterfall"` JSON files into the standard Archify HTML template.
4
5```bash
6node archify/renderers/waterfall/render-waterfall.mjs input.waterfall.json output.html
7```
8
9`--layout-json` prints the axis, scale, ticks, and every row's timing and bar
10geometry instead of HTML.

Execution Waterfall Renderer

Render diagram_type: "waterfall" JSON files into the standard Archify HTML template.

node archify/renderers/waterfall/render-waterfall.mjs input.waterfall.json output.html

--layout-json prints the axis, scale, ticks, and every row's timing and bar geometry instead of HTML.

Raw lines 1 to 11
12## Input
14```json
16 "schema_version": 1,
17 "diagram_type": "waterfall",
18 "meta": { "title": "Checkout request", "evidence": "illustrative", "unit": "ms" },
19 "spans": [
20 { "id": "request", "name": "POST /checkout", "start": 0, "end": 1200 },
21 { "id": "auth", "name": "Authenticate caller", "start": 0, "duration": 100, "parent": "request" }
22 ]
24```
26A span states `start` and either `end` or `duration` (both only if they agree),
27in `meta.unit` (`us`, `ms`, or `s`; default `ms`), measured from a common trace
28origin. `parent`, `status` (`ok`, `error`, `cancelled`, `incomplete`),
29`service`, `detail`, and `sources` are optional. `meta.evidence`
30(`measured` / `illustrative`) is required and drawn as a badge.
32| Code | Refused input |
33| --- | --- |
34| `waterfall/invalid-timing` | end before start, end and duration that disagree, or no end/duration on a span that is not `incomplete` (negative values fail the schema) |
35| `waterfall/missing-parent` | `parent` names an undeclared span |
36| `waterfall/cycle` | parent links that loop |
37| `waterfall/duplicate-id` | an id declared twice |
39An `incomplete` span without an end is drawn to the last recorded instant of
40the trace with a dashed body and an open edge, labelled `incomplete, ≥ X` — a
41lower bound, never a measured duration. Several root spans are allowed.

Input

{
  "schema_version": 1,
  "diagram_type": "waterfall",
  "meta": { "title": "Checkout request", "evidence": "illustrative", "unit": "ms" },
  "spans": [
    { "id": "request", "name": "POST /checkout", "start": 0, "end": 1200 },
    { "id": "auth", "name": "Authenticate caller", "start": 0, "duration": 100, "parent": "request" }
  ]
}

A span states start and either end or duration (both only if they agree), in meta.unit (us, ms, or s; default ms), measured from a common trace origin. parent, status (ok, error, cancelled, incomplete), service, detail, and sources are optional. meta.evidence (measured / illustrative) is required and drawn as a badge.

CodeRefused input
waterfall/invalid-timingend before start, end and duration that disagree, or no end/duration on a span that is not incomplete (negative values fail the schema)
waterfall/missing-parentparent names an undeclared span
waterfall/cycleparent links that loop
waterfall/duplicate-idan id declared twice

An incomplete span without an end is drawn to the last recorded instant of the trace with a dashed body and an open edge, labelled incomplete, ≥ X — a lower bound, never a measured duration. Several root spans are allowed.

Raw lines 12 to 42
43## Layout
45Rows are depth-first: every span is followed by its children in start order,
46indented with tree guides in the name column, so nesting reads from the left
47and time reads from the bar. One linear scale maps the trace from its earliest
48start to its latest end onto `layout.width` (default 760 px); ticks use 1/2/2.5/5
49steps. Overlapping bars on different rows are concurrent work.
51A span with children is drawn as a tinted, outlined bracket over its time; a
52span that does the work itself is a solid bar, so the paint separates inclusive
53summaries from leaf work. Colour states the `service`: each service gets its own
54palette family in order of first appearance (a span without one inherits its
55parent's; unowned spans are neutral), with a dot in the name column and a legend
56entry when more than one service appears. There are five service colours; past
57five services they repeat, and services sharing a colour share one legend entry
58(`gateway · inventory`), so the key never ties a colour to a single service it
59does not own. Red is reserved for `status: "error"`.
61Each bar carries its exact duration just after its end; the canvas reserves
62room past the axis for the widest label, so short operations stay labelled. The
63header states the wall-clock total and range. The Semantic Passport shows the
64exact start–end, duration, and share as "N% of T wall-clock"; parent durations
65are inclusive and are never added to their children. No critical path or
66waiting time is drawn: the input has no dependency model to support one.

Layout

Rows are depth-first: every span is followed by its children in start order, indented with tree guides in the name column, so nesting reads from the left and time reads from the bar. One linear scale maps the trace from its earliest start to its latest end onto layout.width (default 760 px); ticks use 1/2/2.5/5 steps. Overlapping bars on different rows are concurrent work.

A span with children is drawn as a tinted, outlined bracket over its time; a span that does the work itself is a solid bar, so the paint separates inclusive summaries from leaf work. Colour states the service: each service gets its own palette family in order of first appearance (a span without one inherits its parent's; unowned spans are neutral), with a dot in the name column and a legend entry when more than one service appears. There are five service colours; past five services they repeat, and services sharing a colour share one legend entry (gateway · inventory), so the key never ties a colour to a single service it does not own. Red is reserved for status: "error".

Each bar carries its exact duration just after its end; the canvas reserves room past the axis for the widest label, so short operations stay labelled. The header states the wall-clock total and range. The Semantic Passport shows the exact start–end, duration, and share as "N% of T wall-clock"; parent durations are inclusive and are never added to their children. No critical path or waiting time is drawn: the input has no dependency model to support one.

Raw lines 43 to 67
68## Tested size
70`examples/example-rebuild.waterfall.json` is a measured trace: 25 spans from one
71local run that rendered and checked eight bundled examples across three
72concurrent workers (child-process start to exit, `performance.now()` offsets).
73It renders in about 0.2s and passes the showcase gates.

Tested size

examples/example-rebuild.waterfall.json is a measured trace: 25 spans from one local run that rendered and checked eight bundled examples across three concurrent workers (child-process start to exit, performance.now() offsets). It renders in about 0.2s and passes the showcase gates.

Raw lines 68 to 73