Skip to content

Backlog cleanup: Vega-Lite negative lag/lead, Mermaid u/ins underline and flowchart nesting limit, cross-platform flatten links, mermaid pin and docs-job Node removal - #135

Merged
Malcolmnixon merged 8 commits into
mainfrom
chore/backlog-cleanup
Nov 12, 2026

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

Pull Request

Description

This is a batch of small backlog fixes, one commit each. Two of them were real bugs (items 6 and 7).

  1. Vega px workaround removed (tools/visual-diff/render-vega.mjs): since SVG: convert every length unit, accept font-size units, keywords and the font shorthand (SVG 2 / CSS Values 4 / CSS Fonts 4) #119 the SVG codec accepts every CSS length unit. A vega-style SVG with font-size="10px" now renders identically to the unitless one. The existing SvgFixtures/vega-px-font-size.svg tests already cover this.
  2. mermaid pinned: "mermaid": "11.17.2" is added to package.json. Before, only mermaid-cli 11.16.0 was pinned (it asks for mermaid ^11.14.0), so a fresh npm install (no lockfile is committed) could have pulled a newer mermaid than the fidelity target.
  3. Node removed from the Build Documents job: since Mermaid Phase 3b: native mindmaps (cose-bilkent port) and retire mermaid-filter #132 retired mermaid-filter, nothing in that job runs node or npm. The filter test, image check and Mermaid check use the canvasnet tool or bash, and Pandoc and WeasyPrint are dotnet tools. node npm is also dropped from that job's tool-version capture, so it doesn't record the runner's unused preinstalled Node. The other jobs are unchanged.
  4. Vega-Lite negative lag/lead: the parser now accepts any integer, as Vega does. vega-transforms WindowOps.js uses +offset || 1, so a negative offset reads the other way and 0 means 1, and the engine already handled this since Vega-Lite Phase 14: hardening (limit and fuzz audit, determinism), deferred features, gallery, benchmarks #118. ntile and nth_value still require at least 1, as Vega does. An end-to-end test checks that lag -1 equals lead 1.
  5. Mermaid <u>/<ins> underline: DOMPurify's allow-list keeps both and Chrome underlines both, so they now underline through the existing underlined scene runs. Tests and docs that used <u> as the example of an unsupported tag now use <s>.
  6. Flowchart nesting limit (bug): a chain such as subgraph S0 / S1 / end, subgraph S1 / S2 / end, and so on nests through ids, and got past MaxNestingDepth: 40 levels against the limit of 32 rendered with no error. The cause was that FlowchartModel.GetData never called LayoutData.CheckNestingDepth, unlike the class, state and ER models. It now does, failing with a located mermaid-limit-exceeded.
  7. Cross-platform flatten links (bug): Path.IsPathRooted treats C:\x.png, C:/x.png and \\server\share\x.png as relative on Linux and macOS, so canvasnet flatten rebased them there. The new IsWindowsRootedPath leaves them as written on every OS. The regressions don't depend on the OS.
  8. PPTX recheck, no change: two untracked repro PNGs in .agent-logs/ turned out to come from generator tests that run with Pptx.Tests (the Fall back to bundled Noto fonts for missing glyphs and report characters no font covers #105 glyph-fallback work). A fresh minimal PPTX confirms that the degree sign draws a real glyph and that a picture with an ellipse geometry is clipped. Both are already covered by existing tests.

The design, verification, requirements, user guide and help JSON (mermaid.json, svg.json) are updated where behavior changed.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code quality improvement

Related Issues

These are backlog items from the Vega-Lite, SVG flatten and Mermaid work. There is no issue to close.

Pre-Submission Checklist

Before submitting this pull request, ensure you have completed the following:

Build and Test

  • Code builds successfully and all tests pass: pwsh ./build.ps1. Not run locally; CI runs it. These scoped runs (net10.0) passed:
    • dotnet test test/DemaConsulting.CanvasNet.VegaLite.Tests --configuration Release: passed (6,445; 1 symlink skip)
    • dotnet test test/DemaConsulting.CanvasNet.Mermaid.Tests --configuration Release: passed (8,563)
    • dotnet test test/DemaConsulting.CanvasNet.Viewer.Tests --configuration Release: passed (1,168; 4 symlink skips)
    • dotnet test test/DemaConsulting.CanvasNet.Tool.Tests --configuration Release: passed (1,220)
    • dotnet test test/DemaConsulting.CanvasNet.Pptx.Tests --configuration Release (degree and ellipse filter): passed (16)
    • docs/filters/test-canvasnet.ps1: passed
  • Code produces zero warnings

Code Quality

  • New code has appropriate XML documentation comments
  • Static analyzer warnings have been addressed

Quality Checks

Please run the following checks before submitting:

  • All linters pass: pwsh ./lint.ps1 passed (exit 0)

Testing

  • Added unit tests for new functionality
  • Updated existing tests if behavior changed
  • All tests follow the AAA (Arrange, Act, Assert) pattern
  • Test coverage is maintained or improved

Documentation

  • Updated README.md (if applicable). Not applicable.
  • Updated docs/ documentation (if applicable)
  • Added code examples for new features (if applicable). Not applicable.
  • Updated requirements.yaml (if applicable): the per-unit reqstream files.

Additional Notes

After this, node and npm no longer appear in the published tool-versions report, because only the Build Documents job captured them and it no longer installs them.

Malcolm Nixon and others added 7 commits November 12, 2026 11:45
The SVG codec accepts CSS length units since #119, so vega's SVG is written
unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mermaid-cli 11.16.0 accepts mermaid ^11.14.0, so without a lockfile a fresh
npm install could take a newer mermaid than the 11.17.2 fidelity target.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Since mermaid-filter was retired (#132) no step of the job runs node or npm:
the documents use only canvasnet.lua, and the filter test, image check and
Mermaid check run the canvasnet tool. The job no longer sets up Node.js,
runs npm install, or captures the node and npm versions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Vega reads data[index -/+ offset] of +offset || 1, so a negative lag or lead
reads the other way and zero is 1; the engine already handled both. The
parser now accepts any integer for lag and lead and keeps ntile and
nth_value at 1 or more (Vega fails below that).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Chrome's style sheet underlines <u> and <ins>, and DOMPurify keeps both, but
the label builder dropped them with their text kept. Their runs now carry
the underline that the scene already draws for static class members.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A subgraph listed in another subgraph declared elsewhere is nested in it, so
a chain of subgraphs (in either declaration order) nested past
MaxNestingDepth without any nesting in the text: 40 levels measured under
the default limit of 32. FlowchartModel.GetData now checks the nesting with
LayoutData.CheckNestingDepth, as the class, state and ER models do, and
fails with a located mermaid-limit-exceeded.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
RebaseLink relied on Path.IsPathRooted, which on Linux and macOS reads
C:\x.png, C:/x.png and \\server\share\x.png as relative file names, so a
copy written to another folder rebased them. IsWindowsRootedPath now
classifies drive and backslash-rooted paths the same way on every platform
and such links are left untouched.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings November 12, 2026 17:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A moderate defect remains because nesting-depth validation omits descendants hidden by collapsed subgraphs and can therefore miss violations of the configured maximum depth.

1 open issue
What changed in this PR

This PR consolidates backlog fixes across Vega-Lite, Mermaid, SVG flattening, visual-diff tooling, and CI/documentation. It removes obsolete workarounds, pins Mermaid, adds signed window offsets and underline support, enforces flowchart nesting limits, and preserves Windows-rooted links across platforms.

Changes:

  • Removes the obsolete Vega SVG workaround, pins Mermaid 11.17.2, and removes unused Node/npm setup from the documentation workflow.
  • Adds negative and zero Vega-Lite lag/lead support, Mermaid underline rendering for <u> and <ins>, and flowchart nesting-depth validation.
  • Adds platform-independent Windows drive and UNC path handling for SVG flattening.
  • Updates tests, requirements, verification, design, SysML, help, user documentation, and CI configuration.
File Description
tools/​visual-diff/​render-vega.mjs Removes the obsolete Vega font-size unit rewrite.
tools/​visual-diff/​README.md Documents the pinned Mermaid dependency and removes the obsolete Vega workaround description.
tools/​README.md Updates visual-diff prerequisites for the separately pinned Mermaid package.
test/​DemaConsulting.CanvasNet.Viewer.Tests/​Imaging/​SvgFlattenerLinkTests.cs Adds Windows drive, UNC, and cross-platform path-rebasing regression tests.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​Transforms/​AggregateTransformsWindowTests.cs Tests negative, zero, and positive lag/lead offsets.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​SpecModel/​SpecParserAggregatesTests.cs Tests parser acceptance and rejection rules for window offsets.
test/​DemaConsulting.CanvasNet.Mermaid.Tests/​Rendering/​RenderingTests.cs Switches the unsupported-tag fixture from <u> to <s>.
test/​DemaConsulting.CanvasNet.Mermaid.Tests/​Rendering/​LabelBuilderTests.cs Adds HTML underline behavior coverage for <u> and <ins>.
test/​DemaConsulting.CanvasNet.Mermaid.Tests/​MermaidHardeningTests.cs Adds flowchart nesting-limit regression coverage.
test/​DemaConsulting.CanvasNet.Mermaid.Tests/​MermaidFlowchartIntegrationTests.cs Verifies rendered underline behavior for Mermaid flowchart labels.
test/​DemaConsulting.CanvasNet.Mermaid.Tests/​Flowchart/​FlowchartModelTests.cs Tests nesting through referenced subgraph IDs.
src/​DemaConsulting.CanvasNet.Viewer/​Imaging/​SvgFlattener.Links.cs Adds platform-independent Windows rooted-path detection.
src/​DemaConsulting.CanvasNet.VegaLite/​SpecModel/​SpecParser.Aggregates.cs Accepts integer negative and zero lag/lead parameters.
src/​DemaConsulting.CanvasNet.Tool/​Commands/​Help/​svg.json Documents Windows drive and UNC path preservation during flattening.
src/​DemaConsulting.CanvasNet.Tool/​Commands/​Help/​mermaid.json Documents supported underline tags and updated wrapping behavior.
src/​DemaConsulting.CanvasNet.Mermaid/​Rendering/​LabelBuilder.Html.cs Parses and propagates underline styling for HTML labels.
src/​DemaConsulting.CanvasNet.Mermaid/​Rendering/​LabelBuilder.cs Carries underline state into scene text runs.
src/​DemaConsulting.CanvasNet.Mermaid/​Flowchart/​FlowchartModel.LayoutData.cs Applies nesting-depth validation to flowchart layout data.
package.json Pins Mermaid 11.17.2.
docs/​verification/​canvas-net-viewer/​imaging/​svg-flattener.md Records SVG flattener path regression coverage.
docs/​verification/​canvas-net-vega-lite/​transforms/​aggregate-transforms.md Documents negative and zero window-offset verification coverage.
docs/​verification/​canvas-net-vega-lite/​spec-model/​spec-parser.md Documents parser coverage for negative and zero offsets.
docs/​verification/​canvas-net-mermaid/​rendering/​label-builder.md Documents underline and unsupported-tag verification.
docs/​verification/​canvas-net-mermaid/​rendering.md Updates the unsupported HTML-tag verification scenario.
docs/​verification/​canvas-net-mermaid/​flowchart/​flowchart-model.md Documents flowchart nested-ID limit verification.
docs/​verification/​canvas-net-mermaid.md Adds hardening coverage for flowchart nesting through IDs.
docs/​user_guide/​canvas-net-vega-lite.md Documents signed lag/lead offsets and zero-offset behavior.
docs/​user_guide/​canvas-net-tool.md Documents cross-platform Windows path preservation during flattening.
docs/​user_guide/​canvas-net-mermaid.md Documents flowchart nesting limits and supported underline tags.
docs/​sysml2/​model/​canvas-net-mermaid/​rendering/​label-builder.sysml Updates the LabelBuilder architecture description for underline support.
docs/​reqstream/​canvas-net-viewer/​imaging/​svg-flattener.yaml Adds requirements traceability for Windows rooted-path handling.
docs/​reqstream/​canvas-net-vega-lite/​transforms/​aggregate-transforms.yaml Registers the negative-offset verification test.
docs/​reqstream/​canvas-net-vega-lite/​spec-model/​spec-parser.yaml Registers parser verification coverage for window offsets.
docs/​reqstream/​canvas-net-mermaid/​rendering/​label-builder.yaml Updates label styling requirements and test traceability.
docs/​reqstream/​canvas-net-mermaid/​flowchart/​flowchart-model.yaml Adds the nested-ID depth requirement and test.
docs/​reqstream/​canvas-net-mermaid.yaml Registers the new Mermaid hardening test.
docs/​design/​canvas-net-viewer/​imaging/​svg-flattener.md Describes platform-independent Windows rooted-path handling.
docs/​design/​canvas-net-vega-lite/​transforms/​aggregate-transforms.md Describes signed lag/lead offsets.
docs/​design/​canvas-net-vega-lite/​spec-model/​spec-parser.md Updates window-parameter validation rules.
docs/​design/​canvas-net-mermaid/​rendering/​label-builder.md Describes underline handling in HTML labels.
docs/​design/​canvas-net-mermaid/​flowchart/​flowchart-model.md Describes nested-ID depth checking.
docs/​design/​canvas-net-mermaid/​flowchart.md Updates flowchart render-limit behavior.
docs/​design/​canvas-net-mermaid.md Updates Mermaid HTML-label behavior documentation.
.github/​workflows/​build.yaml Removes unused Node/npm setup and version capture from the documentation job.

Review effort: Lite

GetData checked MaxNestingDepth on the layout data, which no longer holds the
descendants of a collapsed subgraph, so a collapsed root could hide a chain
nested past the limit. The depth is now checked on every subgraph and vertex
(LayoutData.CheckNestingDepthOf) before CollapsedSubgraphs walks the chain;
a visible node has the same ancestors in the layout data, so one check
bounds both.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings November 12, 2026 18:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human confirmation is still needed because the batch combines Mermaid layout, Vega parsing, cross-platform path semantics, and CI/dependency changes without complete cross-platform validation of document generation and flatten behavior.

No open issues 🎉

1 resolved since last review

Review effort: Lite

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.

2 participants