Skip to content

DISCO-282: Report why the local preview doesn't load - #462

Open
Philipp Koytek (philippkoytek) wants to merge 6 commits into
mainfrom
DISCO-282-preview-app-reporter
Open

Philipp Koytek (philippkoytek) wants to merge 6 commits into
mainfrom
DISCO-282-preview-app-reporter

Conversation

@philippkoytek

@philippkoytek Philipp Koytek (philippkoytek) commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

content-cli sdk preview now injects a small reporter script as the first element of every proxied HTML page and adds its SHA-256 hash to script-src. The app's own inline scripts stay blocked unless --allow-inline-scripts is passed.

The reporter posts to the Celonis preview that the page loaded, how many inline scripts the preview blocks, and which uncaught errors, rejections and CSP violations stopped the app. With that, the Codehub Local preview can show the matching hint right away instead of waiting for the SDK: preview not reachable, inline scripts blocked, or the app's error.

  • preview-app-reporter.ts: the reporter script and injectAppReporter(). The proxy computes the hash at runtime, so LOCAL_PREVIEW_HEADERS stays equal to the headers the Celonis gateway serves.
  • The report messages are the contract with the Celonis preview; the spec runs the script and checks them.
  • Safe to release before or after the matching Celonis preview change: without it, nothing listens to the reports.

Relevant links

Checklist

  • I have self-reviewed this PR
  • I have tested the change and proved that it works in different scenarios (Chrome with a Vite + React app: preview not running, untrusted certificate, inline scripts blocked and allowed, localStorage error, blocked external request)
  • I have updated docs if needed

Co-Authored-By: Claude noreply@anthropic.com
Includes-AI-Code: true

sdk preview now adds the Celonis app reporter as the first element of
every proxied HTML page and allows it by its hash in the preview CSP.
The reporter tells the Celonis preview that the page loaded, how many
inline scripts the preview blocks, and which errors stopped the app, so
the Codehub can show the matching hint right away.

Co-Authored-By: Claude <noreply@anthropic.com>
Includes-AI-Code: true
The reporter is copied from ems-frontend's SANDBOX_APP_REPORTER, which
is now built from typed observers. The proxy hashes the copy it injects
and adds that hash to script-src, so LOCAL_PREVIEW_HEADERS stays equal to
ems-frontend's localPreviewHeaders(). The spec checks the report
messages, which are the contract with ems-frontend.

Co-Authored-By: Claude <noreply@anthropic.com>
Includes-AI-Code: true
Co-Authored-By: Claude <noreply@anthropic.com>
Includes-AI-Code: true
@philippkoytek
Philipp Koytek (philippkoytek) marked this pull request as ready for review November 11, 2026 17:54
Co-Authored-By: Claude <noreply@anthropic.com>
Includes-AI-Code: true
Co-Authored-By: Claude <noreply@anthropic.com>
Includes-AI-Code: true
Co-Authored-By: Claude <noreply@anthropic.com>
Includes-AI-Code: true
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants