[PR #3896] [CLOSED] [Engine] Opt-in error reporting for the server process (inert without a DSN) #4820

Closed
opened 2026-11-07 15:39:16 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3896
Author: @Faks
Created: 10/24/2026
Status: ❌ Closed

Base: main ← Head: feat/error-reporting-upstream


📝 Commits (1)

  • 46728ae [Engine] opt-in error reporting for the server process (inert without a DSN)

📊 Changes

5 files changed (+155 additions, -5 deletions)

View changed files

📝 README.md (+2 -1)
📝 docs/SAFETY.md (+8 -4)
➕ serve/error_reporting.py (+56 -0)
📝 serve/server.py (+4 -0)
➕ tests/terminal/test_error_reporting.py (+85 -0)

📄 Description

Problem and result

handle_error in serve/server.py prints a traceback and continues, so a request-path failure stops there and nothing reaches an error tracker. With serve/error_reporting.py the server reports failures that reach the handler boundary, and only when a DSN is set. With no DSN the module does nothing at all, and the extra package is not installed by setup.

The privacy page had to change too, because the change makes its headline claim false. docs/SAFETY.md says "There is no telemetry. Strata sends no usage data, no crash reports and no analytics", and its "Does Strata phone home?" answer says a search of the code found no crash reporter. Once an opt-in reporter exists, that sentence is no longer true as written, so both are qualified to the default path, and the internet table gains the row for it — the table claims to list what was found in the code, and leaving this out would make it incomplete.

None. No issue was opened and no maintainer agreement on scope was sought before writing this. CONTRIBUTING asks for scope agreement on features; this is one, so a maintainer may reasonably ask for an issue first or return the PR.

Approach

  • DSN from STRATA_GLITCHTIP_DSN or from error_reporting.dsn in the run config, matching how the server already reads optional settings.
  • sentry-sdk is not added to requirements.txt. That file is the pinned install setup.py runs for every user, and CONTRIBUTING keeps dependency changes out of a PR; a dependency serving an opt-in feature would become a hard requirement for everyone. The import is guarded, so a missing package prints one line and the server starts anyway.
  • send_default_pii stays off and tracing stays off: the report is about the failure, not the request content.
  • The default path is unchanged in behaviour when no DSN is set, but the files are not byte-identical, so CONTRIBUTING's "byte-identical default path" rule is met in behaviour, not literally in bytes.
  • Naming assumption: the variable names one product (STRATA_GLITCHTIP_DSN) while the SDK is Sentry-compatible and works against any Sentry-compatible tracker. A neutral name such as STRATA_ERROR_REPORTING_DSN may be preferred by maintainers. It is kept as written because that is what the deployment running this already uses.

Validation

Passed:

  • python3 -m pytest tests/terminal/test_error_reporting.py -q → 6 passed on 46728ae5, Linux, Python 3.13. Unit tests with the SDK mocked, no network, no GPU: inert without a DSN, DSN from the run config, missing package prints one line and does not stop a start, active with environment and release taken, capture needs an active client, a hang-up is not reported.
  • import serve.server with the new module: clean; init() returns False with no DSN.
  • Delivery against a live self-hosted tracker, through the committed module: a synthetic exception produced an issue, then an alert notification, then the alert send task ran with no error, and the recipients resolved to two subscribed team members.
  • Read from source, not assumed: the alert test endpoint returns skipped for email recipients because that is hardcoded — apps/alerts/api.py line 179 — so a skipped test is the endpoint refusing to test email, not a broken alert. Email recipients are resolved as users on a team holding the project with a UserProjectAlert row or subscribe_by_default — apps/users/models.py line 44.

Failed:

  • Nothing observed on this change.

Not run:

  • No GPU build: the change is Python only.
  • No CI run on this revision.
  • The full terminal suite could not be run on the host used here: the project venv has no pytest, and the system Python that has it lacks rich (9 collection errors). That is an environment limit, not a result for this change.
  • No live production event has been reported through the committed code yet. Production has produced no request-path failure; a probe that sent a malformed payload was answered with a validated 400, so nothing raised to the boundary.

Limits

  • Coverage is the propagating set only. serve/server.py has 241 except sites, 63 of which pass, continue or log only. A handler that keeps its exception reports nothing, so a quiet tracker does not mean a watchful one. Many of those swallows are deliberate — a failed check must not stop a start — so widening coverage is a design decision, not part of this change.
  • The engine reports nothing at all; its failures live in stderr and the log.
  • If sentry-sdk is installed by hand it is not in requirements.txt, so a venv rebuild loses it and the module then only prints a failure line.
  • The app's privacy note (apps/host/src/components/PrivacyNotes.tsx: "Strata sends no usage telemetry") covers usage, not failures. It is left unchanged here because UI text is outside this change; if the note should carry the exception, that is a separate edit.

Disclosure

Prepared by Gnarl, the Operator's agent, at his instruction, on this account. AI-assisted work; every changed line is his own reading, and the numbers above are measured, not estimated. Two claims that were wrong during this work were corrected rather than left standing: an alert read as undeliverable from a hardcoded skipped, and a probe read as a failure because the tracker was queried before asynchronous delivery completed.

The commit is authored and committed under this account. Internal hosts and the DSN are kept out of this body and out of the code; the DSN lives in a private env file, mode 600.

Tracker: https://glitchtip.com/ · SDK: https://pypi.org/project/sentry-sdk/


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3896 **Author:** [@Faks](https://github.com/Faks) **Created:** 10/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/error-reporting-upstream` --- ### 📝 Commits (1) - [`46728ae`](https://github.com/Niko1221/Strata/commit/46728ae58604e92d1aa4340967d40bdaa3e59138) [Engine] opt-in error reporting for the server process (inert without a DSN) ### 📊 Changes **5 files changed** (+155 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+2 -1) 📝 `docs/SAFETY.md` (+8 -4) ➕ `serve/error_reporting.py` (+56 -0) 📝 `serve/server.py` (+4 -0) ➕ `tests/terminal/test_error_reporting.py` (+85 -0) </details> ### 📄 Description ## Problem and result `handle_error` in `serve/server.py` prints a traceback and continues, so a request-path failure stops there and nothing reaches an error tracker. With `serve/error_reporting.py` the server reports failures that reach the handler boundary, and only when a DSN is set. With no DSN the module does nothing at all, and the extra package is not installed by setup. The privacy page had to change too, because the change makes its headline claim false. [docs/SAFETY.md](docs/SAFETY.md) says "There is no telemetry. Strata sends no usage data, no crash reports and no analytics", and its "Does Strata phone home?" answer says a search of the code found no crash reporter. Once an opt-in reporter exists, that sentence is no longer true as written, so both are qualified to the default path, and the internet table gains the row for it — the table claims to list what was found in the code, and leaving this out would make it incomplete. ## Related discussion None. No issue was opened and no maintainer agreement on scope was sought before writing this. CONTRIBUTING asks for scope agreement on features; this is one, so a maintainer may reasonably ask for an issue first or return the PR. ## Approach - DSN from `STRATA_GLITCHTIP_DSN` or from `error_reporting.dsn` in the run config, matching how the server already reads optional settings. - `sentry-sdk` is **not** added to `requirements.txt`. That file is the pinned install `setup.py` runs for every user, and CONTRIBUTING keeps dependency changes out of a PR; a dependency serving an opt-in feature would become a hard requirement for everyone. The import is guarded, so a missing package prints one line and the server starts anyway. - `send_default_pii` stays off and tracing stays off: the report is about the failure, not the request content. - The default path is unchanged in behaviour when no DSN is set, but the files are not byte-identical, so CONTRIBUTING's "byte-identical default path" rule is met in behaviour, not literally in bytes. - Naming assumption: the variable names one product (`STRATA_GLITCHTIP_DSN`) while the SDK is Sentry-compatible and works against any Sentry-compatible tracker. A neutral name such as `STRATA_ERROR_REPORTING_DSN` may be preferred by maintainers. It is kept as written because that is what the deployment running this already uses. ## Validation **Passed:** - `python3 -m pytest tests/terminal/test_error_reporting.py -q` → `6 passed` on `46728ae5`, Linux, Python 3.13. Unit tests with the SDK mocked, no network, no GPU: inert without a DSN, DSN from the run config, missing package prints one line and does not stop a start, active with environment and release taken, capture needs an active client, a hang-up is not reported. - `import serve.server` with the new module: clean; `init()` returns `False` with no DSN. - Delivery against a live self-hosted tracker, through the committed module: a synthetic exception produced an issue, then an alert notification, then the alert send task ran with no error, and the recipients resolved to two subscribed team members. - Read from source, not assumed: the alert test endpoint returns `skipped` for email recipients because that is hardcoded — [apps/alerts/api.py line 179](https://gitlab.com/glitchtip/glitchtip-backend/-/blob/5c6889940436df182d929634bc455ecaccb10e93/apps/alerts/api.py#L179) — so a skipped test is the endpoint refusing to test email, not a broken alert. Email recipients are resolved as users on a team holding the project with a `UserProjectAlert` row or `subscribe_by_default` — [apps/users/models.py line 44](https://gitlab.com/glitchtip/glitchtip-backend/-/blob/5c6889940436df182d929634bc455ecaccb10e93/apps/users/models.py#L44). **Failed:** - Nothing observed on this change. **Not run:** - No GPU build: the change is Python only. - No CI run on this revision. - The full terminal suite could not be run on the host used here: the project venv has no `pytest`, and the system Python that has it lacks `rich` (9 collection errors). That is an environment limit, not a result for this change. - No live production event has been reported through the committed code yet. Production has produced no request-path failure; a probe that sent a malformed payload was answered with a validated `400`, so nothing raised to the boundary. ## Limits - **Coverage is the propagating set only.** `serve/server.py` has 241 `except` sites, 63 of which pass, continue or log only. A handler that keeps its exception reports nothing, so a quiet tracker does not mean a watchful one. Many of those swallows are deliberate — a failed check must not stop a start — so widening coverage is a design decision, not part of this change. - The engine reports nothing at all; its failures live in stderr and the log. - If `sentry-sdk` is installed by hand it is not in `requirements.txt`, so a venv rebuild loses it and the module then only prints a failure line. - The app's privacy note (`apps/host/src/components/PrivacyNotes.tsx`: "Strata sends no usage telemetry") covers usage, not failures. It is left unchanged here because UI text is outside this change; if the note should carry the exception, that is a separate edit. ## Disclosure Prepared by Gnarl, the Operator's agent, at his instruction, on this account. AI-assisted work; every changed line is his own reading, and the numbers above are measured, not estimated. Two claims that were wrong during this work were corrected rather than left standing: an alert read as undeliverable from a hardcoded `skipped`, and a probe read as a failure because the tracker was queried before asynchronous delivery completed. The commit is authored and committed under this account. Internal hosts and the DSN are kept out of this body and out of the code; the DSN lives in a private env file, mode 600. Tracker: https://glitchtip.com/ · SDK: https://pypi.org/project/sentry-sdk/ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:39:16 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4820
No description provided.