Feat/render reports hook#84
Open
rubenvanassche wants to merge 12 commits into
Open
Conversation
Adds Flare::renderReportsUsing() so a consumer (Ignition) can render an uncaught exception's report locally. The uncaught handler builds the report once and invokes the render callback before send-gating, so ignored or filtered exceptions still render locally while only sending when allowed. Handled exceptions reported via report()/reportHandled() never render.
- report() kept untouched; finalizeReport() added for the uncaught handler to send an already-built report. - FlareConfig gains a nullable $mode; FlareProvider uses it and falls back to the existing apiToken-based match, so current behaviour is unchanged when mode is null. - Ignition mode collects and builds locally but never transmits: Api gains a sendingDisabled guard, set when mode === Ignition. - Flare exposes its resolved $mode so consumers can read it.
Instead of a separate finalizeReport method, report() gains an optional $report parameter. The uncaught handler builds the report (so it can render it), then calls report(report: $report); the shouldReport ignore gating and filterReports still run before sending. Minimal, backward-compatible surface.
- Ignition mode now swaps in the existing NullSender instead of an Api sendingDisabled flag, so transmission is a no-op with no Api change. - report()'s first argument is a Throwable|ReportFactory union: pass a pre-built report and it is rendered first, then the ignore/filter gating runs. - renderAndReport is inlined: handleException/handleError build the report when a renderer is registered and hand it to report().
Key the no-op sender on token presence rather than FlareMode. Without a token there is nothing to authenticate with, so never transmit: reports and traces still build (and Ignition renders them) but the send is a no-op. Enabled mode with a token uses the configured sender as before.
Register Ignition's render callback on the FlareConfig (renderReportsUsing) so the Flare provider wires it into the reporter when it is built, matching how filterReportsCallable flows. Ignition no longer holds the Flare instance: it keeps only the Flare and Ignition configs and does the start/shutdown wiring in make().
The renderer is an integration hook (like gracefulSpanEnderClosure), not user config, so it lives on the FlareProvider constructor and Flare::make() forwards it. Removed from FlareConfig.
Renders any report that is not explicitly marked handled, so the global handlers can stay as plain report() and integrations do not need to thread handled: false. reportHandled()/handled: true stays silent.
Ignition constructs the FlareProvider itself to pass the renderer, so Flare::make() no longer needs to forward it.
mode is an integration decision, not user config: it becomes a FlareProvider constructor arg (falling back to the apiToken-based match when null) and is removed from FlareConfig. Flare::make() passes null, so its behaviour is unchanged.
The renderer is injected via the FlareProvider (and Reporter) constructor, so the Reporter::reportRenderer() setter and Flare::renderReportsUsing() are dead. Removed both; the renderer is now constructor-only, like mode.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.