Skip to content

Quick fixes: SVG XML error location, Vega-Lite cornerRadiusEnd, SCAD angle fragments - #154

Merged
Malcolmnixon merged 4 commits into
mainfrom
fix/quick-fixes
Nov 18, 2026
Merged

Malcolmnixon merged 4 commits into
mainfrom
fix/quick-fixes

Conversation

@Malcolmnixon

@Malcolmnixon Malcolmnixon commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Pull Request

Description

Four small backlog fixes.

  1. Line and column in SVG XML errors. A file that is not well-formed XML now reports where the problem is, in both canvasnet render text and --json output, for example The stream does not contain well-formed XML (line 2, column 10): '--' is not allowed inside an XML comment. The hint covers only the comment case. It is found from the XML reader's English message, so on a non-English .NET runtime only the line and column appear.
  2. Vega-Lite cornerRadiusEnd. Before this change only cornerRadius was read; cornerRadiusEnd and the four single-corner settings were silently ignored. A bar now rounds:
    • at its value end: the top of a bar above zero, the bottom of one below, and the right or left end of a horizontal bar;
    • on all four corners when it is a ranged bar (x2/y2).
      A rect mark ignores cornerRadiusEnd, and a mark setting beats a config setting. cornerRadiusTopLeft, cornerRadiusTopRight, cornerRadiusBottomLeft and cornerRadiusBottomRight are supported too.
      Known difference, documented in the user guide and help card: in a stack each segment is rounded by itself, where Vega-Lite rounds only the outer ends of the whole stack.
      Nine scene snapshots changed only by an added CornerRadii=null.
  3. #azimuth= and #elevation= fragment keys for SCAD models. These keys set the camera angles of an embedded or input model, the same way --azimuth and --elevation do: they replace the angles of the view= named view, so #view=front&azimuth=90 draws the right view. Azimuth can be any finite number and is normalized to 0–360; elevation must be from -90 to 90. Anything else is image-fragment-invalid. The Pandoc filter needs no change, because it already takes azimuth/elevation attributes.
  4. Mermaid class text under a stroke style: no change needed. In mermaid-cli 11.16.0 (the pinned version) and 12.2.0, the SVG does carry stroke:#f00 on the label text, but the browser doesn't paint it: the PNG has no red in the text. CanvasNet already draws the same thing. A regression test now covers it (text without a stroke, red outline).

Before and after

Vega-Lite "mark": {"type": "bar", "cornerRadiusEnd": 8}: before, the setting was ignored; after, each bar rounds at its value end (including the negative bar B, which rounds at the bottom).

Before After
bars with square corners bars rounded at their value ends

SCAD canvasnet render "ell.scad#azimuth=200&elevation=50": before, both keys were ignored with image-fragment-unknown-parameter warnings and the model drew from the default view; after, the camera turns to azimuth 200, elevation 50.

Before After
model from the default view model from azimuth 200, elevation 50

SVG XML error for a comment containing -- (<!-- step 1 -- step 2 --> on line 2):

Before: Error: corrupt-input: 'bad.svg' is not a valid svg file: The stream does not contain well-formed XML.
After:  Error: corrupt-input: 'bad.svg' is not a valid svg file: The stream does not contain well-formed XML (line 2, column 15): '--' is not allowed inside an XML comment.

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

Backlog items, no issues filed.

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 (passed, 0 failures)
  • 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)

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)
  • Updated docs/ documentation (if applicable)
  • Added code examples for new features (if applicable)
  • Updated requirements.yaml (if applicable)

Additional Notes

After the next release, docs/images/showcase.png, composition.png and vegalite-gallery.png should be regenerated so their charts show the rounded bars. The image script uses the released tool, so this PR does not regenerate them.

Malcolm Nixon and others added 2 commits November 17, 2026 20:33
…ments, class text stroke check

- SVG: a stream that is not well-formed XML names the line and column of the
  error (Load and GetInfo), and says that '--' is not allowed inside an XML
  comment when that is the cause; the location reaches the corrupt-input
  message of canvasnet render in text and JSON.
- Vega-Lite: bars and rects honor cornerRadiusTopLeft/TopRight/BottomRight/
  BottomLeft, and bars round their value end with cornerRadiusEnd as
  Vega-Lite 6.5 does (sign-aware, every corner of a ranged bar, mark beats
  config); stacked segments are rounded per segment (documented difference).
  SceneRect gains an optional CornerRadii painted per corner; the scene
  snapshots only gain CornerRadii=null.
- OpenSCAD: link and input fragments accept azimuth= and elevation= (like
  --azimuth and --elevation, replacing the angles of the named view); an
  input fragment overrides each of view, azimuth, and elevation of the
  command individually; invalid values are image-fragment-invalid.
- Mermaid: verified that Mermaid 11 never paints class texts with a class
  stroke style; added a regression test and documented the behavior.

Requirements, design, verification, user guides, help cards, and README
updated to match.

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

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

Active documentation and implementation issues remain, including incorrect view-angle guidance, lost per-corner radius precedence, and missing validation for newly supported corner properties.

3 open issues
What changed in this PR

This pull request adds malformed-SVG error locations, SCAD camera-angle fragment parameters, and Vega-Lite per-corner and value-end bar rounding, along with Mermaid regression coverage and related documentation, verification, requirements, and design updates.

Changes:

  • Reports SVG XML line and column details with a targeted XML-comment hint.
  • Supports azimuth and elevation fragment parameters for SCAD inputs with validation and precedence handling.
  • Adds Vega-Lite cornerRadiusEnd and individual corner-radius support with scenegraph rendering and tests.
  • Adds Mermaid class-label stroke regression coverage and updates traceability artifacts.
File Description
test/​DemaConsulting.CanvasNet.Viewer.Tests/​Imaging/​InputSelectionTests.cs Tests SCAD fragment-angle precedence, merging, and validation.
test/​DemaConsulting.CanvasNet.Viewer.Tests/​CanvasNetViewerFragmentTests.cs Tests rendering and rejection of SCAD angle fragments.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​VegaLiteSystemIntegrationTests.cs Tests rendered rounded value ends for vertical and horizontal bars.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​Scenegraph/​ScenePainterTests.cs Tests independent corner-radius rendering, clamping, and non-finite handling.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​Marks/​MarkBuilderTests.cs Tests corner-radius resolution, bar-end rounding, and precedence.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​Fixtures/​SceneSnapshots/​single-stacked-bars.scene.txt Updates the stacked-bar scene snapshot for the new corner-radius field.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​Fixtures/​SceneSnapshots/​single-histogram.scene.txt Updates the histogram scene snapshot for the new corner-radius field.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​Fixtures/​SceneSnapshots/​single-container-fit.scene.txt Updates the container-fit scene snapshot for the new corner-radius field.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​Fixtures/​SceneSnapshots/​single-bar-nominal.scene.txt Updates the nominal-bar scene snapshot for the new corner-radius field.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​Fixtures/​SceneSnapshots/​layered-own-data-independent-legend.scene.txt Updates the layered scene snapshot for the new corner-radius field.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​Fixtures/​SceneSnapshots/​layered-nested-text.scene.txt Updates the layered-text scene snapshot for the new corner-radius field.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​Fixtures/​SceneSnapshots/​layered-dual-axis.scene.txt Updates the dual-axis scene snapshot for the new corner-radius field.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​Fixtures/​SceneSnapshots/​layered-boxplot.scene.txt Updates the boxplot scene snapshot for the new corner-radius field.
test/​DemaConsulting.CanvasNet.VegaLite.Tests/​Fixtures/​SceneSnapshots/​layered-bar-rule.scene.txt Updates the bar-rule scene snapshot for the new corner-radius field.
test/​DemaConsulting.CanvasNet.Tool.Tests/​Commands/​RenderCommandTests.cs Tests malformed SVG line and column reporting in text and JSON output.
test/​DemaConsulting.CanvasNet.Tool.Tests/​Commands/​InputFragmentTests.cs Tests SCAD angle fragments and command-line behavior.
test/​DemaConsulting.CanvasNet.Tool.Tests/​Commands/​HelpTopicsTests.cs Verifies that SCAD angle parameters appear in help content.
test/​DemaConsulting.CanvasNet.Svg.Tests/​SvgCodecTests.cs Tests malformed XML locations and the double-hyphen comment hint.
test/​DemaConsulting.CanvasNet.Mermaid.Tests/​Rendering/​ShapeLibraryTests.cs Tests that class strokes affect outlines but not label text.
src/​DemaConsulting.CanvasNet.Viewer/​LoaderImageSource.cs Parses and validates SCAD angle fragment parameters.
src/​DemaConsulting.CanvasNet.Viewer/​Imaging/​InputSelection.cs Merges fragment azimuth and elevation values with command options.
src/​DemaConsulting.CanvasNet.VegaLite/​Scenegraph/​ScenePainter.cs Paints rectangles with independent corner radii.
src/​DemaConsulting.CanvasNet.VegaLite/​Scenegraph/​SceneModel.cs Adds per-corner radius data to scene rectangles.
src/​DemaConsulting.CanvasNet.VegaLite/​Marks/​MarkBuilder.cs Resolves Vega-Lite corner-radius properties and bar value ends.
src/​DemaConsulting.CanvasNet.Tool/​Commands/​RenderCommand.cs Updates render-command help for SCAD angle fragments.
src/​DemaConsulting.CanvasNet.Tool/​Commands/​Help/​vega-lite/​marks.md Documents corner-radius support and stacked-bar behavior.
src/​DemaConsulting.CanvasNet.Tool/​Commands/​Help/​svg/​fragments.md Documents fragment angle parameters and precedence.
src/​DemaConsulting.CanvasNet.Tool/​Commands/​Help/​svg/​diagnostics.md Documents malformed XML location reporting.
src/​DemaConsulting.CanvasNet.Tool/​Commands/​Help/​scad/​views.md Documents SCAD fragment camera angles.
src/​DemaConsulting.CanvasNet.Tool/​Commands/​Help/​scad/​differences.md Documents SCAD angle-fragment behavior and validation.
src/​DemaConsulting.CanvasNet.Svg/​SvgCodec.Parsing.cs Updated as part of this pull request.
README.md Adds SCAD angle fragments to the feature overview.
docs/​verification/​canvas-net-viewer/​imaging/​source-loader.md Records SCAD angle-fragment verification coverage.
docs/​verification/​canvas-net-viewer/​canvas-net-viewer.md Records rendered SCAD angle-fragment scenarios.
docs/​verification/​canvas-net-vega-lite/​scenegraph/​scene-painter.md Records per-corner scene-painter verification.
docs/​verification/​canvas-net-vega-lite/​marks/​mark-builder.md Records bar corner-radius and precedence verification.
docs/​verification/​canvas-net-vega-lite.md Records public rounded-bar integration verification.
docs/​verification/​canvas-net-tool/​commands/​render-command.md Records malformed SVG and SCAD fragment command verification.
docs/​verification/​canvas-net-svg/​svg-codec.md Records malformed XML location verification.
docs/​verification/​canvas-net-mermaid/​rendering/​shape-library.md Records Mermaid class-text stroke verification.
docs/​user_guide/​canvas-net.md Updates general fragment parameter documentation.
docs/​user_guide/​canvas-net-viewer.md Documents SCAD angle fragments and option precedence.
docs/​user_guide/​canvas-net-vega-lite.md Documents Vega-Lite corner-radius support and stack behavior.
docs/​user_guide/​canvas-net-tool.md Documents command fragment angles and camera behavior.
docs/​user_guide/​canvas-net-svg.md Documents malformed SVG location errors and angle fragments.
docs/​user_guide/​canvas-net-scad.md Documents SCAD angle fragments for linked models.
docs/​sysml2/​model/​canvas-net-viewer/​canvas-net-viewer.sysml Updates the viewer architecture description for angle fragments.
docs/​sysml2/​model/​canvas-net-vega-lite/​marks/​mark-builder.sysml Updates the MarkBuilder architecture description for corner radii.
docs/​reqstream/​canvas-net-viewer/​imaging/​source-loader.yaml Adds SCAD angle-fragment requirements and verification traceability.
docs/​reqstream/​canvas-net-viewer/​canvas-net-viewer.yaml Adds viewer angle-fragment requirements and verification traceability.
docs/​reqstream/​canvas-net-viewer.yaml Updated as part of this pull request.
docs/​reqstream/​canvas-net-vega-lite/​scenegraph/​scene-painter.yaml Adds per-corner scene-painter requirements and tests.
docs/​reqstream/​canvas-net-vega-lite/​marks/​mark-builder.yaml Adds corner-radius MarkBuilder requirements and tests.
docs/​reqstream/​canvas-net-vega-lite/​marks.yaml Links the corner-radius requirement into the marks hierarchy.
docs/​reqstream/​canvas-net-vega-lite.yaml Links the rounded-bar system integration verification.
docs/​reqstream/​canvas-net-tool/​commands/​render-command.yaml Adds malformed SVG and SCAD angle requirements and tests.
docs/​reqstream/​canvas-net-svg/​svg-codec.yaml Adds malformed XML location requirements and tests.
docs/​reqstream/​canvas-net-svg.yaml Links malformed XML location requirements into the SVG hierarchy.
docs/​reqstream/​canvas-net-mermaid/​rendering/​shape-library.yaml Adds Mermaid class-text stroke requirements and tests.
docs/​design/​canvas-net-viewer/​imaging/​source-loader.md Describes SCAD angle parsing and merge behavior.
docs/​design/​canvas-net-viewer/​canvas-net-viewer.md Updates viewer design documentation for angle fragments.
docs/​design/​canvas-net-vega-lite/​scenegraph/​scene-painter.md Describes per-corner rectangle painting.
docs/​design/​canvas-net-vega-lite/​scenegraph/​scene-model.md Documents the scene corner-radius model.
docs/​design/​canvas-net-vega-lite/​marks/​mark-builder.md Describes corner-radius resolution and stack behavior.
docs/​design/​canvas-net-svg/​svg-codec.md Documents malformed XML error construction.
docs/​design/​canvas-net-mermaid/​rendering/​shape-library.md Documents Mermaid class-label stroke behavior.

Review effort: Lite

Comment thread docs/user_guide/canvas-net-tool.md Resolved
Malcolm Nixon and others added 2 commits November 17, 2026 21:50
- Validate cornerRadiusEnd and the four single-corner radii of a mark definition as numbers or expression references, like cornerRadius; add wrong-type rows and valid forms to the SpecParser tests.
- Clarify the ranged-bar corner radius comment in MarkBuilder and pin that a corner set on the mark keeps its radius against a configuration cornerRadiusEnd (ranged and positive bars).
- Replace the stale fragment view-angle sentence in the tool user guide and extend the scad/views help card.
- Update the spec-parser design and the spec-parser and mark-builder verification documents.

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

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

The change spans several independent rendering paths, and full runtime verification was not possible because the repository’s pinned dependencies could not be restored in the review container.

No open issues 🎉

3 resolved since last review

Review effort: Lite

@Malcolmnixon
Malcolmnixon merged commit 17f1d15 into main Nov 18, 2026
13 checks passed
@Malcolmnixon
Malcolmnixon deleted the fix/quick-fixes branch November 18, 2026 04:33
This was referenced Nov 20, 2026
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