Skip to content

Selective shared reference paths and routing improvements #27

Open

Description

@mepcotterell

Coordinator prerequisite: PR #29. Issue #27 is blocked by the coordinator work and the dependent shared-routing PR #28.

Blocked by: PR #28 — Add controlled shared-reference routing.

Completion depends on the implementation and remaining acceptance work in PR #28. See the completion agent brief; merging the controlled implementation alone does not satisfy the outstanding production enablement gates.

Implementation proposal prepared against commit b6b2e2b9a0593662ac336016706809151cfa1c04. The testing approach is user-confirmed: rendered traces through the public visualizer and native SVG/PNG exports are primary acceptance, supported by fast measured-geometry replay. The coordinator and shared-routing integration are implemented; the maintainer-required 300 ms maximum still fails for both stress cases under both controlled policies, and maintainer visual approval remains pending. See the current acceptance record and coordinator verification record.

Problem Statement

A memory diagram can contain many reference-valued locations that refer to the same heap object. Separate arrows can repeat long portions of a route and crowd the target with arrowheads. The current renderer permits some same-target overlap, but that overlap is not represented as an explicitly owned shared path. A reader may have difficulty distinguishing intentional convergence from a crossing or tracing every source independently.

The desired improvement is clearer source-to-object relationships in both interactive diagrams and static teaching material. Reducing the number of arrowheads is useful only when it preserves the distinction between reference-valued locations, their containing frames or objects, and the objects to which they refer. General routing improvements should also reduce avoidable detours and crossings without sacrificing existing text clearance, source exits, deterministic output, or export bounds.

Solution

Allow a compatible local group of references to share an explicitly constructed final path to their common target. Keep each source's own value box, source dot, and distinguishable initial branch. After a branch joins, it follows one continuous route toward the target without splitting away. Paint the shared portion once and place one arrowhead at its target boundary.

Select sharing only when a comparison with a validated baseline demonstrates a benefit. A target may have several local groups and independent arrivals. Preserve clear direct routes. Keep differing persistent reference styles, self-loops, return routes, and different relation kinds separate in the initial implementation. Retain ordinary readable crossings away from the new shared region; reject a merge if another reference would cross or ambiguously touch its join or shared path.

This is selective sharing of terminal paths, not a change to the program's heap, reference values, or object identities. A junction is only a drawing convention. The first delivery is a controlled implementation and visual comparison behind an internal development policy; automatic production enablement follows the correctness, export, performance, and maintainer review gates below.

User Stories

  1. As a student, I want to follow every visible source location to its object, so that I can explain what the program state means.
  2. As a student, I want aliases to converge clearly, so that I can recognize that several locations refer to one object.
  3. As a student, I want separate source dots and branches, so that I do not confuse several reference-valued locations with one variable.
  4. As a student, I want equal-looking but distinct objects to retain separate arrows, so that I can distinguish equality of contents from identity.
  5. As a student, I want joins to differ from ordinary crossings, so that I do not infer a reference that the program does not contain.
  6. As a student, I want arrowheads to indicate the destination, so that I can follow the direction of each reference.
  7. As a student, I want a self-reference to retain a visible loop, so that I can identify an object referring to itself.
  8. As a student, I want cycle and return paths to retain their individual directions, so that I can distinguish both sides of a cyclic structure.
  9. As a student, I want field sources to remain attached to their owning objects, so that a shared route does not imply that a field belongs to another variable.
  10. As a student, I want array indices and source cells to remain visible, so that I can identify which elements alias an object.
  11. As a student, I want shared inner arrays to retain one object identity, so that I do not mistake aliases for copied rows.
  12. As a student, I want map key and value sources to remain distinct, so that I can identify the referenced part of an entry.
  13. As a student, I want active and inactive frame references to retain their meanings, so that convergence does not imply a change of execution context.
  14. As a student, I want null values to remain local values, so that no shared null object is invented.
  15. As a student, I want default, compact, and inline string presentations to retain their existing meaning, so that repeated literal text is not mistaken for identity evidence.
  16. As a student, I want a straightforward reference to stay easy to follow, so that reducing another arrowhead does not create a needless detour.
  17. As a reader, I want complete source-to-target descriptions in exported SVG, so that shared paint does not remove reference information from the text alternative.
  18. As an instructor, I want static SVG and PNG diagrams to explain aliasing without hover, so that exported handouts remain understandable.
  19. As an instructor, I want diagrams to work in monochrome and at their intended display size, so that color is not the sole way to identify a path.
  20. As an instructor, I want all shared paths and arrowheads inside export bounds, so that no relationship is cropped from teaching material.
  21. As an instructor, I want long labels and narrow layouts to retain readable text, so that routing improvements do not shrink the content.
  22. As a visualizer user, I want transient reference emphasis to follow that source's entire path, so that I can inspect it without moving the diagram.
  23. As a visualizer user, I want sibling branches to retain their base appearance during emphasis, so that highlighting one reference does not select all aliases.
  24. As a visualizer user, I want a changed reference to leave its old group completely, so that stepping does not display a stale relation.
  25. As a visualizer user, I want hidden sources to leave no paint or description behind, so that filtering remains faithful.
  26. As a visualizer user, I want revisiting the same state to produce the same routing, so that direct seeking and sequential playback agree.
  27. As an integrator, I want connection selection and detachment to remain source-specific, so that sharing paint does not change connection identity.
  28. As an integrator, I want a surviving member to retain a complete route after another member is removed, so that shared paths have correct lifetimes.
  29. As a maintainer, I want optional optimization to fail atomically, so that an unsuccessful merge cannot corrupt other routes or hide a source.
  30. As a maintainer, I want bounded deterministic work and the existing performance budgets, so that dense diagrams do not acquire unpredictable stalls.
  31. As a maintainer, I want comparable baseline and proposed renderings, so that I can reject a mathematically valid but confusing convention.
  32. As a maintainer, I want routing diagnostics to explain why a merge was declined, so that a valid independent arrival is not treated as a failure.

Implementation Decisions

The following recommendations define the original implementation contract. Current implementation status, verification, and remaining enablement gates are recorded in the agent brief.

Identity and representation

  • Preserve one logical connection for each visible source-to-target relationship. Connection enumeration, selection, endpoint identity, source dots, and text descriptions continue to operate on logical connections.
  • Introduce a manager-owned scene plan separating complete logical routes from physical painted segments. Every physical piece records its member references, direction, exact target identity, and persistent style class. Every member has one continuous directed route to its original target.
  • Group only within the same visualizer and current rendered state, using resolved target identity and reference kind. Equal labels, equal contents, equal rectangles, and an unknown owner index do not establish identity. Missing usable identity disables grouping.
  • Partition further by persistent semantic style and compatible terminal approach. Active and inactive references remain separate. Match semantic classes rather than incidental RGB values; theme changes must not silently merge distinct meanings. Unknown or incompatible custom styles remain independent.
  • The initial optimizer excludes self-loops, reference return routes, frame-parent pointers, compact-string local arrows, inline string literals, nulls, and primitive values. A program cycle does not become a shared group. Ordinary forward references to an object involved in a cycle remain eligible if all other rules hold.

Visual and geometric contract

  • Retain distinct source stems until each branch reaches an explicit join outside source boxes and object bodies. Never route through another source dot.
  • Shared paths are directed and acyclic. No member reverses along a shared interval, splits after joining, or leaves and rejoins. A target may have several independent groups.
  • Use deliberate rounded T/Y convergence without adding a filled junction dot. Existing filled dots identify reference sources. Put the arrowhead only at the target boundary.
  • Protect each new join and its entire shared suffix from unrelated crossings or near contacts at maximum supported stroke width. Ordinary readable crossings remain available elsewhere.
  • Preserve all existing safety checks: text and compact-string paint clearance, permitted source departure, no source re-entry, target-boundary arrival, no passage through the target before arrival, rounded-curve checks, and head/shaft protection in both routing orders. Undeclared parallel segments retain their required separation.
  • Preserve existing source-exit preferences. A separate experiment may compare strict straight-route precedence with the existing bounded preference for right exits; that policy change is not silently included in merging.

Baseline and admission policy

  • First inventory existing coincident paths. The current renderer's vertical alias exemption and exhausted-search shared-head fallback are not a strictly separate baseline. Lift an existing overlap into shared ownership only if its full directed suffix satisfies the new invariants; otherwise separate or reroute it.
  • Establish a validated baseline containing either independent routes or explicitly owned valid suffixes. Retain historical output only as an internal comparison during development. Production fallback must never restore undeclared overlap while claiming the new contract.
  • Freeze unrelated route geometry while trying a merge. A candidate cannot move objects, alter text size, trigger additional layout repair, or degrade another reference merely to permit sharing.
  • Start with the conservative admission rule: every member's complete source-to-arrow-tip length and bend count are non-increasing; a clear direct route keeps its geometry; unique painted shaft length strictly decreases; painted arrowhead count decreases; crossing count, empty-body intersections, and scene bounds do not worsen. All safety and topology checks remain mandatory.
  • Per-reference length includes its full shared suffix; unique painted length counts shared geometry once. A reduction in heads alone is insufficient. Compare against the same frozen baseline, then validate compatibility with already accepted groups.
  • A possible later experiment may allow a small added detour or bend for an already bent reference. No new allowance is accepted here. Existing 24-pixel right-exit and 16-pixel arrival-corridor values do not establish a valid merge threshold.
  • If conservative admission produces no meaningful dense-scene benefit, retain the baseline and report that result. Adjust policy only with explicit comparative evidence rather than weakening a safety rule to make an example pass.

Candidate generation and transaction

  • Begin with exact valid suffix factoring and a one-confluence case to establish ownership and export behavior. The useful dense-case extension is one straight monotone shared spine with ordered branch joins and at most one terminal bend. General branching trees are deferred.
  • Reuse the measured geometry snapshot, existing attachment candidates, nearby baseline corridors, source reservations, and geometric validators. Search performs no DOM reads.
  • Sort candidates and source clusters canonically. Avoid enumerating every subset of aliases. The prototype uses a documented finite candidate family, initially capped at 24 spine profiles per compatible target/style/approach partition. That is a provisional work cap, not a measured performance claim; measure high fan-in and many-group workloads before enabling it.
  • Construct shared geometry once, including rounded portions; splice each logical branch into that canonical suffix. Validate at full precision. Coordinate snapping is limited to search hints.
  • Try each proposal in an isolated scene plan. It must not mutate live reservations, occupied heads, repairs, SVG, or caches. Revalidate the composed scene before commit. Reject a conflicting later group; if the final scene fails validation, restore the entire validated baseline.
  • Work limits are deterministic operation limits. Wall-clock time may be measured but must not choose a different diagram under machine load. Optimization exhaustion returns the validated baseline; baseline infeasibility follows the existing repair and explicit-diagnostic path.

Styling, lifecycle, and exports

  • Paint each shared base segment and terminal head once in the existing connector canvas. Preserve complete per-member route data for emphasis and behavioral assertions. Audit existing public connection element access before changing its meaning; preserve logical APIs and avoid duplicate visible full paths beneath a trunk.
  • Persistent style changes notify the manager and invalidate affected grouping, including color-only changes. Batch frame-style updates and include semantic classes, membership, geometry, and maximum base/hover width in the plan key.
  • Transient hover or emphasis changes paint, not grouping or geometry. Emphasize the selected source's branch and complete suffix, leaving sibling branches at base style. Incompatible custom emphasis semantics disable grouping for that combination. New mouse or keyboard picking UI is outside this feature.
  • Detaching a member removes its private paint and shared membership; remaining members retain complete paths. A final-member detach removes the shared paint. Reset, filtering, reappearance, container changes, and target reassignment invalidate all affected ownership. A one-member group becomes an ordinary route.
  • Preserve history-independent determinism: cold creation, redraw, insertion-order permutations, and restoration of the same state/settings produce equivalent plans and paint. Measure cross-step stability separately; do not add navigation-history hysteresis.
  • Existing native export and painted-bounds handling include shared segments, heads, and emphasis. Text descriptions continue to enumerate visible source relationships independently of the physical path count. Junctions do not become described heap objects.

Delivery sequence and broader routing work

  1. Capture current examples and controlled performance data; classify implicit overlap and record semantic expectations. Add failing external-behavior cases for lost references, false joins, style mixing, and stale ownership.
  2. Introduce explicit logical/physical ownership and safe baseline handling, preserving existing geometry wherever it meets the contract. Verify lifecycle, style transitions, and native exports before introducing optimization.
  3. Add exact suffix factoring, then the bounded spine candidates and transactional admission rule. Demonstrate both a small alias case and a dense aligned-source case with fewer heads and strictly less unique paint.
  4. Review representative baseline/proposed exports before automatic enablement. Initially keep the candidate policy internal to development; no public mode or CLI option is required by this spec.
  5. Evaluate broader routing improvements as separately reviewable increments: canonical lane and target-port ordering for interleaved references, a bounded local improvement pass for avoidable crossings or long detours, and the straight-versus-right-exit policy experiment. Each must preserve semantics, documented clearance, fixed-state determinism, and performance budgets. Do not combine them into the merge change's acceptance result.

Testing Decisions

The user-confirmed primary acceptance seam is small trace plus public visualizer creation, observable rendered relationships, and native SVG/PNG output. This is the highest existing seam that catches presentation, styling, descriptions, and export integration together. Extend the existing production-manager replay of measured DOM rectangles as the fast supporting seam for geometry and lifecycle cases. Introduce no second renderer or parallel mock routing implementation.

Good tests assert externally meaningful behavior: each visible source still reaches its expected object; no unrelated source gains a false target; selected paint follows only the requested branch and suffix; descriptions retain every source; and exports contain complete paint. Tests should not prescribe exact path command strings, private candidate order, or one internal routing algorithm. A test that reads membership labels alone is insufficient: check actual geometric continuity and directed shared-path topology as well.

Test the visualizer/connector manager, rendered description, and native export/bounds integration. Prior art already exists for public create-based description tests, manager geometry replay, source/shaft clearance, deterministic redraw, filtering, SVG primitives, and browser export cropping. Adapt the old blanket distinct-alias-head assertion only for declared valid sharing; retain its source-dot and identity checks.

Required scenario families:

Family Required cases and observations
Aliases and identity Two, three, twelve, and high fan-in references; several groups to one target; equal-looking different objects; coincident rectangles; missing identity. Preserve every source and exact target.
Geometry Opposite approaches; blocked corridor; direct route beside a detour; interleaved targets; branch near foreign source dot/head; crossing at a proposed join; fractional coordinates; rounded corners. Reject unsafe merges without damaging baseline routes.
Data structures Locals plus fields; repeated fields; horizontal/vertical/nested arrays; shared inner arrays; map keys and values; self-loop plus external aliases; two- and three-node cycles.
Presentation Active/inactive frames; base-style changes and restoration; normal/wide hover; light/dark themes; default/compact/inline strings; nulls; long text; narrow layouts; frame-parent pointers.
Lifecycle Connect order permutations; repeat redraw; cold reconstruction; detach first/last member; batch detach; reset; filter to zero/one members; reveal; reassign a reference; forward/back/direct-seek state restoration.
Exports and comprehension Native SVG and PNG; reopening standalone SVG; native and 50% display size; monochrome; all four crop edges; descriptions; no duplicate shared paint. Ask readers to trace a named source, identify aliases, count source locations versus objects, and distinguish reassignment from object mutation.

Use the existing controlled browser protocol and preserve its published comparison budgets: representative p95 full redraw at most 16 ms; the 48-object/108-reference scene p95 full redraw at most 50 ms; maximum of six fresh warm-asset layouts at most 300 ms. Record browser, hardware, viewport, assets, and sampling. Add high-indegree and many-small-group cases, plus actual state/style transitions, reported separately because the existing harness does not measure full transition latency. Memoization must match cold computation for the same input.

Run the repository's required checks for the eventual code change, including focused geometry, frontend, native SVG/PNG, documentation, and complete required verification. This planning exercise has not run those production checks or established runtime acceptance.

Automatic enablement requires passing semantic/geometry/lifecycle/export checks, controlled performance evidence, zero unsupported independent-or-explicitly-shared baseline cases in the accepted supported corpus, and documented maintainer review of baseline/proposed pairs. Every accepted corpus scene must retain a valid baseline; explaining a new routing failure is not sufficient. Explicit diagnostics remain appropriate for newly encountered infeasible scenes. Simulated agent interviews are design review, not student research. They do not establish improved learning, universal readability, or accessibility conformance. A learner study is appropriate before making those stronger claims.

Out of Scope

  • Changing tracer output, heap identity, reference semantics, object layout algorithms, or string presentation contracts.
  • Forcing every reference to one target through one arrowhead; general spatial bundling across different targets.
  • Arbitrary target-wide Steiner trees, a replacement routing engine, or global optimality guarantees.
  • Merging self-loops, return paths, parent-frame pointers, or compact-string local arrows in the first release.
  • A global crossing bridge/gap notation, new source-picking UI, manual routing editor, or public routing-mode API.
  • History-dependent routing, promised pixel stability across different states, shrinking text, or moving objects solely to create a merge.
  • Claiming empirical pedagogical benefit from simulated interviews or geometric metrics.

Further Notes

The independent reviewers agreed on exact target identity, explicit physical ownership, multiple groups per target, preserved source stems, deterministic computation, and static-export correctness. Challenges changed the proposal in material ways:

  • A broad crossing-notation rewrite became a protected local merge region, retaining existing ordinary crossings elsewhere.
  • Coincident per-reference paths were rejected in favor of single-owned physical paint and preserved logical connections.
  • A one-junction-only design became an ownership milestone followed by bounded monotone spines for dense sources.
  • The suggested added-detour allowance was tightened to non-increasing per-source length and bends for the initial experiment.
  • An apparently safe independent-route fallback was corrected after inspecting existing implicit alias overlap. Production fallback now requires a validated independent-or-explicitly-shared baseline.
  • The strongest objection remains educational: one arrowhead may cause learners to undercount source locations. This is why static task review precedes automatic enablement.

Primary-source research supports staged routing, explicit directed connectivity, and bounded heuristics, with important applicability limits. These diagrams retain ordinary crossings, so they are not being claimed as general confluent drawings. See Orthogonal Connector Routing, Further Towards Unambiguous Edge Bundling, and Orthogonal Hyperedge Routing. The local crossing-free merge region and candidate admission rule are engineering recommendations, not results proved by those papers.

Review evidence: three independent simulated expert reviews covered primary-source research; teaching, accessibility, and static exports (25 scenarios); and architecture, geometry, lifecycle, and performance (25 adversarial cases). Each review was developed independently, then challenged in follow-up rounds. The teaching and architecture reviewers checked the final synthesis. Their consequential findings and resulting changes are summarized above. These are design reviews, not empirical student studies. Hand-authored conceptual illustrations were inspected separately; no production routing change, rendering benchmark, or application validation was performed during specification preparation.

Current source contracts:

The current-state inspection found no repository domain glossary or routing ADR. This spec follows existing terms: source/value box, reference, target, heap object, frame-parent pointer, logical connection, route, shaft, head, and native export. Shared segment, join, and spine refer only to painted geometry.

Activity

  1. added
    ready-for-agent
    enhancement
    on Oct 21, 2026
  2. mepcotterell commented on Oct 21, 2026

    @mepcotterell
    ContributorAuthor

    This was generated by AI during triage and updated with implementation status on 2026-10-22.

    Agent Brief

    Category: enhancement

    State: ready-for-agent — optimize both stress cases to the maintainer-approved 300 ms fresh-layout limit; visual review remains pending.

    Summary: Implement selective sharing of terminal reference paths while preserving every source-to-object relationship, and evaluate broader routing improvements in separate, reviewable increments.

    This brief is the implementation contract. The issue body records research and design rationale. Automatic production enablement requires all acceptance gates below.

    Coordinator integration and current acceptance — 2026-10-22

    PR #28 now depends on PR #29 — Separate layout coordination from connector routing. Its base is mepcotterell/layout-coordinator; the coordinator is also an actual ancestor of the combined source. Current pushed heads: coordinator 9b9eebe4b61ac9df5b8b276b3a5f53b635d370d4, combined routing 01eb6cfd684fa243ea8030bdf45ae88ffc7cb640. See the complete step-5 verification record.

    Criteria 19, 20, and 22 remain open. Historical routing remains the production default. The coordinator separates measured-scene routing from resizing, movement, bounded repair, canvas allocation, rollback, and paint. Independent stack/global and heap models retain the legacy placement policies. Global rearrangement and temporal optimization remain future proposals.

    Current controlled performance

    All 14 cases ran under both controlled policies using the original policy-switch protocol: six fresh public creations with warm assets, historical initialization, policy selection, font readiness and final redraw; five warmups; 40 repaints and 40 full redraws. Apple M2 Pro / 32 GiB / macOS 26.7.1, Electron 44.9.3 / Chromium 152.0.7977.167, 1536×960. No agent test/build/native-capture process overlapped timing. Browser-fetched bundle hashes matched clean runtime revision c688db7adc28e74139d6bed98ff3113578d7d755. The final two-file documentation-only merge changes no runtime/input/test/bundle bytes.

    Maximum fresh layout Independent Shared Required maximum
    dense-48 263.9 ms 237.3 ms ≤300 ms
    fan-in-48 422.1 ms 411.3 ms ≤300 ms
    many-groups-12x4 1596.2 ms 1559.2 ms ≤300 ms

    Both added stress cases still fail under both policies. The unchanged raw-sample checker exits 1 for these four failures. All 28 controlled baselines are valid and restored-state path checks pass. Representative full-redraw p95 is ≤1.1 ms independent / ≤1.2 ms shared (limit 16); dense-48 is 9.6 / 11.3 ms (limit 50). State/style transition measurements remain separate. No elapsed-time cutoff or initial-policy result replaces the original acceptance protocol. This run does not establish a broad performance improvement over the preceding feature revision.

    Correctness and native review

    • Combined runtime revision c688db7 passes the production build and 367 frontend tests in 27 files locally. Its completed CI run passes JDK 21/25, 693 Python tests with 100% coverage over 2,094 statements, frontend tests/build, wheel checks, and 34 Java examples / 415 images on JDK 25.
    • A clean local combined package contains 31 native PNG/SVG pairs plus one standalone-SVG viewport screenshot / 63 files. All 35 recorded source/bundle/input hashes match disk and Git; all export hashes match. Native PNG/SVG dimensions agree, every native PNG edge has at least 4 px padding, all controlled baselines are valid, and reassignment/mutation/restoration checks pass. CI also provides downloadable shared-reference and layout-coordinator review packages.
    • Compared with the retained preceding-feature benchmark, 26/28 complete logical-route signatures match exactly. cycle-default has subpixel differences under both policies. The new coordinator native before/after comparison also has measured pixel/route differences; policy preservation does not imply pixel equality. Maintainer visual approval remains pending.
    • Coordinator regressions found during verification were fixed: unique frame DOM IDs, final intrinsic content before routing, passive navigation observation, and synchronous live filters during the initial height callback. Static review findings were resolved within their frozen reviewed scopes; they are not runtime or maintainer approval.
    • Coordinator runtime revision 7271983 separately passes 686 Python tests / 100% coverage, 300 frontend tests, 9 focused native/navigation tests, and 34 Java examples / 415 images. Its main-only 11-case comparison is separate evidence: dense-48 maximum 222.8 ms and redraw p95 15.8 ms. It cannot substitute for the controlled stress gates above.

    Final-head CI is complete and successful: PR #29 / 9b9eebe and PR #28 / 01eb6cf passed Markdown, lint/types, JDK 21/25 frontend builds/tests, Python tests/100% coverage, wheel checks, and JDK 25 examples. Final counts are 686 Python / 300 frontend for the coordinator and 693 Python / 367 frontend for the combined branch. Each JDK 25 job produced 415 images across 34 examples. Linux CI reports 2,094 covered statements; the coordinator's local macOS result above reports 2,091. Release jobs were skipped.

    Downloaded final-head review artifacts are available: coordinator, combined coordinator, and combined shared references. The manifests record clean CI merge refs 588fb5b20bbae6f09f75318da914d4d4758db517 and baec40b0630363268bfcae29eb7783a0810192bb. All 74 coordinator, 76 combined-coordinator, and 35 shared-package input hashes match the current respective working-tree files; both coordinator manifests pass all seven checks and the shared package records 31 valid-baseline pairs. CI artifacts are separate captures and are not claimed pixel-identical to local macOS output.

    Earlier local runtime evidence retains its original immutable revision and is not relabeled as a new capture.

    Next action: review the native before/after/state examples and record the maintainer's source-to-object traceability decision for criterion 19. Continue targeted profiling and reduction of high-fan-in and many-group startup work, including historical initialization, until both policies meet the original 300 ms maximum. Criterion 20 remains failed and criterion 22 remains held. No main merge, release, issue closure, default enablement, or maintainer approval is implied.

    Pre-implementation behavior (historical baseline):

    Source inspection at commit b6b2e2b9a0593662ac336016706809151cfa1c04 found individual logical connections with their own painted paths and arrowheads. The router already permits some same-target vertical overlap and an exhausted-search shared-head fallback. Those exceptions do not provide explicit shared-segment ownership, validated directed convergence, or shared lifecycle management. Color-only persistent style changes currently update paint without the regrouping this feature requires.

    The redundancy review covered the connector manager, route orchestration, same-target shaft clearance, target-head allocation, connection styling and detachment, description generation, export integration, and existing routing tests. No implementation of this complete contract or matching prior rejection was found. This is an enhancement verified by source inspection, not a reproduced runtime defect. That inspection preceded implementation. Recorded verification and outstanding acceptance gates are summarized above.

    Desired behavior:

    Compatible references to the exact same object may share one explicitly owned final path and arrowhead when doing so measurably simplifies the drawing without making any member harder to follow. Every source retains its value box, source dot, distinguishable initial branch, logical identity, and complete directed route to the original target. A join is a drawing convention, never an additional heap object or reference location.

    Sharing is selective: a target can have multiple groups and independent arrivals. Preserve clear direct routes and ordinary readable crossings away from shared regions. If no eligible proposal improves a validated baseline, retain that baseline and report the reason. Do not weaken correctness to produce a merged example.

    Key interfaces:

    • Logical connections and the connector manager: enumeration, selection, source/target identity, per-source element access, detachment, and reset retain their logical meaning. Physical segments carry explicit member sets, direction, target identity, and persistent style independently of logical connection count.
    • Scene routing and geometry validation: consume one measured geometry snapshot and produce complete logical routes plus single-owned physical paint. Optional optimization is an atomic scene transaction with a validated fallback.
    • Persistent style and transient emphasis APIs: persistent changes, including color-only changes, can invalidate grouping; transient emphasis changes paint without changing geometry or membership.
    • Public visualizer creation and native SVG/PNG exports: expose the same correct relationships, complete paint, bounds, and source descriptions as the interactive diagram.
    • Existing production-manager geometry replay: remains the fast supporting test seam, using the production renderer rather than a parallel mock routing implementation.

    Acceptance criteria:

    1. Identity and eligibility. Group only references in the same visualizer and rendered state with an exact resolved target identity, the same reference kind, compatible persistent semantic styles, and compatible terminal approaches. Equal labels, contents, rectangles, colors, and unknown owner indices cannot establish identity. Missing usable identity disables grouping. Active and inactive references remain separate; unknown or incompatible custom styles remain independent. Theme changes cannot collapse distinct semantic meanings.
    2. Initial exclusions. Self-loops, reference return routes, frame-parent pointers, compact-string local arrows, inline string literals, nulls, and primitives retain their existing presentation and do not enter shared groups. Ordinary forward references to an object participating in a cycle may qualify; the cycle itself does not become a group.
    3. Source traceability. Every visible source retains its own dot and distinguishable stem until a deliberate join outside source boxes and object bodies. No route passes through another source dot. A reader can follow each source to its actual target in a static export without hover or color as the sole cue.
    4. Directed topology and paint. Each member follows one continuous directed route after joining: no reversal, split, departure and rejoin, or physical cycle. Use rounded T/Y convergence without a filled junction dot; the arrowhead stays at the target boundary. Construct shared rounded geometry once and paint each shared base segment and terminal head once, without duplicate visible full member paths underneath. Verify actual geometric continuity and direction, not membership metadata alone.
    5. Clearance and crossings. Protect every new join and its entire shared suffix from unrelated crossings and ambiguous near contacts at the maximum supported base/emphasis stroke width. Preserve ordinary readable crossings elsewhere, required separation for undeclared parallel routes, text and compact-string clearance, permitted source departures, no source re-entry, target-boundary arrival, no premature target passage, rounded-curve clearance, and head/shaft protection in both routing orders.
    6. Valid baseline. Classify existing coincident routes. A baseline contains independent paths or explicitly owned shared suffixes satisfying the full contract. Existing implicit overlap can be retained only after it qualifies for explicit ownership; otherwise separate or reroute it. Historical undeclared overlap is an internal comparison, never a production fallback presented as compliant. Baseline infeasibility uses the existing repair and explicit-diagnostic path.
    7. Conservative admission. Against the same frozen validated baseline, every member's complete source-to-arrow-tip length and bend count are non-increasing; a clear direct route retains its geometry; unique painted shaft length strictly decreases; and painted arrowhead count decreases. Crossing count, empty-body intersections, and scene bounds do not worsen. Per-member length includes the entire shared suffix; unique paint counts shared geometry once. Fewer heads alone do not qualify. Existing source-exit preferences remain intact; no new detour or bend allowance is introduced.
    8. Unaffected geometry. Optional sharing freezes unrelated routes and cannot move objects, shrink text, trigger extra layout repair, or degrade other references to create space for a merge. Validate each proposal against previously accepted groups as well as its baseline.
    9. Bounded candidate family. Establish explicit ownership and export behavior with exact valid suffix sharing and a one-confluence case; extend useful dense-case coverage to one straight monotone spine with ordered joins and at most one terminal bend. Candidate and cluster ordering are canonical, with no exhaustive subset enumeration. Document a finite search family, initially capped at 24 spine profiles per compatible target/style/approach partition. This is a provisional operation cap, not a performance claim.
    10. Precision and atomicity. Candidate search performs no DOM reads and reuses measured geometry, attachment candidates, baseline corridors, reservations, and validators. Validate canonical geometry at full precision; coordinate snapping supplies search hints only. Proposals cannot mutate live reservations, occupied heads, repairs, SVG, or caches before acceptance. Revalidate the composed scene before commit, reject conflicting later proposals, and restore the entire validated baseline if final validation fails. Deterministic operation limits, rather than elapsed time, choose the result; optimization exhaustion returns that baseline.
    11. Persistent styles. Base-style changes, including color-only changes and restoration, invalidate affected groups. Batch frame updates. Cached plans account for semantic styles, membership, geometry, and maximum supported base/emphasis width. Audit existing public element access and preserve its logical contract when physical paint becomes shared.
    12. Transient emphasis. Selecting or emphasizing one reference paints its private branch and complete shared suffix while sibling branches retain base appearance. Geometry and grouping do not move. Incompatible custom emphasis semantics disable the affected grouping. No new picking interface is required.
    13. Lifecycle. Detach removes the member's private paint and ownership while preserving remaining complete routes; a final-member detach removes shared paint and a one-member group becomes ordinary. Batch detach, reset, filtering to zero/one members, reveal, reappearance, container changes, and target reassignment leave no stale paint, membership, or descriptions.
    14. Determinism. Cold creation, repeated redraw, insertion-order permutations, reconstruction, and forward/back/direct-seek restoration of the same state and settings produce equivalent plans and paint. Memoized results match cold computation. Measure cross-step stability separately; no history-dependent hysteresis or promise of identical geometry across different states.
    15. Exports and descriptions. Native SVG/PNG include all shared segments, heads, and supported emphasis within painted bounds, including every crop edge. Standalone SVG reopens correctly. Text descriptions enumerate every visible source relationship independently of physical path count, without inventing junction objects or duplicating heap objects.
    16. Primary acceptance seam. Use small traces through public visualizer creation, observable rendered relationships, and native SVG/PNG exports as the primary acceptance seam, as confirmed by the maintainer. Support these with existing fast production-manager measured-geometry replay. Tests establish each source's actual target, absence of false targets, selected-path behavior, description completeness, and uncropped output. Do not prescribe exact path command strings, private candidate order, or one internal algorithm.
    17. Identity and geometry corpus. Cover two, three, twelve, and high fan-in aliases; multiple groups per target; equal-looking distinct objects; coincident rectangles; missing identity; opposite approaches; blocked corridors; a direct route beside a detour; interleaved targets; foreign dots/heads near branches; crossings at proposed joins; fractional coordinates; and rounded corners. Unsafe candidates leave the validated baseline intact. Replace blanket distinct-alias-head expectations only for declared valid sharing, retaining source-dot and identity checks.
    18. Structure and presentation corpus. Cover locals with fields, repeated fields, horizontal/vertical/nested arrays, shared inner arrays, map keys and values, self-loops with external aliases, two-/three-node cycles, active/inactive frames, persistent style transitions, normal/wide emphasis, light/dark themes, default/compact/inline strings, nulls, long labels, narrow layouts, and frame-parent pointers. Exercise all lifecycle and restoration cases above through the appropriate acceptance seams.
    19. Visible benefit and static review. Produce baseline/proposed native exports for both a small alias scene and a dense aligned-source scene showing fewer heads and strictly less unique paint under the admission rule. Inspect native and 50% display sizes, monochrome, themes, and narrow layouts. Review tasks include following a named source, identifying aliases, counting source locations versus objects, and distinguishing reassignment from object mutation. If meaningful benefit cannot be demonstrated, retain the validated baseline, report the limitation, and leave automatic enablement off.
    20. Controlled performance. Use the existing controlled browser protocol and record browser, hardware, viewport, assets, and sampling. Retain representative p95 full redraw at most 16 ms, 48-object/108-reference p95 full redraw at most 50 ms, and the maximum of six fresh warm-asset layouts at most 300 ms. Apply the same maximum-of-six fresh-layout limit of 300 ms to both added stress cases, fan-in-48 and many-groups-12x4, as required by the maintainer on 2026-10-21; report state/style transition latency separately from redraw measurements. Measure the provisional candidate cap before enabling it.
    21. Repository verification. Run the required checks for the final implementation, including geometry/frontend, Python/native export integration, documentation, full repository verification, and required Java example coverage. Report actual commands, outcomes, and retained rendered/performance evidence; planning checks and conceptual drawings do not count as implementation acceptance.
    22. Enablement gate. Keep the candidate policy internal to development until semantic, geometry, lifecycle, export, and performance checks pass; every scene in the accepted supported corpus has a valid independent-or-explicitly-shared baseline; and the maintainer's review of baseline/proposed pairs is documented. No unsupported baseline scene in that corpus is acceptable merely because it has a diagnostic. Diagnostics remain appropriate for newly encountered infeasible scenes. A controlled implementation may be ready for review while production enablement remains pending; report those statuses separately.
    23. Broader routing evaluation. Evaluate canonical lane/target-port ordering for interleaved references, a bounded local pass for avoidable crossings or long detours, and strict straight-route precedence versus the existing bounded right-exit preference as separately reviewable increments. Record comparative evidence and adopt/defer conclusions. These experiments preserve semantics, clearance, determinism, and performance budgets; their outcomes cannot be bundled into the shared-path acceptance claim. This brief does not require enabling all three policies.
    24. Diagnostics and claims. Explain why candidate merges were declined so valid independent arrivals are not treated as failures. Distinguish measured routing/export results, maintainer visual judgments, and remaining evidence gaps. Simulated expert reviews are design review, not student research or proof of improved learning, universal readability, or accessibility conformance.

    Out of scope:

    • Changes to tracer output, heap identity, reference semantics, object layout algorithms, or string presentation contracts.
    • Forcing all references to a target into one group; sharing across different targets; general branching/Steiner trees; replacement routing engines; global optimality guarantees.
    • Initial sharing of the excluded relation kinds above; a new detour allowance; silently changing source-exit preferences with the merge implementation.
    • Global crossing bridge/gap notation, source-picking UI, manual routing editors, or a public routing-mode API/CLI option.
    • Navigation-history-dependent routing, text shrinkage, or moving objects solely to enable sharing.
    • Treating this triage decision or prior conceptual diagrams as production validation, or making empirical teaching/accessibility claims without the corresponding research.
  3. added
    ready-for-human
    ready-for-agent
    and removed
    ready-for-agent
    ready-for-human
    on Oct 21, 2026
  4. mepcotterell commented on Oct 22, 2026

    @mepcotterell
    ContributorAuthor

    This work now depends on PR #29 — Separate layout coordination from connector routing: #29.

    PR #29 starts from main and owns the approved five-step algorithm audit, literature research, interface comparison, bounded coordinator implementation, and verification. PR #28 is stacked on its branch, mepcotterell/layout-coordinator. Issue #27 remains blocked by both prerequisite coordination and the shared-routing acceptance work.

    Existing source-to-object semantics, the 300 ms stress limits, native visual review, and historical production default remain in force. Coordinator extraction alone does not establish a performance improvement or close acceptance criteria 19, 20, or 22.

    GitHub's native issue-dependency API rejected a pull request as a dependency target (422: Target issue may only be an issue); PR #28 also cannot be a source issue for that API. The relationship is recorded through the PR base, explicit body links, and these reciprocal conversation references. No native issue-dependency record is claimed.

    After each of the five plan steps, PR #29 will receive a completion comment with results, decisions, verification limits, and records carried forward.

  5. mepcotterell commented on Oct 22, 2026

    @mepcotterell
    ContributorAuthor

    The coordinator prerequisite is implemented in PR #29, and its source is integrated into dependent PR #28. Current pushed heads are coordinator 9b9eebe4b61ac9df5b8b276b3a5f53b635d370d4 and combined routing 01eb6cfd684fa243ea8030bdf45ae88ffc7cb640. PR #28 targets the coordinator branch and contains that head as an actual ancestor; both PRs are linked as a stack. Issue #27 remains dependent on both. GitHub's native issue-dependency API rejects PR targets, so the base, ancestry, body links, and comments record this relationship.

    All five research/design/implementation/verification steps have comments on PR #29. The step-5 record contains the complete results, all 14 controlled cases, fresh stress samples, native-output differences, immutable evidence heads, and limitations. The acceptance brief is updated.

    The coordinator runtime passes 686 Python tests with 100% coverage, 300 frontend tests, and 34 Java examples / 415 images. Combined runtime CI passes 693 Python tests with 100% coverage, 367 frontend tests, examples, and both native review packages. The final commits change only two research-note statements. Final-head CI for PR #29 and PR #28 has now passed both JDK 21/25 jobs, builds, wheel checks, examples, and native artifact generation. PR #29 is ready for review; PR #28 remains draft.

    Acceptance is unchanged: criterion 19 needs documented maintainer review. Criterion 20 still fails the original maximum-of-six 300 ms startup gate: independent/shared fan-in-48 is 422.1/411.3 ms, and many-groups-12x4 is 1596.2/1559.2 ms. Dense-48 and the redraw budgets pass; all 28 controlled baselines are valid. Criterion 22 stays held, historical routing stays default, and PR #28 stays draft. No main merge, release, issue closure, or maintainer approval is implied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions