Disable alert create/save in demo mode and catch submit errors #SUPERLOG - #467
Open
superlog-app[bot] wants to merge 1 commit into
Open
Disable alert create/save in demo mode and catch submit errors #SUPERLOG#467superlog-app[bot] wants to merge 1 commit into
superlog-app[bot] wants to merge 1 commit into
Conversation
Delivery-Id: e9c2f7234afed218d84028eb226172ffa09877fb43f7466da6c330d42ff01774 Delivery-Base: main
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.
Summary
Demo-exploring users navigating to
/alerts/new(or/alerts/:idto edit) could click Create / Save and receive a silent403: demo_read_onlyerror. Becausesubmit()is an async function passed directly asonClick, the rejected promise fromcreate.mutateAsync()was never caught, causing awindow.unhandledrejectionevent — recorded as abrowser.exceptionspan and surfaced as a monitoring incident.Root cause
The demo overlay middleware blocks
POST /api/projects/:projectId/alerts(andPATCH .../alerts/:id) for projects that are being served sample data, returning403 demo_read_only.mutateAsyncre-throws on non-2xx responses. Thesubmit()async function had no try/catch, so clicking Create produced an unhandled rejection with no UI feedback.Remediation
useDemoExploration().exploring(the same context already used bySettings.tsxandSetupTodos.tsxfor demo-aware UI).demoExploringis true, and show an explanatory message in the footer: "You're exploring demo data — connect your app to create alerts."mutateAsyncin try/catch so that any unexpected server error (including 403 if the guard is bypassed) is surfaced viacreate.error/update.errorin the UI rather than as an unhandled rejection.The alert preview endpoints (
alerts/previewandalerts/preview-series) are correctly listed inPOST_READ_SUBPATHSand are not affected — previews continue to work in demo mode.Fixes incident luminous-hedgehog —
Error: 403: demo_read_onlyon/alerts/new.Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Disable alert create/save in demo mode and surface submit errors to avoid unhandled promise rejections. Previously, clicking Create/Save in demo sent blocked requests (403 demo_read_only) and threw an unhandled rejection with no UI feedback; now the button is disabled in demo and errors are caught and shown.
useDemoExploration().exploring, disable Create/Save, and show: "You're exploring demo data — connect your app to create alerts."create.mutateAsync/update.mutateAsyncin try/catch and rendercreate.error/update.errorin the footer; no morewindow.unhandledrejection.alerts/preview*remain allowed).Written for commit dbc5b61. Summary will update on new commits.