fix(selfhost): route boot-time advisories through console.error so Sentry can see them - #6350
Conversation
…ntry can see them Advances #6325 -- covers the alerting half only; the issue stays open until the live PUBLIC_API_ORIGIN misconfiguration itself is corrected. sqliteBackupAdvisory and publicOriginReachabilityAdvisory both log via console.warn with the explicit intent to "warn LOUDLY" -- but installStructuredLogForwarding (wired inside initSentry) only intercepts console.log (forwarded only with an explicit level:error/fatal) and console.error (always forwarded); console.warn is never wrapped at all. Both advisories were therefore silently unreachable by Sentry regardless of whether Sentry was configured or the advisory condition was true. Confirmed live: the self-hosted instance reviewing JSONbored's own repos has PUBLIC_API_ORIGIN set to a bare Tailscale hostname (edge-nl-01.raccoon-bushi.ts.net) with no Funnel serve/funnel config enabled on that node (verified via `tailscale funnel status` / `tailscale serve status`, both "No serve config") -- genuinely, provably unreachable from GitHub's public image-fetching servers, not a false-positive Funnel case. publicOriginReachabilityAdvisory exists specifically to catch this (#4180), and PUBLIC_ORIGIN_ACKNOWLEDGED is unset on that box, so the advisory has been firing at every boot the whole time -- just never reaching anyone, because of this bug. Switches both advisories from console.warn to console.error. `level: "warn"` stays in the JSON payload, so this only changes which console method reaches the Sentry forwarder, not the reported severity (forwardStructuredLogToSentry still maps it to Sentry's "warning" level, not "error"). emptyConfigDirAdvisory has the identical bug but fires BEFORE initSentry in the boot sequence, so the same one-line fix doesn't help it -- that needs the Sentry-init call moved earlier, a distinct and slightly riskier change, tracked separately rather than scope-creeping into this PR. The live PUBLIC_API_ORIGIN value itself is unchanged by this PR -- fixing the actual misconfiguration (pointing it at a genuinely public origin, or enabling Funnel) is an infra decision for the operator, not a code change.
f5b3bb7 to
c345711
Compare
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-16 04:02:39 UTC
Review summary Nits — 5 non-blocking
Concerns raised — review before merging
📋 Copy for AI agents — paste into your coding agentDecision drivers
Context & advisory signals — never blocks the verdict
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6350 +/- ##
=======================================
Coverage 95.60% 95.60%
=======================================
Files 597 597
Lines 47191 47191
Branches 15019 15019
=======================================
Hits 45117 45117
Misses 1290 1290
Partials 784 784
Flags with carried forward coverage won't be shown. Click here to find out more. |
Summary
sqliteBackupAdvisoryandpublicOriginReachabilityAdvisoryboth log viaconsole.warnwith the explicit intent to "warn LOUDLY" — butinstallStructuredLogForwarding(wired insideinitSentry) only interceptsconsole.log(forwarded only with an explicitlevel:error/fatal) andconsole.error(always forwarded);console.warnis never wrapped at all. Both advisories were therefore silently unreachable by Sentry regardless of whether Sentry was configured or the advisory condition was true.PUBLIC_API_ORIGINset to a bare Tailscale (.ts.net) hostname, with no Funnel serve/funnel config enabled on that node (tailscale funnel status/tailscale serve statusboth report "No serve config") — genuinely, provably unreachable from GitHub's public image-fetching servers, not a false-positive Funnel case.publicOriginReachabilityAdvisoryexists specifically to catch this (test(ui): add AGPL-3.0 badge to footer to validate visual-capture pipeline #4180), andPUBLIC_ORIGIN_ACKNOWLEDGEDis unset on that box, so the advisory has been firing at every boot the whole time — just never reaching anyone, because of this bug.console.warntoconsole.error.level: "warn"stays in the JSON payload, so this only changes which console method reaches the Sentry forwarder, not the reported severity (forwardStructuredLogToSentrystill maps it to Sentry's "warning" level, not "error").emptyConfigDirAdvisoryhas the identical bug but fires beforeinitSentryin the boot sequence, so the same one-line fix doesn't help it — that needs the Sentry-init call moved earlier, a distinct and slightly riskier change. Flagged as a separate follow-up rather than scope-creeping into this PR.The live
PUBLIC_API_ORIGINvalue itself is unchanged by this PR — fixing the actual misconfiguration (pointing it at a genuinely public origin, or enabling Funnel) is an infra decision for the operator, not a code change, and I don't have enough context on the intended DNS/reverse-proxy setup to make that call myself.Advances #6325 — this PR only covers the alerting half (the advisory is now Sentry-visible). The issue stays open until the actual
PUBLIC_API_ORIGINvalue is corrected and a real PR's screenshot confirms "after" renders correctly, per the issue's own remaining deliverables.Test plan
test/unit/selfhost-health.test.ts(the purepublicOriginReachabilityAdvisory/sqliteBackupAdvisoryfunction tests, untouched by this wiring-only change) — 36 tests pass unchangedtest/unit/docs-selfhost-sentry-observability.test.ts— 4 tests pass unchangedsrc/server.tsis Codecov-exempt (seecodecov.yml'signore:list), so this doesn't need new coveragenpm run typecheckcleannpm run test:cigate green