Skip to content

feat: bridge legacy reads and saves for migrated sites - #344

Merged
kptdobe merged 8 commits into
mainfrom
feat/hlx6-legacy-api-bridge
Nov 24, 2026
Merged

kptdobe merged 8 commits into
mainfrom
feat/hlx6-legacy-api-bridge

Conversation

@kptdobe

@kptdobe kptdobe commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Replace the migrated-site 410 gate with a synchronous compatibility adapter for the supported DA read/save contracts. This lets existing Library references and simple source/config clients continue using legacy DA URLs after HLX6 cutover.

Supported scope

  • Source GET/HEAD with streamed bodies, ETag/Last-Modified and conditional-read adaptation.
  • Site/folder listings converted to the existing DA fields and hidden-item rules.
  • Mixed-org listings combining legacy DA sites with the org's bridged HLX6 sites (GET /{org}/source/ entries that are in HLX6_MIGRATED_SITES, caller token, 3s timeout), filtered by DA ACLs, without repeating them on later DA pages. If the HLX6 listing fails, the DA listing is still returned.
  • Editor-config GET and multipart PUT/POST conversions targeting only config/editor/da.json.
  • Multipart/raw source PUT/POST converted to HLX6 POST, with legacy success URL envelopes and canonical Location handling. String data fields are limited to .html, .json and .svg; upstream redirects return 502.
  • Bodyless folder creation via trailing-slash POST.

Safety and limitations

  • Only sites listed in HLX6_MIGRATED_SITES are bridged: DA stops serving them from its own storage and proxies supported operations to api.aem.live. HLX6_DUAL_WRITES is unchanged (a site listed there keeps normal DA behavior, even if also listed as migrated).
  • Retain DA authentication/ACL gates AND require the original caller Bearer token to satisfy HLX6 permissions. No privileged service credentials.
  • Await upstream results; propagate failures; never retry uncertain mutations or write fallback content to R2/KV.
  • Block legacy copy/move into migrated destinations before storage changes.
  • Keep versions/history, copy/move/delete, dedicated media uploads, GUID-specified/collaborative writes and extensionless file writes unsupported. Reject multiple-author tokens explicitly.
  • Do not invent DA UUID or permission-hint headers. HLX6 validation, payload limits and restore-point semantics still differ.
  • Org config remains local; this does not change editor org-config inheritance or rewrite stored URLs.

Validation

  • npm test -- --reporter dot: 689 passing; existing coverage thresholds passed.
  • npm run lint: passed.
  • Focused tests cover payload/response conversion, conditions, canonical paths, pagination, caller auth, denied writes, upstream failures and unsupported operations.
  • No deployment or production mutation performed.

Rollout

A companion da-content PR routes migrated content through the daadmin binding before direct-R2 allowlists/asset opt-outs. Deploy this da-admin bridge first and synchronize both migration variables on the two workers using dashboard configuration.

Companion PR: adobe/da-content#34. Deploy da-admin first.

Keep legacy DA clients usable after HLX6 cutover.
Require DA ACLs and caller-token HLX6 permissions.
Reject unsupported operations instead of writing stale storage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

kptdobe and others added 5 commits November 23, 2026 11:23
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Build org listings from config so they no longer depend on HLX6.
Forward preconditions only for source reads/saves; reject redirects.
Guard malformed save Locations and map string upload types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Merge DA sites with GET /{org}/source/ and configured migrated sites.
Fall back to DA plus configured sites when HLX6 listing fails.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Drop Helix 6 naming from client-facing error messages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The HLX6 org source listing already includes migrated sites.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kptdobe
kptdobe requested a review from bosschaert November 23, 2026 14:49
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bosschaert

Copy link
Copy Markdown
Contributor

Review

Overall the design is sound: DA ACLs and the caller's token are both required, failed or uncertain writes are never retried, and nothing falls back to writing in DA storage. Lint passes and the unit tests pass (686).

Should fix

  1. Org listings include HLX6 sites that aren't bridged (hlx6.js#L234). GET /{org}/source/ returns every HLX6 site, but only sites in HLX6_MIGRATED_SITES are bridged (isHlx6Site). For any other HLX6 site (like hlx6only in the tests), opening it shows DA's own storage, which is empty, and saves are written there instead of to HLX6. This also only happens in orgs that already have at least one migrated site. Suggest either limiting the list to migrated sites or bridging every site that is listed.
  2. Slow upstream can stall org listings for 20s (hlx6.js#L104). The org listing is meant to be best effort, but it uses the same 20s timeout as writes. If api.aem.live is slow, every org listing in an org with a migrated site waits up to 20s. A 2–5s timeout would be safer.

Minor (reproduced with local probe tests)

  1. A 204 reply drops the response body (hlx6.js#L56). adaptedResponse drops the body when the status is 204, so if HLX6 answers a save or config write with 204, the client gets an empty body instead of DA's usual JSON with the edit/preview/live URLs. Consider normalizing to 200/201 when returning that JSON.
  2. A malformed Location causes a 500 after a successful save (hlx6.js#L396). new URL(location, …) sits outside the try, so a bad absolute URL (e.g. http://[bad) throws. The client gets a generic 500 from index.js without the "do not blindly retry" message.
  3. Org listing dedupe matches on name only (hlx6.js#L265, #L271). A root file like /org/site.json is dropped when site is an HLX6 site, and a folder plus file with the same name (notes and notes.json) collapse into one entry. Matching on folders only (!item.ext) or on the full path would avoid this.

Nit

  • Missing content type on file uploads (hlx6.js#L375). If an uploaded file has no type, no content-type is sent upstream. It could fall back to TEXT_UPLOAD_TYPES[daCtx.ext].

List only bridged HLX6 sites in org listings, with a 3s timeout.
Dedupe org entries by path; keep save JSON on upstream 204.
Guard unparseable save Locations; infer untyped upload types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kptdobe

kptdobe commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @bosschaert, all addressed in a1155ac:

  1. Unbridged HLX6 sites in org listings — the org listing now only includes GET /{org}/source/ entries that are also in HLX6_MIGRATED_SITES, so every listed site opens through the bridge.
  2. 20s stall — the org listing call uses a 3s timeout and falls back to the DA listing. Reads/writes keep 20s.
  3. 204 drops the JSON — a 204 on source save or config write is returned as 200 with DA's usual JSON.
  4. Malformed Location — URL parsing and the origin/prefix check are now inside the same try; http://[bad gets the 502 "do not blindly retry" response.
  5. Name-only dedupe — only site folders are replaced by HLX6 entries, and the final dedupe uses the full path, so site.json and notes/notes.json stay separate.
  • Nit — untyped file parts (which the multipart parser reports as application/octet-stream) fall back to the extension type for .html, .json and .svg.

Each has a regression test (689 passing, hlx6.js fully covered).

@bosschaert

Copy link
Copy Markdown
Contributor

Maybe look at the Build / Test Deploy failure 😄

@kptdobe
kptdobe merged commit c96cb13 into main Nov 24, 2026
8 of 9 checks passed
@kptdobe
kptdobe deleted the feat/hlx6-legacy-api-bridge branch November 24, 2026 08:04
adobe-bot pushed a commit that referenced this pull request Nov 24, 2026
# [1.17.0](v1.16.5...v1.17.0) (2026-11-24)

### Features

* bridge legacy reads and saves for migrated sites ([#344](#344)) ([c96cb13](c96cb13))
@adobe-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants