Skip to content

fix(web): apply render_mode from access-link live updates (AP-317)#558

Open
isuttell wants to merge 1 commit into
mainfrom
cursor/fix-share-link-stale-render-mode-c412
Open

fix(web): apply render_mode from access-link live updates (AP-317)#558
isuttell wants to merge 1 commit into
mainfrom
cursor/fix-share-link-stale-render-mode-c412

Conversation

@isuttell

@isuttell isuttell commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a pre-existing bug where the share-link viewer (/al/$publicId) only applied pointer.iframe_src on live updates, leaving render_mode (and title) stale until a full page reload.

Changes

  • apps/web/src/routes/al.$publicId.tsx: On onPointer, merge render_mode and title from LiveUpdatePointer into resolved viewer state alongside iframe_src.
  • apps/web/test/viewer-live-revoked.test.tsx: Add contract test asserting a markdown → html live revision updates the brand bar without reload.

Testing

cd apps/web && pnpm exec vitest run test/viewer-live-revoked.test.tsx

Closes AP-317.

Linear Issue: AP-317

Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes

    • Access Link viewer now properly updates render mode and title during live updates.
  • Tests

    • Added test coverage for Access Link viewer live update behavior.

When a live update publishes a revision with a different render mode,
the share-link viewer now updates render_mode and title from the pointer
alongside iframe_src. Previously only iframe_src was copied, leaving
AccessLinkBrandBar stale until a full reload.

Adds a contract test asserting markdown → html mode flips without reload.
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The live-update handler in the Access Link viewer route now propagates render_mode and title from incoming pointer updates into the resolved viewer state, in addition to the existing iframe_src update. A new test case verifies that a live pointer triggers a switch from markdown to html render mode with the correct iframe src.

Changes

Access Link Live Pointer Update

Layer / File(s) Summary
Live update handler and render_mode/title propagation
apps/web/src/routes/al.$publicId.tsx, apps/web/test/viewer-live-revoked.test.tsx
The onPointer handler for resolved viewers now copies render_mode and title from the incoming pointer. A new test confirms the iframe src and displayed render mode switch from markdown to html while markdown content is removed.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • zaks-io/agent-paste#474: Overlaps in the live viewer onPointer update path, driving iframe/viewer state from pointer metadata including render_mode.
  • zaks-io/agent-paste#487: Both touch the /al/$publicId Access Link viewer to reflect render_mode/title in the viewer during live updates.
  • zaks-io/agent-paste#498: Coupled around live-update render_mode propagation — this PR updates resolved fields from incoming pointers while that PR ensures server-side payloads preserve render_mode.

Poem

🐇 Two fields hopped into the viewer's ear,
render_mode and title now update clear.
The iframe shifts from markdown to html with grace,
A live pointer lands, changing state in place.
No markdown remains — html takes the space! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and clearly summarizes the main fix: applying render_mode from access-link live updates, and is appropriately concise.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/fix-share-link-stale-render-mode-c412

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/test/viewer-live-revoked.test.tsx`:
- Around line 220-223: The test is missing an assertion to validate that the
live title is properly propagated to the brand-bar metadata. After the existing
expect statements that check the iframe src attribute and the presence of "html"
text, add an additional assertion that verifies the title in the brand-bar
metadata has been updated correctly to complete the contract validation for this
regression test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c364fda8-89f3-40ca-819e-c942e2c6c2d4

📥 Commits

Reviewing files that changed from the base of the PR and between 4a96a18 and a1709ee.

📒 Files selected for processing (2)
  • apps/web/src/routes/al.$publicId.tsx
  • apps/web/test/viewer-live-revoked.test.tsx

Comment on lines +220 to +223
await waitFor(() => expect(screen.getByTitle("Artifact content")).toHaveAttribute("src", nextIframeSrc));
expect(screen.getByText("html")).toBeInTheDocument();
expect(screen.queryByText("markdown")).not.toBeInTheDocument();
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Assert live title propagation in this new regression test.

This test validates render_mode and iframe_src, but the PR also changes live title updates. Add a post-pointer assertion for the updated title in the brand-bar metadata to lock the full contract.

Suggested patch
     await waitFor(() => expect(screen.getByTitle("Artifact content")).toHaveAttribute("src", nextIframeSrc));
     expect(screen.getByText("html")).toBeInTheDocument();
     expect(screen.queryByText("markdown")).not.toBeInTheDocument();
+    expect(screen.getByText("Shared artifact")).toBeInTheDocument();
   });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await waitFor(() => expect(screen.getByTitle("Artifact content")).toHaveAttribute("src", nextIframeSrc));
expect(screen.getByText("html")).toBeInTheDocument();
expect(screen.queryByText("markdown")).not.toBeInTheDocument();
});
await waitFor(() => expect(screen.getByTitle("Artifact content")).toHaveAttribute("src", nextIframeSrc));
expect(screen.getByText("html")).toBeInTheDocument();
expect(screen.queryByText("markdown")).not.toBeInTheDocument();
expect(screen.getByText("Shared artifact")).toBeInTheDocument();
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/test/viewer-live-revoked.test.tsx` around lines 220 - 223, The test
is missing an assertion to validate that the live title is properly propagated
to the brand-bar metadata. After the existing expect statements that check the
iframe src attribute and the presence of "html" text, add an additional
assertion that verifies the title in the brand-bar metadata has been updated
correctly to complete the contract validation for this regression test.

@cursor cursor Bot marked this pull request as ready for review June 18, 2026 13:04

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First-pass review (AP-317)

Risk: simple
Decision: approve

Ticket triage

  • Intended change: Share-link viewer (/al/$publicId) should apply render_mode (and other revision-scoped pointer fields) from live-update SSE events, not only iframe_src.
  • Scope match: Yes — two-line state merge fix plus a focused regression test.

Review findings

Blocking: none

Non-blocking:

  • title is also synced from the pointer, which matches LiveUpdatePointer and prevents a similar stale-metadata bug if a publish renames the artifact.
  • A title-only live update is untested, but the ticket only required a render_mode contract test.

Merge checklist

  • Ticket linked and understood: AP-317
  • PR scope matches ticket: yes
  • Checks green: Validate, Postgres smoke, CodeQL, secret scan
  • Tests/docs appropriate: new vitest case covers markdown → html mode flip via AccessLinkBrandBar
  • No blocking findings
  • No high-risk areas (public viewer state sync only; no auth/billing/infra)
  • Merge-safe: yes

Why this is safe

The live-update handler now mirrors all display-relevant LiveUpdatePointer fields already consumed by AccessLinkBrandBar (iframe_src, render_mode, title). The test exercises the reported bug path (stale render_mode in the floating metadata panel) and confirms the iframe src still updates.

Open in Web View Automation 

Sent by Cursor Automation: First Pass PR Reviewer

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.

2 participants