Skip to content

Add opt-in problem reports - #129

Merged
elfpkck merged 2 commits into
mainfrom
error-reporting
Sep 27, 2026
Merged

elfpkck merged 2 commits into
mainfrom
error-reporting

Conversation

@elfpkck

@elfpkck elfpkck commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Adds opt-in problem reporting. The plugin keeps a local diagnostics log, and when something goes wrong it offers Report a problem…. The user reviews and edits the report before anything leaves their machine. Nothing is ever sent automatically (GDPR/ePrivacy).

What's in it

  • Local log: the QGIS message log (tag Parallelizer) and a rotating file in the QGIS profile. No layer names, paths, attribute values or coordinates; scrub() is a second line of defense.
  • Error capture: @capture_errors on the map tool's event handlers and on processAlgorithm records unexpected errors and re-raises them. UserInputError marks input problems so they aren't recorded as bugs.
  • Report contents:
    • environment (plugin, QGIS, Qt, Python, GEOS, PROJ, GDAL, OS, locale, screen scaling, other plugins) and settings;
    • the failed operation and the last 5 operations: layers, project, feature stats and validity, click or rectangle, and the rotation math;
    • Processing context; a failing feature is re-run once with a trace, so the per-feature loop stays light;
    • crash and hang dumps from the previous session;
    • geometries only if the user opts in, converted to one CRS and shifted to a local origin. Large references are clipped around the target.
  • Ways to share:
    • Copy to clipboard;
    • open a pre-filled GitHub issue (new issue form bug_report.yml);
    • Send by email (mailto:);
    • one-click Send report to a Cloudflare Worker (tools/report_worker/) that files the report as an issue in a private repository.
  • Release: release.yaml fills in REPORT_EMAIL and REPORT_ENDPOINT from repository secrets, only in the package. The repo copy of contact.py stays empty.
  • Privacy note: site/privacy.md.

Before the next release

  • Deploy the Worker, and create the private reports repository and its fine-grained token (see tools/report_worker/README.md).
  • Add the REPORT_EMAIL and REPORT_ENDPOINT repository secrets. The release workflow fails without them.
  • The issue-form prefill works only once bug_report.yml is on main.

Testing

  • make test-all: 134 passed; Worker node --test: 12 passed; pre-commit clean.
  • Real QGIS 4.2.2 under Xvfb:
    • two-session run, 16/16 checks: error offer, report, click and rectangle operations, clipping, hang watchdog, a real segfault, and the crash report offered on the next start;
    • the mailto: link;
    • Send report against wrangler dev in dry-run mode (201).
  • Not tested: delivery to a real GitHub repository through a deployed Worker.

…nding

- Local plugin log (QGIS message log and a rotating file) with no layer
  names, paths, attribute values or coordinates.
- "Report a problem..." dialog: the user reviews and edits a report
  (environment, layers, project, recent operations, rotation math, crash
  and hang dumps from the previous session, opt-in geometries shifted to
  a local origin), then copies it, opens a pre-filled GitHub issue, sends
  an email or sends it with one click. Nothing is sent automatically.
- Cloudflare Worker receiver (tools/report_worker) that files reports as
  issues in a private repository; the endpoint and email come from
  release secrets.
- GitHub issue form and privacy note.
- Unticking "Include the geometries" removes the section by its heading,
  even after edits, and keeps the box ticked with a note when it can't.
- Send report fits the report by the size of the JSON body actually sent.
- Guard the kept operations with a lock: a Processing run finishes in its
  worker thread while the report may be built.
- Convert recorded geometries to one CRS before shifting them to a local
  origin.
- Correct the Worker comment on the body size check.
@elfpkck elfpkck added feature New or changed plugin behavior cd Release workflow, publishing to plugins.qgis.org and GitHub Releases labels Sep 27, 2026
@elfpkck elfpkck self-assigned this Sep 27, 2026
@codecov

codecov Bot commented Sep 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.49453% with 70 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@daf9f17). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
PolygonsParallelToLine/src/map_tool.py 69.56% 19 Missing and 2 partials ⚠️
PolygonsParallelToLine/src/diagnostics.py 95.45% 13 Missing and 4 partials ⚠️
PolygonsParallelToLine/src/snapshot.py 89.41% 6 Missing and 3 partials ⚠️
PolygonsParallelToLine/src/plugin.py 84.78% 6 Missing and 1 partial ⚠️
PolygonsParallelToLine/src/report_dialog.py 96.77% 1 Missing and 3 partials ⚠️
PolygonsParallelToLine/src/parallelizer.py 76.92% 2 Missing and 1 partial ⚠️
PolygonsParallelToLine/src/reference.py 25.00% 3 Missing ⚠️
PolygonsParallelToLine/src/report_sender.py 95.91% 2 Missing ⚠️
PolygonsParallelToLine/src/rotator.py 81.81% 1 Missing and 1 partial ⚠️
PolygonsParallelToLine/src/pptl.py 96.77% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #129   +/-   ##
=======================================
  Coverage        ?   79.79%           
=======================================
  Files           ?       18           
  Lines           ?     1623           
  Branches        ?      202           
=======================================
  Hits            ?     1295           
  Misses          ?      278           
  Partials        ?       50           

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

@elfpkck
elfpkck merged commit e80d80e into main Sep 27, 2026
9 checks passed
@elfpkck
elfpkck deleted the error-reporting branch September 27, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cd Release workflow, publishing to plugins.qgis.org and GitHub Releases feature New or changed plugin behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant