Skip to content

Fix: user errors do not invite a bug report - #1306

Open
gennaroprota wants to merge 8 commits into
cppalliance:developfrom
gennaroprota:fix/user_errors_do_not_invite_a_bug_report
Open

gennaroprota wants to merge 8 commits into
cppalliance:developfrom
gennaroprota:fix/user_errors_do_not_invite_a_bug_report

Conversation

@gennaroprota

Copy link
Copy Markdown
Collaborator

Every error-level message in MrDocs printed the internal source location and an invitation to file a bug report. For instance, a missing configuration file produced one, and with --warn-as-error so did every undocumented symbol, thus a reader was asked to report a MrDocs defect for a mistake in their own input.

report::bug is now the only function that does that: it prints the message followed by the version and the source location a bug report needs, while error, fatal, warn and the rest print the message alone.

Other defects surfaced while going through the reporting code and are fixed in their own commits.

Changes

  • Source: report::bug now reports MrDocs defects, with the bug-report details suppressed everywhere else; quoted errors carry their reason without the raising location; source-root's bare-placeholder default resolves to the configuration file's directory; the release-build exception report is compiled in again; the overload-set diagnostic names overload sets rather than enums; the unused getLevel is gone.
  • Tests: a unit test for the source-root default.

Testing

tests/unit/Config.cpp covers the source-root default: it writes a minimal mrdocs.yml into a temporary directory and asserts the value of source-root comes back as that file's directory, which the old resolver could not do.

The diagnostics themselves are not tested, as that seemed overkill.

Documentation

No page describes the diagnostics or reproduces their wording, so nothing needed updating. report::bug is public API and carries its doc-comments, which include when to reach for it instead of error.

Closes #1116.

Every error-level message in MrDocs showed the internal source location
and contained an invite to file a bug report. A missing config file, for
instance, produced that and, with `--warn-as-error`, so did every
undocumented symbol.

This commit rectifies the situation by emitting such text only for
internal errors.

Fixes cppalliance#1116.
@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

🧾 Changes by Scope

Scope Lines Δ% Lines Δ Lines + Lines - Files Δ Files + Files ~ Files ↔ Files -
🛠️ Source 72% 163 80 83 13 - 13 - -
🧪 Unit Tests 25% 57 57 - 1 1 - - -
📦 Other 3% 6 3 3 1 - 1 - -
Total 100% 226 140 86 15 1 14 - -

Legend: Files + (added), Files ~ (modified), Files ↔ (renamed), Files - (removed)

🔝 Top Files

  • include/mrdocs/Support/Report.hpp (Source): 61 lines Δ (+47 / -14)
  • tests/unit/Config.cpp (Unit Tests): 57 lines Δ (+57 / -0)
  • src/mrdocs/Support/ReportImpl.hpp (Source): 25 lines Δ (+3 / -22)

Generated by 🚫 dangerJS against 8e92ad5

@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.12%. Comparing base (be06d44) to head (8e92ad5).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1306   +/-   ##
========================================
  Coverage    83.12%   83.12%           
========================================
  Files           35       35           
  Lines         3662     3662           
  Branches       844      844           
========================================
  Hits          3044     3044           
  Misses         410      410           
  Partials       208      208           
Flag Coverage Δ
bootstrap 83.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cppalliance-bot

cppalliance-bot commented Sep 17, 2026

Copy link
Copy Markdown

An automated preview of the documentation is available at https://1306.mrdocs.prtest2.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-09-18 09:09:30 UTC

The places that quote one error message inside another one used
`Error::message()`, which also contains an indication of the source
location in which the problem was detected. For instance, a doc-comment
warning came out as "HTML <td> tag not followed by </td>
(src/mrdocs/AST/ExtractDocComment.cpp:774) at <their file> (6)".

Those places quote the reason now, but not the source location.

Only detected bugs show source location information now.
`source-root`'s default value is the bare placeholder "<config-dir>",
but the resolver only stripped the placeholder when it was followed by a
'/'; so the "<...>" text survived verbatim into the path, meaning that
every configuration which omitted `source-root` died with a "path does
not exist" error.

The fix is to treat an empty remainder as ".". A new unit test loads a
minimal mrdocs.yml and checks that `source-root` comes back as that
file's directory.
The message was likely the result of copy/paste.
This was always the intent, but a few places tested `_NDEBUG` instead of
the intended `NDEBUG`, in fact removing the code that reported the
exception.
The function was error-prone, in that it used a mapping that was one off
the values of the enumerators. Also, nothing in the project used it, and
it lived in a private header, so let it go.
@gennaroprota
gennaroprota force-pushed the fix/user_errors_do_not_invite_a_bug_report branch from 68fc5a0 to 3765317 Compare September 18, 2026 08:37
The format string lacked a placeholder for the error passed with it, so
the reason was dropped and the message ended at "because ". The
hand-written "Warning: " prefix is also removed, as no other warning
carries one. "because" is removed because it may not read well depending
on the `err` message.
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.

MrDocs error message confusing between internal and user errors

2 participants