Skip to content

fix(canvas): route the canvas to the site's content store - #1249

Merged
mhaack merged 20 commits into
mainfrom
ewhlx6
Aug 20, 2026
Merged

fix(canvas): route the canvas to the site's content store#1249
mhaack merged 20 commits into
mainfrom
ewhlx6

Conversation

@benpeter

@benpeter benpeter commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Description

This pull request prepares EW Canvas for HLX6. Incl. site panels like files, outline, layout editing etc.

Test together with adobe/da-nx#672

before

blocks/browse/da-list and blocks/edit already routed through nx2's isHlx6. blocks/canvas
did not: it built its source url against da-admin regardless of the site's store. that produced
three outcomes on a source-bus site:

  • da-admin 403, shown as Not permitted
  • da-admin 404, passed through as loadable, so the canvas was left blank over a document that
    exists
  • da-admin 200 from a pre-migration copy, which was then edited and saved in the canvas, since
    prose.js:97 named the room ${DA_ADMIN}${pathname}

now

  • buildSourceUrl is async now and routes through nx2's isHlx6. initProse names the collab
    room with that url instead of rebuilding one against da-admin
  • resolveEditorDocSession takes the ctx, not a built url. it confirms sign-in first, so an
    anonymous visit skips the isHlx6 probe
  • the source bus is read with nx2's daFetch. da-admin is read with da-live's own fetch, for the
    live token read and the 401 retry
  • sessionErrorFromResponse reports a non-401/403 status with its code and x-error, rather than
    folding it into Not permitted
  • source.uploadMedia is used across the four upload paths, and the src is taken from the
    response, per fix: upload dropped images via source.uploadMedia #1219 and fix: upload pasted base64 images via source.uploadMedia #1227
  • mediaBusImage renders ./media_ from getPreviewOrigin, the origin the canvas fetches its
    cookie from, per fix(prose): render relative media_ image src from preview origin #1226
  • getSourceUploadContext reads both url shapes

Related Issue

part of #1141. the media browser half is #1066.

Testing

live on a source-bus site and a legacy site:

  • HEAD https://api.aem.live/{org}/sites/{site}/source/canvas-test.html was answered with 200, and
    no Not permitted was shown. the collab room was named with that same url and reported
    synced: true
  • a ./media_ src is rendered from stage-preview.da.live, with the relative path left in the
    node attrs. an absolute src is untouched
  • a ./media_ src is written on drop, paste, toolbar and wysiwyg replace. upload
    POST https://api.aem.live/{org}/sites/{site}/media/.canvas-test/dropped.png 200
  • saved to api.aem.live, no content.da.live in the document, admin.da.live 404 for that path
    throughout
  • legacy: the collab room was named on admin.da.live, and a drop was answered with 201 at
    POST https://admin.da.live/source/{org}/{site}/.canvas-test/legacy-drop.png

on localhost the dropped image is not rendered on a legacy site. the read-back is answered with
401, because content.da.live/.gimme_cookie fails with net::ERR_FAILED from a localhost origin,
so the FPO placeholder is not replaced. the same happens on origin/main, served on a second port,
so this predates the branch.

Known limitations

  • [not new] a save is refused on the source bus once a second editor joins the room. da-collab comma-joins
    the connections' Authorization and helix parses one pair, so the write is unauthenticated
  • [not new] isHlx6 caches a legacy answer in module memory for the life of the tab (api.js:629). a site
    migrated mid-session is read as legacy until reload
  • nx2's fetcher is used for the doc-pane uploads. it snapshots the token at page load and does not
    retry a 401. checkDoc uses da-live's own fetcher instead
  • [not new] canWrite is optimistic on the source bus. status.get would answer it, at one request per
    open

Test:

@aem-code-sync

aem-code-sync Bot commented Aug 15, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@benpeter
benpeter marked this pull request as ready for review August 15, 2026 20:12
@benpeter benpeter added the ew Experience Workspace label Aug 15, 2026
mhaack added 2 commits August 17, 2026 11:53
fetchDaConfigs previously always hit admin.da.live/config/... directly
via the legacy daFetch helper, bypassing the isHlx6-aware routing the
rest of the canvas/edit/browse migration already uses (source, status,
versions, etc). It now calls getNx2Api().config.get({org, site}),
which pings isHlx6 and, once nx2's config route is fully HLX6-aware,
will resolve to the site's real store the same way source.get/save
already do. Behavior for legacy (non-upgraded) sites is unchanged.

Every getNx2Api().config.get call pings isHlx6 first (an extra
HLX_ADMIN/ping/{org}/{site} fetch), which several existing test mocks
didn't account for (some also matched on a shorter config URL pattern
that collided with the ping's own /org/site/ path). Updated those
mocks in aem-assets.test.js, edit/da-assets/config.test.js,
edit/da-content/helpers/index.test.js, browse/da-browse.test.js and
edit/prose/plugins/imageFocalPoint.test.js to answer the ping safely,
and added direct coverage for the new routing in
blocks/shared/utils.test.js.
getPreviewStatus in ew-panel-extensions/helpers.js still hit legacy
admin.hlx.page direct via aemAdmin(), no isHlx6 branch. Mirrors the
already-fixed sibling in blocks/edit/da-library/helpers/helpers.js:
now uses getNx2Api().status.get(path), which resolves to the site's
real store (admin.hlx.page or api.aem.live) based on isHlx6. Response
shape (json.preview.status) unchanged.
Comment thread blocks/canvas/ew-editor-doc/utils/ctx.js
hannessolo
hannessolo previously approved these changes Aug 18, 2026
@mhaack

mhaack commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

LGTM as well, as discussed we will need to add the toast for the image upload failures. Otherwise 👍

red: the size guard and its toast do not exist yet
the api service 413s above ~4.5mb and that 413 has no cors header, so the
browser saw a network error and the fpo sat on loading
da-admin took a 120mb body in the same probe, so the cap is the api
service's and a legacy site keeps taking large images
sourceUrlFromEditorCtx only passed ctx.path through; source.test.js
already covers what its two tests did
@benpeter
benpeter requested a review from hannessolo August 18, 2026 12:30
@mhaack
mhaack merged commit 0860823 into main Aug 20, 2026
5 checks passed
@mhaack
mhaack deleted the ewhlx6 branch August 20, 2026 13:45
@mhaack
mhaack restored the ewhlx6 branch August 20, 2026 14:49
@mhaack
mhaack deleted the ewhlx6 branch August 20, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ew Experience Workspace

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants