Spec Studio

Edges route around boxes with deterministic orthogonal paths

spec:consumers.spec-studio.diagram-kinds.edge-routingContract · storyready floor ready

New since the base graph base da4b141. See the diff.

Base input: schema 0.11.0, 405 Specs.

Packs: pack:roadmaps-and-slices-v1, pack:self-hosting-v1

Design: 6 design entries · 1 pinned declaration · no decisions

Findings: no errors, no warnings

specs/consumers/spec-studio.diagram-kinds.edge-routing.sdp.md

No open questions and no blocking questions; implementation binding present, verifier binding present, and expected-outcome oracle none.

Intent
outcome
Follow an arrow without it crossing a box or covering a label, using the engine's own static layout.
Contract
rule.obstacles line 18 · specs/consumers/spec-studio.diagram-kinds.edge-routing.sdp.md:18
After box placement and label wrapping, reserve each box and band label rectangle as an obstacle with clearance. An edge may touch only its own source and destination ports; no other segment may intersect a reserved rectangle's interior.

no example exercises it

rule.routes line 19 · specs/consumers/spec-studio.diagram-kinds.edge-routing.sdp.md:19
Route edges deterministically in code-unit order by from, to, kind and claim with orthogonal whole-pixel paths around the reserved obstacles. Add no layout dependency and read no browser measurement. The build owns the search representation, weights and tie-break implementation.

no example exercises it

rule.ports line 20 · specs/consumers/spec-studio.diagram-kinds.edge-routing.sdp.md:20
Choose source and destination sides deterministically for forward, same-band and backward edges. Every incident edge has its own port. A cycle and a backward edge remain directed and route around intervening boxes.

no example exercises it

rule.labels line 21 · specs/consumers/spec-studio.diagram-kinds.edge-routing.sdp.md:21
Reserve an edge label's rectangle beside a free segment. If the exact relation and claim words do not fit, use a stable edge key and name its full wording in the adjacent legend and text equivalent. Every placed label rectangle is an obstacle for later labels and routes; no two labels overlap. An edge carries a label only where spec:consumers.spec-studio.diagrams#rule.wordsBesideStyle asks for one; a drawing whose edges share one relation and one claim names them once in its legend.

no example exercises it

rule.noPath line 22 · specs/consumers/spec-studio.diagram-kinds.edge-routing.sdp.md:22
If any required route, distinct lane or label cannot be placed within the deterministic routing budget, omit that SVG and open its text equivalent with an explicit routing explanation. Never draw a straight line through a box as fallback.

no example exercises it

0 unkeyed rules.

Design
clearance line 25 · specs/consumers/spec-studio.diagram-kinds.edge-routing.sdp.md:25
12 logical pixels around boxes and text, with ports connected through their own clearance by a stub. Lane spacing is 8 pixels and gutter margin is 24 pixels; all coordinates and costs are integers.

no citation recorded

cost line 26 · specs/consumers/spec-studio.diagram-kinds.edge-routing.sdp.md:26
Crossings remain permitted at free points, never through nodes or labels. Two edges never share a collinear segment: they take distinct ports and lanes 8 pixels apart, and an edge that cannot get a lane is a routing failure under the no-path rule.
searchBound line 27 · specs/consumers/spec-studio.diagram-kinds.edge-routing.sdp.md:27
The build chooses a finite deterministic search budget and tests its routing-failure explanation; tuning the search changes no graph meaning. The shared box and edge bound applies first.
overflow line 28 · specs/consumers/spec-studio.diagram-kinds.edge-routing.sdp.md:28
Routing gutters may increase SVG width beyond the box layout budget to preserve distinct lanes; the desktop scroll instruction follows that final width. No label is shrunk to fit.
routeModel line 29 · specs/consumers/spec-studio.diagram-kinds.edge-routing.sdp.md:29
Each route retains from, to, kind, claim, optional aggregation count and relation reason, plus its integer point list; ports and routes are presentation values, never graph edges.
elementIds line 30 · specs/consumers/spec-studio.diagram-kinds.edge-routing.sdp.md:30
Preserve .edge data-from, data-to and data-kind, add data-claim when present and a stable data-edge-key for legend lookup; arrow marker ids remain scoped to subject and view.
Verification

Verifier bindings

  • test:protocol.studio-diagram-core · anchored · test anchor binding present · test/studio-diagram-core.test.ts:37

    External run evidence from test/studio-diagram-core.test.ts

    Test anchors: test:protocol.studio-copy-source, test:protocol.studio-diagram-core. Specs verified by those bindings: spec:consumers.spec-studio.diagram-kinds.edge-routing, spec:consumers.spec-studio.diagram-kinds.legibility, spec:consumers.spec-studio.diagram-kinds.mermaid-source, spec:consumers.spec-studio.diagram-kinds.requirement-trace, spec:consumers.spec-studio.diagrams, spec:consumers.spec-studio.page-elements.

    Run 1: external run evidence from vitest 4.1.10

    Build: CI 380 · Branch: feature/roadmap-and-slices-v0 · Commit: 34909918bf0be0e849959644401797191cae379f · Start: 2026-10-22T17:40:31.456Z · Stop: 2026-10-22T17:42:16.171Z

    NameSuiteResultDuration
    wraps by code point and shortens shared segments without collisionsshared diagram corepassed8.25 ms
    wraps boxes within the width budget and writes an instruction only for final wide drawingsshared diagram corepassed6.1 ms
    routes forward, backward and same-band edges with distinct ports and no shared segmentsshared diagram corepassed14.15 ms
    fails closed when routing cannot fit, retaining complete text and no partial sourceshared diagram corepassed50.17 ms
    serializes full identities, exact claims, reasons, counts and folds as inert Mermaid datashared diagram corepassed1.98 ms
    copies the current value of the labelled textarea and selects that same area on clipboard failurenot recordedpassed55.84 ms
    keeps the full box and edge bound routable with obstacles, separate lanes and edge labelsnot recordedpassed430.81 ms
    offers deterministic Mermaid source for each existing drawing and pins the safe text syntaxnot recordedpassed5.63 ms
    folds reason-bearing trace groups without attributing a member reason to the groupnot recordedpassed8.01 ms
    uses the full band budget for a single context and routes adjacent bands inside itnot recordedpassed0.59 ms
    prints exact short relation words and reserves keys for wording that cannot fitnot recordedpassed6.46 ms
    names viewport and instruction ids for trace and secondary viewsnot recordedpassed3.43 ms
    names the architecture syntax and serializes aliases in displayed box ordernot recordedpassed0.34 ms
    routes the current Protocol architecture and recorded adopter architecture with distinct ports and segmentsnot recordedpassed74.94 ms
    extends overflow rails past earlier labels on the adopter's dense tracesnot recordedpassed4.75 ms
    keeps high-degree boxes inside their cells when contexts share a gridnot recordedpassed1.15 ms
    folds nine refining verifiers with their tests within the band budget and keeps every text rownot recordedpassed2.68 ms
    names folded declared refiners by their relation and claim without an internal subtitlenot recordedpassed2.03 ms
    keeps examples apart from refiners when dense requirement groups foldnot recordedpassed1.09 ms
    names refines folds in plain words and preserves directionnot recordedpassed1.31 ms
    names satisfies folds in plain words and preserves directionnot recordedpassed1.09 ms
    names verifies folds in plain words and preserves directionnot recordedpassed1.46 ms
    keeps a short drawing unfolded even with many boxes and incident edgesnot recordedpassed1.77 ms
    packs disjoint endpoint intervals into shared horizontal lanesnot recordedpassed0.89 ms
    uses a legend key before spending overflow width on exact wordsnot recordedpassed1.18 ms
Design view

Requirement drawing

  • Declared verifying examples: no declared verifying example.
Requirement drawing for spec:consumers.spec-studio.diagram-kinds.edge-routing
The diagram as text
  • spec:consumers.spec-studio.diagram-kinds.edge-routing: Edges route around boxes with deterministic orthogonal paths · declared Spec
  • spec:consumers.spec-studio.diagram-kinds: The Studio chooses diagram kinds from graph values · declared Spec
  • spec:consumers.spec-studio.diagrams: A diagram is laid out from graph values into SVG with a text equivalent · declared Spec
  • impl:protocol.studio-diagram-routing: port, channel and overflow-rail edge routes around boxes and labels · anchored code · src/projections/studio/diagrams/routing.ts:38
  • impl:protocol.studio-diagrams: deterministic grid and band layouts with bounded folds and full text equivalents · anchored code · src/projections/studio/diagrams/svg.ts:73
  • test:protocol.studio-diagram-core: test:protocol.studio-diagram-core · anchored test binding · binding present · test/studio-diagram-core.test.ts:37
  • spec:consumers.spec-studio.diagram-kinds.edge-routing refines spec:consumers.spec-studio.diagram-kinds · declared — arrows that cover no label serve the readable drawings the diagram kinds state
  • spec:consumers.spec-studio.diagram-kinds.edge-routing refines spec:consumers.spec-studio.diagrams · declared
  • impl:protocol.studio-diagram-routing satisfies spec:consumers.spec-studio.diagram-kinds.edge-routing · anchored
  • impl:protocol.studio-diagrams satisfies spec:consumers.spec-studio.diagram-kinds.edge-routing · anchored
  • test:protocol.studio-diagram-core verifies spec:consumers.spec-studio.diagram-kinds.edge-routing · anchored
Mermaid source

Copyable source; the Studio draws static SVG.

Preferred and chosen syntax: requirementDiagram; exact refines, satisfies and verifies, with claim words in nodes and per-edge comments.

Decisions

No decision record named.

Runtime
  • component:protocol.projections · read-only output, layout and owned publication · src/projections/design-review.ts:29 · layer edge · context protocol

    Uses

    • component:protocol.extract · the carrier and source pipeline · src/extract/index.ts:192 · layer application · context protocol
    • component:protocol.graph · the one graph and its semantic decisions · src/graph/schema.ts:34 · layer domain · context protocol
    • component:protocol.model · the authored contracts and stable ids · src/model/anchors.ts:100 · layer domain · context protocol
    • component:protocol.notation · the leaf step codec · src/notation/slots.ts:261 · layer domain · context protocol
    • component:protocol.reader · the typed graph contract and body evaluator · src/reader/reader.ts:671 · layer application · context protocol
    • component:protocol.validate · one finding currency and ordered checks · src/validate/validators.ts:72 · layer domain · context protocol
  • impl:protocol.studio-diagram-routing · port, channel and overflow-rail edge routes around boxes and labels · src/projections/studio/diagrams/routing.ts:38

    Component: component:protocol.projections · read-only output, layout and owned publication · src/projections/design-review.ts:29 · layer edge · context protocol

    Uses

    None.

  • impl:protocol.studio-diagrams · deterministic grid and band layouts with bounded folds and full text equivalents · src/projections/studio/diagrams/svg.ts:73

    Component: component:protocol.projections · read-only output, layout and owned publication · src/projections/design-review.ts:29 · layer edge · context protocol

    Uses

    • impl:protocol.studio-diagram-model · shared diagram boxes, edges and drawing bounds · src/projections/studio/diagrams/model.ts:1

Runtime observation: not tracked.

Evidence

Runtime observation: not tracked.

Build attestations: not tracked.

Deployments: not tracked.

Bills of materials: not tracked.

Impact
Relations of spec:consumers.spec-studio.diagram-kinds.edge-routing

Arrows: refines (declared).

The diagram as text
  • spec:consumers.spec-studio.diagram-kinds: The Studio chooses diagram kinds from graph values
  • spec:consumers.spec-studio.diagram-kinds.edge-routing: Edges route around boxes with deterministic orthogonal paths
  • spec:consumers.spec-studio.diagrams: A diagram is laid out from graph values into SVG with a text equivalent
  • spec:consumers.spec-studio.diagram-kinds.edge-routing refines spec:consumers.spec-studio.diagram-kinds · declared — arrows that cover no label serve the readable drawings the diagram kinds state
  • spec:consumers.spec-studio.diagram-kinds.edge-routing refines spec:consumers.spec-studio.diagrams · declared
Mermaid source

Copyable source; the Studio draws static SVG.

Preferred syntax: flowchart. Chosen syntax: labelled flowchart, preserving exact relations, claims and folds.

Rests on

Rested on by

No Spec rests on this Spec.

Relations

Relation and directionOther endClaimReasonExercised keys
refines · outgoingThe Studio chooses diagram kinds from graph values
spec:consumers.spec-studio.diagram-kinds · resolves
declaredarrows that cover no label serve the readable drawings the diagram kinds stateNone
refines · outgoingA diagram is laid out from graph values into SVG with a text equivalent
spec:consumers.spec-studio.diagrams · resolves
declaredNoneNone

Bindings

Implementation binding: present

  • impl:protocol.studio-diagram-routing · port, channel and overflow-rail edge routes around boxes and labels · src/projections/studio/diagrams/routing.ts:38 · role projection · component component:protocol.projections · layer edge · context protocol
  • impl:protocol.studio-diagrams · deterministic grid and band layouts with bounded folds and full text equivalents · src/projections/studio/diagrams/svg.ts:73 · role projection · component component:protocol.projections · layer edge · context protocol

Design reference: none

Verifier binding: present

  • test:protocol.studio-diagram-core · anchored · test/studio-diagram-core.test.ts:37 · test anchor

Expected-outcome oracle: none

Runtime observation: not tracked.

Run results: not recorded in the graph.

Findings

None.

Composing (0)

Composing needs the script.