You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Print tool diagnostics to stderr without --json and point formats/help to the help topics - #102
Feedback from agents using the canvasnet tool: features that were ignored or unsupported looked like silent failures, and the per-format help topics were hard to find.
Diagnostics on stderr without --json
Before this change, render diagnostics (vl-*, scad-*, and so on) appeared only in the --json result. A plain canvasnet render printed wrote ... and exited 0. Now:
Each diagnostic is written to stderr as Unsupported: <code>: <message> or Warning: <code>: <message>, with the page, input or side in parentheses where there is one.
A Scad echo is written as ECHO: <text>; it was silent before too.
Output is capped at 20 lines of each kind, followed by ... and N more diagnostics (use --json for all).
--silent suppresses them, though --log still records them. With --json nothing is written to stderr, and the exit code is unchanged.
This applies to render/convert, the verbs, inspect, montage and compare.
Control characters are escaped in stderr output only: C0, DEL, C1, U+2028/2029 and the bidi controls, written as \uXXXX, with \n, \r and \t. A model therefore can't inject terminal sequences. The --json values are unchanged.
Example:
$ canvasnet render chart.vl.json -o out.png
wrote out.png (347x347 png, 8162 bytes) from chart.vl.json
Unsupported: vl-channel-shape: chart.vl.json:1:180 /encoding/shape: The 'shape' channel is not drawn by the 'line' mark; it is ignored.
Finding the help topics
canvasnet formats gets a Help column with each input format's topic, plus a footer pointing to canvasnet help <topic>.
formats --json adds helpTopic to each input; the six raster formats map to raster.
Every command's text help ends with a "See also" paragraph that names the help topics.
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
User and reviewer feedback: silent ignored features, and no supported-feature list found through formats --help.
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 (46,035 tests, 0 failed). After the escaping fix, the Tool tests were re-run and pass. canvasnet --validate passes 16/16.
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:
Context output: format, cap, suppression by --silent and --json, and escaping.
Entry-point stderr tests for Vega-Lite, Scad and montage.
Every helpTopic resolves to a topic, and the footer and See-also lines are present.
Updated existing tests if behavior changed (golden formats JSON)
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
The help topics (errors, json, scad, vega-lite, vsdx) are updated to match, and the help drift tests pass.
Without --json, write each diagnostic of a successful command to standard error as 'Unsupported: <code>: <message>' or 'Warning: <code>: <message>' (with the page, input, or side when there is one), and a SCAD model's echo output as 'ECHO: <text>'. At most 20 of each are written, then a count. --silent suppresses them; --json writes none (standard output stays one JSON document); the exit code is unchanged.
Make the help topics discoverable: 'formats' lists the help topic of every input format (a Help column, and helpTopic in --json) with a footer that points to 'canvasnet help <topic>', and the help of every command ends with a See also line naming the topics.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A model's echo text and the messages of diagnostics could carry ESC, NUL, or other control characters straight to the terminal. In text mode every control character, line or paragraph separator, and bidirectional control is now written as \\n, \\r, \\t, or \\uXXXX; --json values are unchanged.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Several moderate issues remain, including missing stderr/entry-point coverage, lost input context in render and inspect diagnostics, and incomplete bidi-control escaping.
This pull request makes successful-command diagnostics visible in text mode while preserving JSON output, exit-code behavior, and suppression semantics. It also improves format discoverability through help-topic metadata and command-help guidance.
Changes:
Added centralized, capped, escaped stderr reporting for diagnostics and SCAD echo output across render, montage, inspect, and compare workflows.
Added helpTopic metadata, format-listing links, help footers, and “See also” guidance.
Added regression tests and updated user documentation, requirements, verification records, and design documentation.
Tests format help topics and command-help references.
src/DemaConsulting.CanvasNet.Tool/Context.cs
Implements diagnostic output, escaping, suppression, logging, and limits. Moderate:U+061C is missing from the bidi-control escaping set. Nit: method documentation describes only successful renders rather than successful operations generally.
Emits inspect diagnostics after text results. Moderate: lacks entry-point coverage for diagnostic, --silent, and --json behavior. Moderate: passes a null origin, losing input context for PPTX/VSDX diagnostics.
Emits comparison diagnostics with side context. Moderate: lacks entry-point coverage for stderr output, suppression behavior, and threshold-failure ordering.
Updates system diagnostic requirements and traceability.
docs/design/canvas-net-tool/context.md
Describes diagnostic output implementation. Nit: refers to WriteDiagnostics as applying only to successful renders. Nit: architecture model documentation does not describe the new stderr behavior or affected relationships.
…s tests
- render and inspect pass the input path as the origin of each note, as montage does (the page of a document is kept).
- Escape U+061C (ARABIC LETTER MARK), completing the Unicode Bidi_Control set.
- Say 'successful command' in the WriteDiagnostics summary.
- Entry-point tests for inspect, compare (including a failed threshold), and document diagnostics of render; regression tests for every bidirectional control.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The design documentation inaccurately limits WriteDiagnostics to successful renders, omitting its use by inspect, montage, and compare, so the documented scope does not match the implementation.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Update WriteDiagnostics design scope to cover all calling commands
docs/design/canvas-net-tool/context.md:66
This design text still describes WriteDiagnostics as applying only to a successful render, but the changed method is also called by inspect, montage, and compare (including before a failed compare threshold is reported). Update the description to cover the command operations that use it, so the design artifact matches the implementation and the documented scope of this PR.
Since #103 a shape on a line enables the point overlay, so it is drawn and no
longer reports vl-channel-shape; the #102 stderr tests (merged after #103 on a
stale base) relied on that diagnostic and failed on main.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…107)
Since #103 a shape on a line enables the point overlay, so it is drawn and no
longer reports vl-channel-shape; the #102 stderr tests (merged after #103 on a
stale base) relied on that diagnostic and failed on main.
Co-authored-by: Malcolm Nixon <Malcolm.Nixon@hiarc.inc>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…#104)
* Describe WriteDiagnostics as used by every command that reports notes
Follow-up from the final review of #102.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Wrap the WriteDiagnostics line within 120 characters
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Malcolm Nixon <Malcolm.Nixon@hiarc.inc>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
Feedback from agents using the
canvasnettool: features that were ignored or unsupported looked like silent failures, and the per-format help topics were hard to find.Diagnostics on stderr without
--jsonBefore this change, render diagnostics (
vl-*,scad-*, and so on) appeared only in the--jsonresult. A plaincanvasnet renderprintedwrote ...and exited 0. Now:Unsupported: <code>: <message>orWarning: <code>: <message>, with the page, input or side in parentheses where there is one.echois written asECHO: <text>; it was silent before too.... and N more diagnostics (use --json for all).--silentsuppresses them, though--logstill records them. With--jsonnothing is written to stderr, and the exit code is unchanged.render/convert, the verbs,inspect,montageandcompare.\uXXXX, with\n,\rand\t. A model therefore can't inject terminal sequences. The--jsonvalues are unchanged.Example:
Finding the help topics
canvasnet formatsgets a Help column with each input format's topic, plus a footer pointing tocanvasnet help <topic>.formats --jsonaddshelpTopicto each input; the six raster formats map toraster.Type of Change
Related Issues
User and reviewer feedback: silent ignored features, and no supported-feature list found through
formats --help.Pre-Submission Checklist
Before submitting this pull request, ensure you have completed the following:
Build and Test
pwsh ./build.ps1(46,035 tests, 0 failed). After the escaping fix, the Tool tests were re-run and pass.canvasnet --validatepasses 16/16.Code Quality
Quality Checks
Please run the following checks before submitting:
pwsh ./lint.ps1passedTesting
--silentand--json, and escaping.helpTopicresolves to a topic, and the footer and See-also lines are present.formatsJSON)Documentation
Additional Notes
The help topics (
errors,json,scad,vega-lite,vsdx) are updated to match, and the help drift tests pass.