Skip to content

[codex] Structure preview asset URL failures#3399

Open
juliusmarminge wants to merge 1 commit into
codex/stack-pr-3259from
codex/web-preview-error-context
Open

[codex] Structure preview asset URL failures#3399
juliusmarminge wants to merge 1 commit into
codex/stack-pr-3259from
codex/web-preview-error-context

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • replace malformed preview asset URL defects with BrowserPreviewAssetUrlInvalidError
  • preserve the exact URL parser cause for the full failure chain
  • attach safe environment, thread, file, URL-length, and expiry diagnostics; do not store the signed relative URL or raw base URL as direct structured attributes
  • cover cause identity and absence of direct raw URL attributes with a focused regression test

Scope

Stack dependency

Validation

  • pnpm vp test apps/web/src/browser/openFileInPreview.test.ts
  • pnpm vp check
  • pnpm vp run typecheck

Note

Low Risk
Localized change to browser preview URL resolution and error typing; improves observability without altering happy-path preview behavior.

Overview
openFileInPreview no longer treats a bad preview asset URL as an unstructured defect. When new URL(relativeUrl, httpBaseUrl) throws, the flow returns BrowserPreviewAssetUrlInvalidError via Cause.fail, with environment/thread/file context, URL length and expiry metadata, and the original parser error as cause—without putting the raw base URL or signed relative path on the error object.

The return type and a Schema.is guard are added for this error. A new unit test asserts cause identity, safe fields, and that serialized errors do not leak signed URL tokens; preview is not opened on failure.

Reviewed by Cursor Bugbot for commit 087f4d1. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 74deb801-26bc-4432-b93d-3afc689a845e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/web-preview-error-context

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Straightforward error handling improvement that converts an unstructured panic into a structured error class. The new error intentionally captures URL lengths rather than actual values to prevent leaking sensitive tokens, and includes comprehensive test coverage.

No code changes detected at 087f4d1. Prior analysis still applies.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge juliusmarminge force-pushed the codex/web-preview-error-context branch from 6989347 to 199dc14 Compare June 20, 2026 15:36
@juliusmarminge juliusmarminge changed the title refactor(web): add structured preview errors [codex] Structure browser preview open failures Jun 20, 2026
@juliusmarminge juliusmarminge changed the base branch from main to codex/web-markdown-action-errors June 20, 2026 15:36
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 15:36

Dismissing prior approval to re-evaluate 199dc14

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge juliusmarminge force-pushed the codex/web-preview-error-context branch from 199dc14 to c048ffe Compare June 20, 2026 15:43
@juliusmarminge juliusmarminge changed the base branch from codex/web-markdown-action-errors to codex/stack-pr-3259 June 20, 2026 15:43
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 15:43

Dismissing prior approval to re-evaluate c048ffe

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
@juliusmarminge juliusmarminge changed the title [codex] Structure browser preview open failures [codex] Structure preview asset URL failures Jun 20, 2026
@juliusmarminge juliusmarminge force-pushed the codex/web-preview-error-context branch from c048ffe to 215b085 Compare June 20, 2026 22:48
@juliusmarminge juliusmarminge force-pushed the codex/web-preview-error-context branch from 215b085 to 8751fdb Compare June 20, 2026 22:50
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge juliusmarminge force-pushed the codex/web-preview-error-context branch from 8751fdb to 087f4d1 Compare June 20, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant