Skip to content

Add controlled shared-reference routing - #28

Draft
mepcotterell wants to merge 12 commits into
mepcotterell/layout-coordinatorfrom
mepcotterell/merge-arrows-routing
Draft

mepcotterell wants to merge 12 commits into
mepcotterell/layout-coordinatorfrom
mepcotterell/merge-arrows-routing

Conversation

@mepcotterell

@mepcotterell mepcotterell commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Depends on: PR #29 — Separate layout coordination from connector routing. This PR targets mepcotterell/layout-coordinator and contains that head as an ancestor.

Summary

Repeated reference shafts and arrowheads can crowd a shared target. Controlled terminal-path sharing preserves each source's identity, dot, complete logical route, description, and interaction behavior while painting accepted shared intervals and heads once.

historical policy (production default)
controlled independent → validated independent/owned baseline
controlled shared → baseline → bounded compatible proposals
  exact target + semantic style + strict improvement + final validation
  → owned shared paint; otherwise retain the baseline

The integrated coordinator owns placement, measured geometry, bounded repairs, rollback, canvas allocation, and final paint. Routing remains pure over scene data. Optional sharing cannot move objects or degrade member routes to create a merge. Independent stack/global and heap strategy seams preserve the existing placement policies. Includes regenerated bundles, lifecycle/export regressions, benchmark tooling, and both native CI review packages. Refs #27.

Evidence

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.

Merge Danger

Door: two-way

Historical routing stays the production default. This PR remains draft while visual review and stress startup gates are open.

Blast Radius: rendering

Placement coordination, route planning/painting, reference lifecycle and native exports are affected. Preserved policy is not a claim of pixel-identical output; review the recorded native differences.

Preserve logical references while sharing compatible terminal geometry under an internal policy. Add strict baseline validation, owned suffixes, lifecycle handling, native SVG/PNG coverage, and routing benchmarks.

Keep historical routing as the production default pending performance acceptance and maintainer visual review. Refs #27.

mepcotterell commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Current execution status

Latest optimization — 2026-10-22

Committed and pushed at 971e893 on draft PR #28. Criteria 19, 20, and 22 remain open. Historical routing remains the production default.

Profiling the preceding revision found repeated full-suffix scans during candidate ranking. Departure classification now stops at the first nonzero control step and is computed once per candidate; length ranking avoids computing unused bend metrics. The exact length sum, right-exit preference, candidate tie order, geometry validation, and profile cap are preserved.

Matched rendered comparison

Both revisions used the same complete 14-case order, original policy-switch protocol, six fresh warm-asset public creations, five warmups, and 40 repaint/full-redraw samples. Hardware: Apple M2 Pro / 32 GiB / macOS 26.7.1; Electron 44.9.3 / Chromium 152.0.7977.167; 1536 × 960 CSS pixels. Public historical initialization, policy selection, and final redraw remain included. No agent builds/tests overlapped timing; ordinary desktop/security activity was present. Earlier three-case diagnostic runs and earlier browser versions are separate evidence.

Maximum fresh layout Before independent (431ecb1) After independent Before shared (431ecb1) After shared Gate
dense-48 262.7 ms 255.0 ms 278.9 ms 265.8 ms ≤300 ms
fan-in-48 503.1 ms 430.8 ms 451.2 ms 391.0 ms ≤300 ms
many-groups-12x4 1474.8 ms 1417.4 ms 1518.9 ms 1419.8 ms ≤300 ms

Shared high-fan-in maximum improved about 13.3% in this matched run. Both stress cases still fail 300 ms in both policies. Do not treat modest changes in the other cases as proof that their dominant costs are resolved. Representative p95 full redraw remains ≤0.8 ms independent / ≤0.7 ms shared (limit 16); dense-48 p95 is 7.8 / 7.5 ms (limit 50). The raw-sample budget checker returns nonzero for the remaining failures.

Correctness and native review

  • All 28 complete logical route/head signatures are exactly unchanged from the matched committed baseline; all controlled baselines and state-restoration checks pass.
  • A fresh clean-commit package contains 31 native SVG/PNG pairs and 63 export files. All 31 recorded source/bundle hashes match disk and Git; export hashes, dimensions, valid baselines, and ≥4 pixels of padding on every edge pass.
  • All 31 new PNGs are pixel-identical to the previous local macOS package. This is not a claim of pixel identity with a different-platform CI capture. The before/after native gallery was presented in the implementation thread; maintainer visual approval is still pending.
  • Regenerate the native package. The new CI run is in progress; current-head CI and its review artifact are not yet verified. Preparation/lint and Markdown checks have passed; both JDK test jobs remain pending/in progress.
  • make build-frontend passed (three existing size warnings); make check passed: 691 Python tests / 100% coverage (2091 statements), 323 frontend tests / 23 files, lint/types/docs.
  • JDK 25 make test-examples passed: 34 examples / 415 images, 55.59 seconds. Supporting replays passed 44 baseline/variant combinations per policy, with insertion-order equivalence and no sampled text hits or routing errors.
  • Alternative grid-line indexing, shared protected-paint indexing, and per-segment broad-phase queries were measured and reverted because they did not provide sufficient rendered benefit. They are not in this commit.

Next action: profile and reduce the remaining shared-scene validation and many-group visibility-search costs, including historical initialization, while preserving the original ≤300 ms maximum for both stress cases and the existing redraw budgets. Obtain documented maintainer review of final native pairs/state examples before any separately committed default enablement. No merge, release, issue closure, or maintainer approval is implied.


Agent Brief: complete remaining routing acceptance

Category: enhancement / performance
Original implementation baseline: d62bebd
Contract: Issue #27 implementation brief
Objective: Close acceptance criteria 19, 20, and 22 with isolated performance evidence, documented maintainer review of final rendered output, and verification of the eventual production default.

The controlled implementation and its recorded engineering verification are complete. Historical routing remains the production default. The remaining work proceeds in this order: establish trustworthy performance measurements, fix measured startup costs, obtain maintainer review of the final exports, then verify and enable production routing only after its gates are satisfied.

Starting evidence and open decisions

Criterion Remaining work Required closure evidence
19 — Visible benefit and static review Maintainer review of baseline/proposed pairs Recorded decisions on source tracing, alias recognition, source/object counts, joins versus crossings, and reassignment versus mutation
20 — Controlled performance Resolve startup cost and repeat the agreed protocol without competing workloads Complete source-bound results meeting the existing budgets
22 — Enablement Confirm all gates on the final candidate and exercise the production default Valid supported-corpus baselines, passing checks, performance acceptance, and documented maintainer approval

Existing diagnostic measurements show a 48-object/108-reference fresh-layout maximum of 332.8 ms independent / 330.2 ms shared, exceeding the 300 ms requirement. Shared p95 full redraw was 13.8 ms, within the 50 ms redraw budget. Shared fan-in-48 and many-groups startup reached 2389.0 ms and 12244.9 ms, respectively. Another project's CodeQL activity overlapped collection; the amount attributable to contention is unknown.

Native comparisons already demonstrate fewer heads and less sampled unique shaft paint against the same controlled independent baseline: 4 → 3 heads / 4.70% less shaft for the small scene, and 12 → 7 heads / 17.49% less shaft for the dense scene. Engineering inspection exists; maintainer paired-output approval remains pending.

Work sequence

1. Establish isolated performance results before changing the router

  • Use the committed implementation and an exclusive measurement window without overlapping builds, tests, Java examples, or CodeQL work. Inspect runtime activity and coordinate with other work; do not terminate another owner's processes.
  • Record browser, hardware, operating system, 1536 × 960 CSS viewport, source revision, bundle hashes, harness revision, and runtime activity.
  • Measure both controlled policies with the existing protocol: six fresh warm-asset layouts, five warmups, 40 repaints, and 40 full redraws. Measure state/style transitions separately.
  • Begin with dense-48, fan-in-48, and many-groups-12x4, then collect all 14 cases. Retain all completed samples and identify interrupted runs. An invalid baseline is a correctness failure, not a timing sample to omit.
  • Compare against the recorded diagnostic results. Determine whether the original implementation still misses the startup budget under isolated conditions.

Deliverable: Reproducible raw independent/shared reports and an environment record bound to the measured source and built assets.

2. Profile startup and optimize the dominant work

Collect browser profiles separately from acceptance measurements. Attribute cost to public creation, value layout/DOM measurement, baseline routing, optional shared-path planning, validation, painting, policy selection, and final redraw. Record search/candidate counts alongside time.

Investigate baseline construction and repeated work first: independent/shared startup costs are similar, and the recorded dense-48 run attempted no optional sharing profiles. This is a hypothesis to test, not an established cause.

Choose fixes from profiling. Candidates to examine include repeated searches for equivalent arrival geometry, repeated obstacle/reservation preparation, ownership validation, and redundant solves during initialization. Preserve full-precision clearance, exact identity, canonical ordering, deterministic work limits, conservative admission, atomic fallback, and lifecycle behavior.

For each fix, retain a focused before/after profile and run relevant geometry, lifecycle, and native-export checks. If changes touch cache isolation or transaction handling, add behavioral regressions where they close a real gap, including cross-visualizer isolation or forced whole-scene rollback when applicable.

Deliverable: Small reviewable performance commits with measured attribution and correctness evidence.

3. Close criterion 20 under the original protocol

Rebuild final assets and run the complete isolated comparison.

Existing metric Required result
Representative fixtures: p95 full redraw ≤16 ms
48 objects / 108 references: p95 full redraw ≤50 ms
48 objects / 108 references: maximum of six fresh layouts ≤300 ms

Keep the original policy-switch measurement as the gate. Report the initial-policy experiment separately; it cannot replace a failure under the agreed method. Report state/style transition latency separately from redraw.

Stress-case decision — settled 2026-10-21: apply the original ≤300 ms maximum of six fresh warm-asset layouts to both fan-in-48 and many-groups-12x4. Optimize and verify both with the original policy-switch protocol. Do not omit these cases or replace that protocol with initial-policy measurements. The current shared maxima of 2246.9 / 2081.1 ms fail this gate.

Deliverable: Final performance report with per-case results, valid-baseline status, all samples, comparisons, environment/provenance, and the stress-case decision.

4. Publish the final visual review package and close criterion 19

Generate the package from the same source/bundles that passed performance acceptance. Make it accessible to the maintainer; local ignored artifacts alone are insufficient.

Include paired controlled-independent/shared SVG and PNG output for small/dense aliases, plus theme, monochrome, reduced-size, narrow-layout, emphasis, reassignment, mutation, and restoration examples. Bind the package to its commit and bundle hashes.

Provide a short review task sheet:

  1. Follow named sources to their actual objects.
  2. Identify which source locations alias the same object.
  3. Count source locations and heap objects independently.
  4. Distinguish joins from ordinary crossings.
  5. Explain reassignment versus object mutation from the static states.

Record maintainer approval or concrete objections in the issue/PR. Address confusing geometry and regenerate affected evidence before the final decision. Explicitly show tiny labels at 50% and the long-label narrow export that expands beyond its input container. This review supports acceptance of the drawing convention for the recorded corpus; it does not establish student-learning or universal readability/accessibility outcomes.

Deliverable: Accessible, source-bound review package and a documented maintainer decision. Criterion 19 stays open until that decision is recorded.

5. Verify the final candidate, then close criterion 22

After performance changes and visual decisions are settled:

  • Rebuild and run make check and the required JDK 25 Java example coverage.
  • Regenerate affected native exports and confirm every supported corpus scene has a valid independent-or-explicitly-shared baseline. A diagnostic does not excuse an invalid accepted-corpus scene.
  • Verify identity, semantic styles, emphasis, detach/filter/reset, restoration, descriptions, and painted export bounds against final assets.
  • Ensure the performance and visual evidence applies to that exact candidate. If later changes affect measured behavior or approved output, refresh the affected evidence.

After the required performance acceptance and maintainer visual approval are documented, make production enablement a separate small commit. Exercise public visualizer creation and native SVG/PNG generation with sharing selected by default, including startup through that actual default path. The default-path measurement supplements the original acceptance protocol. Retain a straightforward way to revert the default.

Record the final acceptance decision, update the issue checklist and PR description, and make this PR ready for review when the gates are complete.

Deliverable: Final acceptance record bound to the enabled commit, passing applicable checks/CI, and explicit closure evidence for criteria 19, 20, and 22.

Constraints

  • Preserve the existing source-to-object semantics, object layout contract, source-exit preferences, exclusions, and optional-sharing admission rules.
  • Keep broader target-first, port-ranking, straight-first, and local-improvement experiments outside this completion work unless a separate scope decision is recorded.
  • Do not relax budgets or clearance to obtain a pass, silently substitute benchmark methods, or treat the profile cap as performance acceptance.
  • Maintain historical routing as default while gates remain open. The outstanding maintainer judgment cannot be supplied by simulated agent review.
  • This brief adds no release, deployment, public routing-mode option, or empirical teaching/accessibility claim.

Starting points

Batch value sizing to avoid repeated table layout, construct fixed object rows directly with literal field text, and reuse collision and visibility-search work without changing route selection.

Retain exact validators and the historical production default. Add broad-phase, sizing, and untrusted-field regressions. Refs #27.
Retain raw benchmark samples, timestamps, and geometry signatures. Add a reproducible 31-pair native SVG/PNG review package with provenance and publish it from the JDK 25 PR job.

Keep maintainer visual approval and stress startup acceptance explicit before production enablement. Refs #27.
Reuse scene-scoped geometric checks for large owned cohorts, bound common quadratic corner lengths analytically, and preserve lazy departure validation. Keep exact ownership and clearance checks and preserve all 28 measured controlled route geometries.

Apply the 300 ms fresh-layout limit to both stress cases with a raw-sample budget checker. Historical routing remains default because the stress gates are still unmet.
Profiling showed candidate sorting scanning full suffixes to recover departure direction and computing unused bend metrics. Determine the first nonzero control step once per candidate and calculate only the length needed for ranking, preserving its sum and tie order.
@mepcotterell
mepcotterell changed the base branch from main to mepcotterell/layout-coordinator October 22, 2026 08:49
@mepcotterell

Copy link
Copy Markdown
Contributor Author

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.

Keep measured-scene routing pure and coordinator-owned repair, rollback, and final paint. Preserve controlled sharing, indexed graph queries, both review packages, and the original performance acceptance protocol. Add source integration assertions without running them.

Source integration only: generated bundles retain the coordinator baseline and require a parent-owned rebuild. No tests, builds, type checks, Java, browser, or benchmarks run in this checkout.
Merge dfaa8db as an actual ancestor, retaining transaction-local complete-candidate reuse and both upstream canvas regression cases. Resolve the planner call with controlled-policy forwarding.

Keep generated bundles at the original coordinator baseline pending the parent's combined-source rebuild. No runtime validation performed in this checkout.
@mepcotterell

mepcotterell commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

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.

@mepcotterell
mepcotterell added this pull request to stack #31 November 12, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant