Skip to content

fix(site-import): honour alt text, script order, folders, and re-imports - #480

Merged
DavidBabinec merged 3 commits into
mainfrom
fix/site-import-fidelity
Sep 2, 2026
Merged

fix(site-import): honour alt text, script order, folders, and re-imports#480
DavidBabinec merged 3 commits into
mainfrom
fix/site-import-fidelity

Conversation

@DavidBabinec

@DavidBabinec DavidBabinec commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #403
Fixes #404
Fixes #409
Fixes #411
Fixes #412

Summary

Five static-import defects from real theme imports. Image alt, loading, decoding and fetchpriority were dropped, so a 30-image import left 30 blank alts. A script shared by two pages took its priority from whichever page sorted first, so app.js loaded before vendor.js. Importing a site twice appended every ambient rule again. A folder API failure after a successful upload rejected the upload, leaving pages on their bundle paths. A run that lost 8 of 30 uploads finished as 22/22.

Script priorities now come from a topological merge of every page's document order (scriptOrder.ts), with a script-order-conflict warning when pages disagree. Rules carry origin (stylesheet + ordinal) and putStyleRule replaces a same-origin, same-selector rule in place. Alt rides with the asset into the upload as an altText form part; the perf hints map onto the Image props. Folder placement is best-effort and reports asset-folder-failed. The done state keeps the planned total (22 / 30), opens the log, and toasts a warning.

Class rules still go through the Conflicts step on re-import; only ambient rules reconcile by origin. Re-import identity is origin plus selector, since a renamed class rule keeps the origin it came from.

Verification

  • bun run build (clean)
  • bun test (6803 pass, 0 fail)
  • bun run lint (clean)
  • Docker/deployment check, if relevant (not relevant)

Checklist

  • Tests cover behavior changes.
  • Docs were updated when behavior, config, deployment, or public surfaces changed.
  • No compatibility shim was added for old pre-release behavior.
  • No secrets, local databases, uploads, or generated artifacts are included.

Real theme imports lost authored image attributes, loaded a shared script
before its dependency because one global counter numbered it on first
sight, stacked every ambient rule again on re-import, turned a folder API
blip into a lost upload, and reported 22 of 30 uploads as 22/22. Each
fix lands at its source: the planner, the walker, the store transaction,
the upload adapter, and the progress model.
The mapping table and the key-details list still said the img rule keeps
src only and drops alt, which PR 480 changed: the perf hints map onto the
Image props and alt travels to the media record through imageAlts.
A class rule the Conflicts step renamed keeps the origin of the rule it
came from, so origin alone is not unique in the registry and an index
keyed on it kept whichever same-origin rule came last. The selector is
now part of the key. Also: the rule-conflict row shows the source
stylesheet, the site-import doc no longer claims class rules are a
no-op on re-import, and two comments the earlier commits left wrong
are corrected.
@DavidBabinec
DavidBabinec marked this pull request as ready for review September 2, 2026 15:11
@DavidBabinec
DavidBabinec merged commit aff69a7 into main Sep 2, 2026
9 checks passed
@DavidBabinec
DavidBabinec deleted the fix/site-import-fidelity branch September 2, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment