Skill Tracer
Skills › Archify › archify › README.md

README.md

146 lines · archify/renderers/sequence/README.md at a406594

Open on GitHub
1# Sequence Renderer
2
3Render `diagram_type: "sequence"` JSON files into the standard Archify HTML
4template.
5
6```bash
7node archify/renderers/sequence/render-sequence.mjs input.sequence.json output.html
8```
9
10The renderer validates input against `archify/schemas/sequence.schema.json`
11with the bundled standalone validator. No dependency installation is required.
13If `output.html` is omitted, the renderer uses the required `meta.output` value
14from the JSON file.

Sequence Renderer

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

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

The renderer validates input against archify/schemas/sequence.schema.json with the bundled standalone validator. No dependency installation is required.

If output.html is omitted, the renderer uses the required meta.output value from the JSON file.

Raw lines 1 to 15
16## Input
18Sequence JSON files must set:
20```json
22 "schema_version": 1,
23 "diagram_type": "sequence",
24 "meta": {
25 "title": "Cache Miss Request Sequence",
26 "output": "cache-miss-request.html",
27 "viewBox": [920, 760]
28 },
29 "participants": [],
30 "segments": [],
31 "messages": [],
32 "activations": [],
33 "cards": []
35```
37The timeline scales with the viewBox height: a taller `meta.viewBox` buys more
38message room, a shorter one shrinks the readable band instead of clipping. A
39complete worked example lives at
40`archify/examples/cache-miss-request.sequence.json`.
42The schema lives at:
44```text
45archify/schemas/sequence.schema.json
46```

Input

Sequence JSON files must set:

{
  "schema_version": 1,
  "diagram_type": "sequence",
  "meta": {
    "title": "Cache Miss Request Sequence",
    "output": "cache-miss-request.html",
    "viewBox": [920, 760]
  },
  "participants": [],
  "segments": [],
  "messages": [],
  "activations": [],
  "cards": []
}

The timeline scales with the viewBox height: a taller meta.viewBox buys more message room, a shorter one shrinks the readable band instead of clipping. A complete worked example lives at archify/examples/cache-miss-request.sequence.json.

The schema lives at:

archify/schemas/sequence.schema.json
Raw lines 16 to 47
48## Legend
50The default visual legend derives kinds from `messages[].variant` (omitting
51`variant` means `default`). Supported `meta.legend.entries` keys, in stable
52order, are `emphasis`, `return`, `security`, `dashed`, and `default`. These are
53visual message keys, not Semantic Lens controls; label/visibility overrides do
54not create edge facts.
56The legend sits below all timeline content: the last message and its note,
57activation bars, and segment frames, with a 12px gap. Without `meta.viewBox`
58the canvas height fits that content (no fixed 760px floor) and grows when late
59messages need more room. With an authored `viewBox` that is too short,
60`showcase` fails with the exact height to set, and `standard` hides the implicit
61legend rather than drawing it over content. Lifelines stop above the legend.
62Message labels use their line's color; gray default and return lines keep the
63muted text color.

Legend

The default visual legend derives kinds from messages[].variant (omitting variant means default). Supported meta.legend.entries keys, in stable order, are emphasis, return, security, dashed, and default. These are visual message keys, not Semantic Lens controls; label/visibility overrides do not create edge facts.

The legend sits below all timeline content: the last message and its note, activation bars, and segment frames, with a 12px gap. Without meta.viewBox the canvas height fits that content (no fixed 760px floor) and grows when late messages need more room. With an authored viewBox that is too short, showcase fails with the exact height to set, and standard hides the implicit legend rather than drawing it over content. Lifelines stop above the legend. Message labels use their line's color; gray default and return lines keep the muted text color.

Raw lines 48 to 64
65## Layout budget
67| Constant | Value |
68|----------|-------|
69| viewBox | automatic height fits content + legend (minimum 327px readable band); taller when late content needs more room; automatic width packs to 560–800px for 2–3 short-label participants (4+ default 920; long labels still widen). Schema minimum `[480, 480]` |
70| Participant boxes | `spread` (default): viewBox-relative width from 86px up to 190px; `fixed`: 86px wide; both 60px tall at y 72 |
71| Participant columns | `fixed`: centers at x = 62 + index×108; `spread`: columns distribute across the available viewBox width with at least a 16px card gutter |
72| Participant count | the last box must end at or before width − 40; layouts that cannot fit fail closed |
73| Lifelines | from y 142 down to height − 65 (drawn to just above the legend); band must be ≥120px tall |
74| Message `y` range | `[160, height − 83]` |
75| Message spacing | ≥28px vertical between messages that share horizontal space |
76| Arrow span | ≥60px horizontal between the two participants |
77| Message notes | 7px context text under the arrow, visible at normal Read zoom (Map hides it without changing timeline geometry), wrapped at 11px line spacing inside one gap between neighbouring lifelines (the widest gap the message spans; gaps within 0.5px count as equal and resolve to the left-most, where notes have always started), clear of activation bars; long unbroken text breaks after `/ . - ? & = # _`, otherwise at any character, so the full note is kept in every export. In `showcase`, a note that reaches a later message fails as `sequence/note-overlap` with the `y` that message needs, a note past the canvas content limit fails as `sequence/note-canvas-limit` with the `meta.viewBox[1]` it needs, and a segment label still covering a message label, route or note after its four upward steps fails as `sequence/segment-label-overlap`; each diagnostic names the source path and offers a verified `supportedFixes` edit when one exists |
78| Segments | y pixel ranges with `to > from`, inside `[72, lifeline bottom + 20]` |
79| Legend | last row baseline at height − 54; extra rows wrap upward and stay 12px below the timeline content |
81`segments[].from/to` and `activations[].from/to` are y pixel coordinates, not
82participant ids; activations also require `to > from`.

Layout budget

ConstantValue
viewBoxautomatic height fits content + legend (minimum 327px readable band); taller when late content needs more room; automatic width packs to 560–800px for 2–3 short-label participants (4+ default 920; long labels still widen). Schema minimum [480, 480]
Participant boxesspread (default): viewBox-relative width from 86px up to 190px; fixed: 86px wide; both 60px tall at y 72
Participant columnsfixed: centers at x = 62 + index×108; spread: columns distribute across the available viewBox width with at least a 16px card gutter
Participant countthe last box must end at or before width − 40; layouts that cannot fit fail closed
Lifelinesfrom y 142 down to height − 65 (drawn to just above the legend); band must be ≥120px tall
Message y range[160, height − 83]
Message spacing≥28px vertical between messages that share horizontal space
Arrow span≥60px horizontal between the two participants
Message notes7px context text under the arrow, visible at normal Read zoom (Map hides it without changing timeline geometry), wrapped at 11px line spacing inside one gap between neighbouring lifelines (the widest gap the message spans; gaps within 0.5px count as equal and resolve to the left-most, where notes have always started), clear of activation bars; long unbroken text breaks after / . - ? & = # _, otherwise at any character, so the full note is kept in every export. In showcase, a note that reaches a later message fails as sequence/note-overlap with the y that message needs, a note past the canvas content limit fails as sequence/note-canvas-limit with the meta.viewBox[1] it needs, and a segment label still covering a message label, route or note after its four upward steps fails as sequence/segment-label-overlap; each diagnostic names the source path and offers a verified supportedFixes edit when one exists
Segmentsy pixel ranges with to > from, inside [72, lifeline bottom + 20]
Legendlast row baseline at height − 54; extra rows wrap upward and stay 12px below the timeline content

segments[].from/to and activations[].from/to are y pixel coordinates, not participant ids; activations also require to > from.

Raw lines 65 to 83
84### Column fit
86Sequence diagrams default to `meta.column_fit: "spread"`, whether or not
87`meta.viewBox` is supplied.
88Explicit `"fixed"` preserves the historical 86px boxes and 108px column gap.
89To retain historical fixed coordinates, set `meta.column_fit: "fixed"` explicitly.
90Use `"spread"` when a wide
91viewBox would otherwise leave empty space on the right or when meaningful
92participant labels do not fit the fixed 86px boxes. Spread derives box width
93and column distance from the viewBox while preserving participant order,
94lifelines, and message semantics. Participant cards retain at least a 16px
95gutter. Narrow canvases that can fit those cards may reduce the left margin
96from 62px down to 40px; ordinary canvases keep 62px and the right margin
97remains 40px. Frames too narrow for those margins and gutters fail rather than
98enlarge the authored viewBox.
100The artifact checker reports `composition.sequenceColumnSpace` from the rendered
101participants, routes and text. A large unused right-hand region in a fixed layout
102can produce an `inspect-sequence-width` recommendation in `finalize`; it is advice,
103not a new warning or failure. See [Sequence width review](../../references/delivery-contract.md#sequence-width-review)
104for the bounded authoring repair and explicit-fixed preservation rules.

Column fit

Sequence diagrams default to meta.column_fit: "spread", whether or not meta.viewBox is supplied. Explicit "fixed" preserves the historical 86px boxes and 108px column gap. To retain historical fixed coordinates, set meta.column_fit: "fixed" explicitly. Use "spread" when a wide viewBox would otherwise leave empty space on the right or when meaningful participant labels do not fit the fixed 86px boxes. Spread derives box width and column distance from the viewBox while preserving participant order, lifelines, and message semantics. Participant cards retain at least a 16px gutter. Narrow canvases that can fit those cards may reduce the left margin from 62px down to 40px; ordinary canvases keep 62px and the right margin remains 40px. Frames too narrow for those margins and gutters fail rather than enlarge the authored viewBox.

The artifact checker reports composition.sequenceColumnSpace from the rendered participants, routes and text. A large unused right-hand region in a fixed layout can produce an inspect-sequence-width recommendation in finalize; it is advice, not a new warning or failure. See Sequence width review for the bounded authoring repair and explicit-fixed preservation rules.

Raw lines 84 to 105
106## Design Rules
108- Messages currently require distinct `from` and `to` participants. Although
109 schema-v1 accepts matching IDs, this renderer does not draw self-call loops
110 and rejects them with `sequence/self-message-unsupported`, naming the message
111 path and participant. Increasing column distance cannot repair a self-message.
112 Preserve an internal step's wording, ownership, and order in a note on an
113 actual interaction or an explicitly ordered card. Do not invent another
114 participant or change the target merely to pass validation. These authoring
115 choices require semantic review and are not advertised as automatic fixes.
116- Put participants across the top, ordered by the story the reader should
117 follow.
118- Time moves downward.
119- Use `emphasis` for the main request path.
120- Use `security` for auth, consent, permission, and policy calls.
121- Use `return` for quiet response messages.
122- Use `dashed` for async trace, event, logging, and non-blocking work.
123- Use segments as light background guides; keep segment labels short and keep each frame edge at least 4px off every message arrow. Check the complete wrapped note as well as its arrow before closing a phase. `validate` and `check` report crossings in `composition.sequenceNoteBorders` as review evidence, without blocking finalization. An offered `supportedFixes` edit extends only the named bottom edge; when no isolated edit fits, adjust the phase boundaries and message spacing together, preserving the full note and message order.
124- Keep labels concise, but try `meta.column_fit: "spread"` before shortening a
125 meaningful participant label just to fit the fixed boxes.
127Schema violations exit non-zero with path-prefixed messages annotated with the
128element's id or label. The renderer additionally fails when it can detect
129layout problems, including missing participants, duplicate participant IDs,
130participant labels wider than their box, unknown message endpoints, messages
131outside the readable timeline, overly tight vertical spacing between messages
132that overlap horizontally, invalid segment or activation ranges, or
133participants that exceed the viewBox. The shared Clean Flow contract treats
134participant headers as semantic boxes while explicitly allowing messages to
135cross intermediate lifelines, activation bars, and segment frames. Text width is estimated CJK-aware:
136fullwidth glyphs count as two units.
138Set `meta.quality_profile` to `showcase` for polished delivery. Unrelated proper
139message X crossings then fail with `composition/proper-crossing`; default
140`standard` keeps them as artifact-receipt warnings. Messages may still cross
141intermediate lifelines. Collinear corridors remain outside the proper-X rule,
142but a separate gate warns in `standard` and fails in `showcase` when unrelated
143messages overlap for at least 8px. Shared semantic endpoints, point touches,
144and shorter overlaps remain valid. Showcase also rejects any route segment
145below 8px and any interior turn segment below 16px; ordinary 8–15px endpoint
146stubs remain valid.

Design Rules

  • Messages currently require distinct from and to participants. Although schema-v1 accepts matching IDs, this renderer does not draw self-call loops and rejects them with sequence/self-message-unsupported, naming the message path and participant. Increasing column distance cannot repair a self-message. Preserve an internal step's wording, ownership, and order in a note on an actual interaction or an explicitly ordered card. Do not invent another participant or change the target merely to pass validation. These authoring choices require semantic review and are not advertised as automatic fixes.
  • Put participants across the top, ordered by the story the reader should follow.
  • Time moves downward.
  • Use emphasis for the main request path.
  • Use security for auth, consent, permission, and policy calls.
  • Use return for quiet response messages.
  • Use dashed for async trace, event, logging, and non-blocking work.
  • Use segments as light background guides; keep segment labels short and keep each frame edge at least 4px off every message arrow. Check the complete wrapped note as well as its arrow before closing a phase. validate and check report crossings in composition.sequenceNoteBorders as review evidence, without blocking finalization. An offered supportedFixes edit extends only the named bottom edge; when no isolated edit fits, adjust the phase boundaries and message spacing together, preserving the full note and message order.
  • Keep labels concise, but try meta.column_fit: "spread" before shortening a meaningful participant label just to fit the fixed boxes.

Schema violations exit non-zero with path-prefixed messages annotated with the element's id or label. The renderer additionally fails when it can detect layout problems, including missing participants, duplicate participant IDs, participant labels wider than their box, unknown message endpoints, messages outside the readable timeline, overly tight vertical spacing between messages that overlap horizontally, invalid segment or activation ranges, or participants that exceed the viewBox. The shared Clean Flow contract treats participant headers as semantic boxes while explicitly allowing messages to cross intermediate lifelines, activation bars, and segment frames. Text width is estimated CJK-aware: fullwidth glyphs count as two units.

Set meta.quality_profile to showcase for polished delivery. Unrelated proper message X crossings then fail with composition/proper-crossing; default standard keeps them as artifact-receipt warnings. Messages may still cross intermediate lifelines. Collinear corridors remain outside the proper-X rule, but a separate gate warns in standard and fails in showcase when unrelated messages overlap for at least 8px. Shared semantic endpoints, point touches, and shorter overlaps remain valid. Showcase also rejects any route segment below 8px and any interior turn segment below 16px; ordinary 8–15px endpoint stubs remain valid.

Raw lines 106 to 146