Skip to content

[experimental] export: a path from the site's root reads public/ only, and its images come back with --reverse - #12275

Merged
josephfarina merged 1 commit into
mainfrom
josephfarina/render-public-images
Nov 18, 2026
Merged

josephfarina merged 1 commit into
mainfrom
josephfarina/render-public-images

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A page that names an image by a path from the site's root, as Vite and other bundlers serve public/ (<img src="/pics/shoe.png">), rendered a file with a broken image whenever its public/ was not where the render looked. A site folder below a shared package.json, or a page outside a project whose public/ sits above its folder, lost its images, and an image the page draws only after the first paint was never carried.

Problem and solution fit

  1. Why it occurs: before this change, render looked in the project's public/ first, then in the project's folder; a project often keeps public/ in a site folder below a shared package.json, or has none.
  2. Why it harms the task: the page's images are missing in the shared file, with no warning that names why.
  3. Why that matters: templates and agent-made pages name their images this way.

A / path now resolves only from a public/ folder: the project's, else the nearest one above the page inside the project or the folder the command runs in; the search stops there, or at the filesystem root. A path that climbs out of public/ (/../secret.png) names no file, and a file at the site's root outside public/ is no longer read. The image is carried with the page's other files, and the source record names the public/ the render read (publicDir, optional, no format change), so --reverse puts it back under that public/ at the same path. An image the page names in its code but draws only after the first paint is carried too, and the script shows the file the string names from the page's folder, as the browser and the first paint read it; a file beside the naming module is still carried for --reverse. A / path to no file warns: "/x.png was not found in public/, where a path from the site's root is read, so it is left as is and will not show." Only the image resolver reads the site's folder; tsconfig.json, StyleX and the paths in messages keep the project's folder.

Expected behavior and authority

  • astryx experimental export (experimental, spec:AST-017 FR27). No record changes; the render guide names where a / path comes from.
  • The maintainers decided the rule (one resolver for markup and CSS, public/ only).

Smallest restoration

  • foundation/render/render-page.mjs: siteRootOf(dir, scope), used by the asset resolver's context; assetRef resolves / paths inside public/ only; root-relative files join the carried files, also those the page names only in code.
  • foundation/render/embedded-imports.mjs: the carried-text scan reads / paths too, and --reverse expects them back under the nearest public/.
  • assets/docs/tree/export-pages.doc.mjs: one sentence on / paths.

Evidence

  • render.test.mjs: outside a project, a page names /pics/shoe.png in markup and in a CSS url(); the file shows both as data: URIs, --reverse puts the image back under public/, and the restored folder renders again with no missing-image warning. /../secret.png, /top.png (a file at the root, not in public/) and /gone.png each warn, and nothing is carried. A site folder inside a shared project finds its own public/.
  • render.interactive.test.mjs: a page that names /pics/shoe.png by a string shows the data: URI once the script draws the page.
  • render.interactive.test.mjs: a click shows /pics/later.png and ./near.png, which the first paint does not draw; both are data: URIs, and --reverse is exact with both files back. Three unit tests check where --reverse expects a / file back.
  • On a frozen set of 22 pages that name public images (a project with src/pages/p and public/; the file reversed alone in an empty folder; every source file compared byte for byte): 1 of 22 exact before, 22 of 22 after. The missing and traversal cases warn and carry nothing.
  • The outside-a-project test fails on the base; the traversal and no-public/ test passes on the base, which already refused those paths in that layout.
  • A render run from / outside a project, of a page with /none.png and no public/, finishes and warns.
  • Two components in different folders that each name ./photo.png: after the click both show the page folder's file, and --reverse is exact with each module's own photo.png back beside it.
  • The recorded public/ wins over a nearer one; a record that names ../public, /public, a path through .., a missing folder or a non-string is ignored.

Scope

Components: astryx experimental export

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run --project node packages/cli/api/render packages/cli/foundation/render packages/cli/assets (all pass at this head).

@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 18, 2026 4:03pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 4:19 PM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: an image named from the site's root now finds a site folder's public/ and comes back with --reverse, but seven defects need fixing, and both new behaviors need an engineering owner's decision before approval.

  • The site-root lookup never stops when the folder the page's files are carried from is the filesystem root, so a render run from / outside a project (or in a project whose package.json sits at / with no public/) hangs with no output; stop the walk at that folder or at the filesystem root and add a test (render-page.mjs:158).
  • An image drawn only after the first paint is resolved from the naming module's folder but rewritten by its string alone, so two components in different folders that each name ./photo.png both show the first one's file; resolve the string from the page's folder as the first paint does and add a two-folder test (render-page.mjs:1387-1398).
  • --reverse picks the nearest carried public/ while the render read the project's public/ first, so a page that also carries a file from a nearer public/ comes back reported as not exact, naming as missing a file it restored; record the public/ the render read and have the reverse use it (embedded-imports.mjs:343-353).
  • The changeset and title present / images from the project's public/ as newly shown although the base already shows them, and say a file outside public/ warns "as before" although the base shows a / file at the project or page root, so reword them to say what changes (.changeset/render-public-images.md:5).
  • A / path to a file outside public/ warns that it "was not found next to the page" even when the file sits next to the page, so name public/ as the folder that was searched (render-page.mjs:882).
  • The description says each new test fails on the base, but the test that expects nothing without a public/ passes there, so correct that claim (embedded-imports.test.mjs:66).
  • Miss: the description says the base looked for public/ in the page's own folder only, but it looked in the project's folder first and in the page's folder only outside a project, so correct that cause.

No current spec decides where experimental render reads a / path or what its script shows for images the first paint does not draw, so approval also needs an engineering owner to settle both (public/ only with the project's public/ first and else the nearest one, root-level files no longer read, these images carried for --reverse, and later-drawn images written into the script as carried data) by commenting /approve-spec followed by the full head SHA on the pull request, which the author may do as an engineering owner. GitHub still compares this pull request with the last commit of the branch it used to target, so it lists 121 files and the review-signal job refuses to classify it; the change itself is the seven files listed below. Non-blocking: the theme editor's image notes and starter-app check share the resolver and now report a theme url(/...) file at the project root as missing, which is worth a line in the changeset.

Claims and files checked

Review mode: full; reason: rebase

  • Changeset: an image named from the site's root shows, read from the project's public/: true at this head, but the base already shows it, so false as a change (changeset finding).
  • Changeset: with no public/ in the project folder, the nearest public/ above the page inside the project, or outside a project inside the folder you run from: verified (render-page.mjs:152-162; shared-site and outside-project tests).
  • Changeset: the image is carried, so --reverse restores it under public/ at the same path: verified (render-page.mjs:910; outside-project test), apart from the nearer-public/ case (reverse finding).
  • Changeset: a path that leaves public/ is not read: verified (render-page.mjs:827-828; climb test).
  • Changeset: a file not in public/ gets the missing-image warning as before: false for a file at the project or page root, which the base shows (changeset finding).
  • Changeset: the credit line names the author: verified.
  • Description: a / image shows broken when public/ is not in the folder of the project's package.json: verified (seven new tests fail on the base).
  • Description: the base looked for public/ in the page's own folder only: false, it looked in the project's folder first (cause finding).
  • Description: resolution from the project's public/, else the nearest above the page inside the carried folder: verified.
  • Description: only inside public/; a climb names no file and a root file outside public/ is no longer read: verified (climb test).
  • Description: --reverse restores the image under public/ and the script shows the same carried data: verified (interactive and outside-project tests).
  • Description: an image named in code but not drawn in the first paint is carried and shows once drawn: verified for the tested page, false for same-named relative images in different folders (later-drawn finding).
  • Description: a / path to no file keeps the missing-image warning: verified (/gone.png case).
  • Description: only the image resolver reads the site folder; tsconfig, StyleX and message paths keep the project folder: verified (render-page.mjs:1008, :1027, :1485 against :1011, :1099, :1384).
  • Description: the command is experimental and no record changes: verified (only the experimental render and theme editor reach the changed code; no record in the change).
  • Description: the maintainers decided the rule: no decision is recorded on the pull request (held for an owner).
  • Description: a frozen set of 22 pages goes from 1 to 22 exact: not checked, the set is not in the pull request.
  • Description: each new test fails on the base: false, seven of eight do (test-claim finding).
  • Description: the listed test run passes: verified; at this head it counts 1387 passed and 3 skipped, one more than stated, from a test the rebase brought in.
  • Description: public text holds no internal context: verified.
  • File .changeset/render-public-images.md: changeset finding; theme-editor note.
  • File packages/cli/foundation/render/render-page.mjs: hang, later-drawn and warning findings.
  • File packages/cli/foundation/render/embedded-imports.mjs: reverse finding.
  • File packages/cli/foundation/render/embedded-imports.test.mjs: test-claim finding.
  • File packages/cli/api/render/render.test.mjs: asserts the warning finding's message; no filesystem-root case.
  • File packages/cli/api/render/render.interactive.test.mjs: no two-folder case for the later-drawn finding; otherwise clear.
  • File packages/cli/assets/docs/tree/render-pages.doc.mjs: clear.
  • The other 114 files GitHub lists come from main commits already on main and are not part of this change.

Automated review (maintainer link)

Comment thread .changeset/render-public-images.md Resolved
Comment thread packages/cli/api/render/render.test.mjs Resolved
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · d540ef7

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.46 MB packed (+1.8 kB); no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 17, 2026
@josephfarina josephfarina changed the title [experimental] render: an image named from the site's root shows, from public/ [experimental] render: a path from the site's root reads public/ only, and its images come back with --reverse Nov 17, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): an image a page names from the site root (/photo.png) is read from the site's public/ folder (the project's first, else the nearest one above the page, never past the folder the render carries from or the filesystem root) and carried into the file. --reverse restores it into the same public/ the render read. A root path to a file outside public/ warns and names public/ as the folder searched.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 947c2ba

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: an image named from the site's root now resolves only from public/ and comes back with --reverse, an engineering owner has decided that rule on this head, and the earlier points are fixed; one warning still needs a fix.

  • A / url in a stylesheet outside the page's folder gets a missing-image warning whose public/ path starts at the stylesheet, so a page in src/pages/p/ that imports src/styles/a.css is told ../../public/ for the stylesheet's url and ../../../public/ for its own markup's, the same folder; build the path from the page's folder in publicFolderOf and add a stylesheet-in-another-folder case (render-page.mjs:895).

Non-blocking: the experimental theme editor's image notes share the resolver and now report a theme url(/…) file at the project root as missing; a changeset line would tell its users.

Claims and files checked

Review mode: incremental; reason: none

  • Changeset: more / images show in the file and come back with --reverse: verified (shared-site and outside-a-project tests, both failing on the merge base).
  • Changeset: with no public/ in the project, the nearest one above the page inside the project, or outside a project inside the folder you run from: verified (render-page.mjs:152-164).
  • Changeset: each such image is carried, and --reverse restores it into the public/ the render read: verified (render-page.mjs:924, :1534-1549; embedded-imports.mjs:349-359; a project page beside a nearer public/ restores exact).
  • Changeset: an image named this way but drawn later is carried and shown from carried data: verified (interactive click test).
  • Changeset: only public/ is read, root-level files are no longer read, and a climbing path is not read: verified (render-page.mjs:823-831; climb test).
  • Changeset: the missing-image warning names the public/ folder searched: true for markup; false for a stylesheet outside the page's folder (finding).
  • Changeset: the credit line names the author: verified.
  • Description: the base showed broken images when public/ was not where it looked (a site folder below a shared package.json, a page outside a project): verified (base resolver; those tests fail on the merge base).
  • Description: the base looked in the project's public/, then the project's folder: verified (base assetRef candidates).
  • Description: a / path resolves only from public/, the project's first, else the nearest above the page, stopping at the scope or the filesystem root: verified.
  • Description: a climbing path names no file and a root file outside public/ is no longer read: verified (climb test).
  • Description: the source record names the public/ read, optional and with no format change, and --reverse puts the image back there: verified (readers check only the version, entry and files).
  • Description: a later-drawn image is carried, the script shows the page folder's file, and a file beside the naming module is still carried: verified (two-folder test; a module-only file restores exact).
  • Description: a / path to no file warns naming public/: verified for markup; the stylesheet case is the finding.
  • Description: only the image resolver reads the site's folder; tsconfig, StyleX and messages keep the project's: verified (render-page.mjs:1022, :1041, :1110).
  • Description: experimental under the experimental-isolation rule, with no record change: verified.
  • Description: the maintainers decided the rule: verified (an engineering owner's decision comment and approval on this head).
  • Description: the file list: verified; its --reverse line describes the fallback (the recorded public/ wins first, as the Solution says), and the adapter and source-record files also change.
  • Description: the listed tests (outside-a-project markup and CSS, climb, shared site, script string, click, unit tests, two folders, recorded public/): verified, all pass.
  • Description: a frozen set of 22 pages goes from 1 to 22 exact: not checked, the set is not in the pull request.
  • Description: the outside-a-project test fails on the base and the traversal and no-public/ unit test passes there: verified (9 of the 12 new tests fail on the merge base).
  • Description: a render run from / finishes and warns: verified (about 1.5 s); the 60 s hang was in this pull request's earlier revision, not the base.
  • Description: the listed test run passes with 1,391 passed and 3 skipped: verified.
  • Description: public text holds no internal context: verified.
  • .changeset/render-public-images.md: clear.
  • packages/cli/foundation/render/render-page.mjs: stylesheet warning finding.
  • packages/cli/foundation/render/embedded-imports.mjs: clear.
  • packages/cli/foundation/render/source-block.mjs: clear.
  • packages/cli/api/render/_adapter.mjs: clear.
  • packages/cli/api/render/render.test.mjs: no stylesheet-in-another-folder case (finding); otherwise clear.
  • packages/cli/api/render/render.interactive.test.mjs: clear.
  • packages/cli/foundation/render/embedded-imports.test.mjs: clear.
  • packages/cli/assets/docs/tree/render-pages.doc.mjs: clear.
  • The other 113 files GitHub lists come from main and are not part of this change.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 5c08362

@josephfarina
josephfarina force-pushed the josephfarina/render-public-images branch from 5c08362 to a8f7a2c Compare November 17, 2026 20:18
@github-actions github-actions Bot removed the needs:design-review Affects visuals — Design should review label Nov 17, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec a8f7a2c

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: an image named from the site's root (/pics/shoe.png) now resolves only from the site's public/ folder, is carried in the rendered file and comes back with --reverse, and the engineering owner's /approve-spec covers the current revision.

CI found no room for this head and cancelled its test jobs: re-run all CI jobs once it has room, since the merge guard waits for them to pass.

Two small wording points, neither blocking: the theme editor's missing-image note still says a theme's url(/…) file "was not found beside the theme" although it is looked for in public/ (packages/cli/api/theme-edit/_context.mjs:879), and the description's "(it ran into the 60 s limit before)" reads as if the base hung, while only an earlier revision of this pull request did.

Claims and files checked

Review mode: full; reason: rebase

  • The release note's first claim, that more images named from the site's root show in the file and come back with --reverse: verified (render.test.mjs:950, :2403; a live render of each side).

  • Without a project public/, the nearest public/ above the page inside the project, or outside a project inside the run folder: verified (render-page.mjs:152-164; render.test.mjs:950, :2403).

  • Each such image is carried and --reverse puts it back in the public/ the render read: verified (render.test.mjs:2403; embedded-imports.test.mjs:82).

  • An image drawn only later is carried and shown from the carried data: verified (render.interactive.test.mjs:358).

  • Only public/ is read; a root-level file and a climbing path are not; the warning names the public/ searched: verified (render-page.mjs:823-831, :896; render.test.mjs:2436, :2458).

  • The theme editor's image notes read a theme's url(/…) the same way: verified (api/theme-edit/_context.mjs:864-880 uses the shared resolver).

  • The base looked in the project's public/, then the project's folder: verified (the base's resolver).

  • A site folder below a shared package.json, and a page outside a project with public/ above it, lost their images on the base: verified (both cases fail on the base).

  • A / path resolves only from a public/ folder and the search stops at the carry scope or the filesystem root: verified (render-page.mjs:158-162; render.test.mjs:2479).

  • The source record names the public/ read, as an optional field with no format change: verified (render-page.mjs:1538-1553; source-block.mjs:83).

  • A later-drawn relative string shows the page folder's file, and each module's own file is still carried: verified (render.interactive.test.mjs:408).

  • The missing-image warning text: verified (render.test.mjs:2436).

  • Only the image resolver reads the site's folder; tsconfig, StyleX and message paths keep the project's: verified (render-page.mjs:1023, :1042, :1117, :1512).

  • No record changes, and the render guide names where a / path comes from: verified (render-pages.doc.mjs:59).

  • An engineering owner decided the rule: verified (the owner's decision comment and approval at this head).

  • The listed render, script, click, two-folder and unit tests: verified (all pass at this head).

  • The 22-page before and after set: not reproduced (the set is not in the pull request); the in-tree tests cover each layout it names.

  • The outside-a-project test fails on the base and the no-public/ unit test passes there: verified (10 of 13 new cases fail on the base).

  • A render run from / finishes and warns: verified (render.test.mjs:2479); the hang it mentions was in an earlier revision, not the base.

  • The test command passes: verified (1,403 passed, 3 skipped at this head; the stated count predates the rebase).

  • No new public API, and no internal context in public text: verified.

  • .changeset/render-public-images.md: clear.

  • packages/cli/api/render/_adapter.mjs: clear.

  • packages/cli/api/render/render.interactive.test.mjs: clear.

  • packages/cli/api/render/render.test.mjs: clear.

  • packages/cli/assets/docs/tree/render-pages.doc.mjs: clear.

  • packages/cli/foundation/render/embedded-imports.mjs: clear.

  • packages/cli/foundation/render/embedded-imports.test.mjs: clear.

  • packages/cli/foundation/render/render-page.mjs: clear.

  • packages/cli/foundation/render/source-block.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/render-public-images branch from a8f7a2c to 5c58bcd Compare November 18, 2026 07:52
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 5c58bcd

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: an image named from the site's root (/pics/shoe.png) now resolves only from the site's public/ folder, is carried in the rendered file and comes back with --reverse, and the engineering owner's /approve-spec covers this revision.

CI found no room for this revision and cancelled its test jobs: re-run all jobs once it has room, since the merge guard waits for them to pass.

Three small wording points, none blocking:

  • The theme editor's missing-image note still says a theme's url(/…) file "was not found beside the theme" although it is looked for in public/ (packages/cli/api/theme-edit/_context.mjs:879).
  • The description's "(it ran into the 60 s limit before)" reads as if the base hung, while only an earlier revision of this pull request did.
  • The description's test count (1,391 passed) predates the rebase; the same command now gives 1,472 passed, 3 skipped.
Claims and files checked

Review mode: full; reason: rebase

  • The release note's first claim, that more images named from the site's root show in the file and come back with --reverse: verified (render.test.mjs:951, :2725; a live render on each side).

  • Without a project public/, the nearest public/ above the page inside the project, or outside a project inside the run folder: verified (render-page.mjs:153-164; render.test.mjs:951, :2725).

  • Each such image is carried and --reverse puts it back in the public/ the render read: verified (render.test.mjs:2725; embedded-imports.test.mjs:82).

  • An image drawn only later is carried and shown from the carried data: verified (render.interactive.test.mjs:420).

  • Only public/ is read; a root-level file and a climbing path are not; the warning names the public/ searched: verified (render-page.mjs:848-856, :921; render.test.mjs:2758, :2780).

  • The theme editor's image notes read a theme's url(/…) the same way: verified (api/theme-edit/_context.mjs:864-880 uses the shared resolver).

  • The base looked in the project's public/, then the project's folder: verified (the base's resolver).

  • A site folder below a shared package.json, and a page outside a project with public/ above it, lost their images on the base: verified (both cases fail on the base).

  • A / path resolves only from a public/ folder and the search stops at the carry scope or the filesystem root: verified (render-page.mjs:159-163; render.test.mjs:2801).

  • The source record names the public/ read, as an optional field with no format change: verified (render-page.mjs:1639-1651; source-block.mjs:83).

  • A later-drawn relative string shows the page folder's file, and each module's own file is still carried: verified (render.interactive.test.mjs:470).

  • The missing-image warning text: verified (render.test.mjs:2758).

  • Only the image resolver reads the site's folder; tsconfig, StyleX and message paths keep the project's: verified (render-page.mjs:1048, :1067, :1142, :1609).

  • No record changes, and the render guide names where a / path comes from: verified (render-pages.doc.mjs:59).

  • An engineering owner decided the rule: verified (the owner's decision comment and approval at this revision).

  • The listed render, script, click, two-folder and unit tests: verified (all pass at this revision).

  • The 22-page before and after set: not reproduced (the set is not in the pull request); the in-tree tests cover each layout it names.

  • The outside-a-project test fails on the base and the no-public/ unit test passes there: verified (10 of 13 new cases fail on the base).

  • A render run from / finishes and warns: verified (render.test.mjs:2801); the hang it mentions was in an earlier revision, not the base.

  • The test command passes: verified (1,472 passed, 3 skipped at this revision; the stated 1,391 predates the rebase).

  • No new public API, and no internal context in public text: verified.

  • .changeset/render-public-images.md: clear.

  • packages/cli/api/render/_adapter.mjs: clear.

  • packages/cli/api/render/render.interactive.test.mjs: clear.

  • packages/cli/api/render/render.test.mjs: clear.

  • packages/cli/assets/docs/tree/render-pages.doc.mjs: clear.

  • packages/cli/foundation/render/embedded-imports.mjs: clear.

  • packages/cli/foundation/render/embedded-imports.test.mjs: clear.

  • packages/cli/foundation/render/render-page.mjs: clear.

  • packages/cli/foundation/render/source-block.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/render-public-images branch from 5c58bcd to b0567fe Compare November 18, 2026 11:28
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec b0567fe

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: the code, tests and release note look right, and the engineering owner's /approve-spec covers this revision; only the pull request description needs an update.

  • Regression: since main renamed the command, the description names astryx experimental render (which now fails with ERR_UNKNOWN_SUBCOMMAND) and assets/docs/tree/render-pages.doc.mjs, while this change governs astryx experimental export and edits export-pages.doc.mjs, so please update those names, the title's render: scope and the Testing line's count (1,473 passed, 3 skipped at this revision).

Editing the description needs no new commit. Two small points, not blocking: the theme editor's missing-image note still says a theme's url(/…) file was not found beside the theme although it is looked for in public/ (packages/cli/api/theme-edit/_context.mjs:879), and the description's "(it ran into the 60 s limit before)" reads as if the base hung, while only an earlier revision did. CI found no room for this revision and cancelled its test jobs, so they need a re-run.

Claims and files checked

Review mode: full; reason: rebase

  • Release note, more images named from the site's root show in the file and come back with --reverse: verified (render.test.mjs:951, :2747; an export on each side).

  • Release note, without a project public/ the nearest public/ above the page inside the project, or outside a project inside the run folder: verified (render-page.mjs:153-165; render.test.mjs:951, :2747).

  • Release note, each such image is carried and --reverse puts it back in the public/ export read: verified (render.test.mjs:2747; embedded-imports.test.mjs:82).

  • Release note, an image drawn only later is carried and shown from the carried data: verified (render.interactive.test.mjs:420).

  • Release note, only public/ is read, a root-level file and a climbing path are not, and the warning names the public/ searched: verified (render-page.mjs:848-856, :919-922; render.test.mjs:2780, :2802).

  • Release note, the theme editor's image notes read a theme's url(/…) the same way: verified (api/theme-edit/_context.mjs:864-879 uses the shared resolver).

  • The base looked in the project's public/, then the project's folder: verified (the base's resolver).

  • A site folder below a shared package.json, and a page outside a project with public/ above it, lost their images on the base: verified (both cases fail on the base).

  • A / path resolves only from a public/ folder and the search stops at the carry scope or the filesystem root: verified (render-page.mjs:159-163; render.test.mjs:2823).

  • The source record names the public/ read, as an optional field with no format change: verified (render-page.mjs:1636-1651; source-block.mjs:83, :119).

  • A later-drawn relative string shows the page folder's file, and each module's own file is still carried: verified (render.interactive.test.mjs:470).

  • The missing-image warning text: verified (render.test.mjs:2780).

  • Only the image resolver reads the site's folder; tsconfig, StyleX and message paths keep the project's: verified (render-page.mjs:1048, :1067, :1609).

  • The governed command, also in the Scope components line, is astryx experimental render: false (it is astryx experimental export at this revision; clients/cli/lib/renamed-commands.mjs:16).

  • No record changes, and the guide names where a / path comes from: verified (export-pages.doc.mjs:60).

  • The guide sentence is in render-pages.doc.mjs: false (the file is export-pages.doc.mjs).

  • An engineering owner decided the rule: verified (the owner's decision comment and approval at this revision).

  • The listed export, script, click, two-folder and unit tests: verified (all pass at this revision).

  • The 22-page before and after set: not reproduced (the set is not in the pull request); the in-tree tests cover each layout it names.

  • The outside-a-project test fails on the base and the no-public/ unit test passes there: verified (10 of 13 new cases fail on the base).

  • An export run from / finishes and warns: verified (render.test.mjs:2823); the hang it mentions was in an earlier revision, not the base.

  • The recorded public/ wins over a nearer one, and a malformed record is ignored: verified (embedded-imports.test.mjs:82, :86).

  • The test command gives 1,391 passed, 3 skipped: out of date (1,473 passed, 3 skipped at this revision).

  • No new public API, and no internal context in public text: verified.

  • .changeset/render-public-images.md: clear.

  • packages/cli/api/render/_adapter.mjs: clear.

  • packages/cli/api/render/render.interactive.test.mjs: clear.

  • packages/cli/api/render/render.test.mjs: clear.

  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.

  • packages/cli/foundation/render/embedded-imports.mjs: clear.

  • packages/cli/foundation/render/embedded-imports.test.mjs: clear.

  • packages/cli/foundation/render/render-page.mjs: clear.

  • packages/cli/foundation/render/source-block.mjs: clear.

Automated review (maintainer link)

@josephfarina josephfarina changed the title [experimental] render: a path from the site's root reads public/ only, and its images come back with --reverse [experimental] export: a path from the site's root reads public/ only, and its images come back with --reverse Nov 18, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec d826f88

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: the code, tests and release note still look right, and the engineering owner's /approve-spec covers this revision, but the branch needs a rebase and the description two fixes.

  • Regression: since the last review, main merged #12404, which changes the same lines in source-block.mjs, render-page.mjs and api/render/_adapter.mjs (its notCarried record beside this change's publicDir), so GitHub cannot merge this branch and runs none of its CI; please rebase and keep both record fields and both reachableFiles inputs.
  • The description's Testing line still gives 1,391 passed, 3 skipped (the command gives 1,473 passed, 3 skipped at this revision), and "(before, it ran into the render's time limit)" reads as if the base hung, while the base finishes that case and only an earlier revision of this branch hung.

One small point, not blocking: the theme editor's missing-image note still says a theme's url(/…) file was not found beside the theme, although it is looked for in public/ (packages/cli/api/theme-edit/_context.mjs:879). The rebased revision needs the owner's /approve-spec again.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none since the last review.

  • Release note, more images named from the site's root show in the file and come back with --reverse: verified (render.test.mjs:951, :2747; an export on each side).

  • Release note, without a project public/ the nearest public/ above the page inside the project, or outside a project inside the run folder: verified (render-page.mjs:138-142, :153-165; render.test.mjs:951, :2747).

  • Release note, each such image is carried and --reverse puts it back in the public/ export read: verified (render.test.mjs:2747; embedded-imports.test.mjs:82).

  • Release note, an image drawn only later is carried and shown from the carried data: verified (render.interactive.test.mjs:420).

  • Release note, only public/ is read, a root-level file and a climbing path are not, and the warning names the public/ searched: verified (render-page.mjs:848-856, :919-921; render.test.mjs:2780, :2802).

  • Release note, the theme editor's image notes read a theme's url(/…) the same way: verified (api/theme-edit/_context.mjs:864-869 uses the shared resolver).

  • The base looked in the project's public/, then the project's folder: verified (the base's resolver).

  • A site folder below a shared package.json, and a page outside a project with public/ above it, lost their images, and a later-drawn root-path image was never carried: verified (both cases fail on the base; an export on the base).

  • A / path resolves only from a public/ folder and the search stops at the project or run folder, or the filesystem root: verified (render-page.mjs:153-165; render.test.mjs:2823).

  • A climbing path names no file and a root-level file outside public/ is no longer read: verified (render.test.mjs:2780).

  • The source record names the public/ read, as an optional field with no format change: verified (render-page.mjs:1636-1651; source-block.mjs:27, :83, :119).

  • A later-drawn relative string shows the page folder's file, and each module's own file is still carried: verified (render.interactive.test.mjs:470).

  • The missing-image warning text: verified (render.test.mjs:2780).

  • Only the image resolver reads the site's folder; tsconfig, StyleX and message paths keep the project's: verified (render-page.mjs:1048, :1067, :1609).

  • The governed command is astryx experimental export, no record changes, and the guide names where a / path comes from: verified (export-pages.doc.mjs:60).

  • An engineering owner decided the rule: verified (the owner's decision comment and approval at this revision).

  • The files and changes in Smallest restoration: verified (the reverse takes the recorded public/ first, then the nearest, embedded-imports.mjs:357-370; the guide gains two sentences).

  • The listed export, script, click, two-folder and unit tests: verified (all pass at this revision; the outside-a-project stylesheet names /pics/bg.png).

  • The 22-page before and after set: not reproduced (the set is not in the pull request); the in-tree tests cover each layout it names.

  • The outside-a-project test fails on the base and the traversal and no-public/ unit test passes there: verified (10 of 13 new cases fail on the base).

  • An export run from / finishes and warns: verified (render.test.mjs:2823); that it ran into the time limit before: false (the base finishes that case; only an earlier revision hung).

  • The recorded public/ wins over a nearer one, and a malformed record is ignored: verified (embedded-imports.test.mjs:82, :86).

  • The test command gives 1,391 passed, 3 skipped: false (1,473 passed, 3 skipped at this revision).

  • No new public API or hidden direction, and no internal context in public text: verified.

  • .changeset/render-public-images.md: clear.

  • packages/cli/api/render/_adapter.mjs: conflicts with main's change to the same reachableFiles call.

  • packages/cli/api/render/render.interactive.test.mjs: clear.

  • packages/cli/api/render/render.test.mjs: clear (merges with main).

  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.

  • packages/cli/foundation/render/embedded-imports.mjs: clear (merges with main).

  • packages/cli/foundation/render/embedded-imports.test.mjs: clear.

  • packages/cli/foundation/render/render-page.mjs: conflicts with main's change to the source record.

  • packages/cli/foundation/render/source-block.mjs: conflicts with main's change to the source record.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/render-public-images branch from d826f88 to f8762fa Compare November 18, 2026 13:14
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec f8762fa

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: an image named from the site's root (/pics/shoe.png) now resolves only from the site's public/ folder, is carried in the exported file and comes back with --reverse, the rebase keeps main's not-carried record beside the new publicDir, the engineering owner's /approve-spec covers this revision, and the CI workflow, refused on this revision because CI was full, needs a re-run before merge.

  • Miss: not blocking, a percent-escaped root path (/pics/a%20b.png) is shown and restored, but --reverse still lists it as missing with exact: false, because reachableFiles joins the raw string (embedded-imports.mjs:355); decoding there once also fixes the same gap that relative strings already have.
  • Miss: not blocking, the data.files description in packages/cli/api/render/render.type.mjs:49 still says a module names the files it carries by a relative path, and root paths read from public/ belong there too.
  • Not blocking: the theme editor's missing-image note still says a theme's url(/…) file was not found beside the theme, although it is looked for in public/ (packages/cli/api/theme-edit/_context.mjs:879).
Claims and files checked

Review mode: full; reason: rebase

  • Release note, more images named from the site's root show in the file and come back with --reverse: verified (render.test.mjs:951, :2844; an export on each side).

  • Release note, without a project public/ the nearest public/ above the page inside the project, or outside a project inside the run folder: verified (render-page.mjs:153-165; render.test.mjs:951, :2844).

  • Release note, each such image is carried and --reverse puts it back in the public/ export read: verified (render.test.mjs:2844; embedded-imports.test.mjs:82).

  • Release note, an image drawn only later is carried and shown from the carried data: verified (render.interactive.test.mjs:420).

  • Release note, only public/ is read, a root-level file and a climbing path are not, and the warning names the public/ searched: verified (render-page.mjs:848-856, :919-922; render.test.mjs:2877, :2899).

  • Release note, the theme editor's image notes read a theme's url(/…) the same way: verified (api/theme-edit/_context.mjs:869 uses the shared resolver).

  • The base looked in the project's public/, then the project's folder: verified (the base's resolver).

  • A site folder below a shared package.json, and a page outside a project with public/ above it, lost their images, and a later-drawn root-path image was never carried: verified (both cases fail on the base; an export on the base).

  • A / path resolves only from a public/ folder, and the search stops at the project or run folder, or the filesystem root: verified (render-page.mjs:153-165; render.test.mjs:2920).

  • A climbing path names no file and a root-level file outside public/ is no longer read: verified (render.test.mjs:2877).

  • The source record names the public/ read, as an optional field with no format change: verified (render-page.mjs:1636-1652; source-block.mjs:27, :84, :121).

  • A later-drawn relative string shows the page folder's file, and each module's own file is still carried: verified (render.interactive.test.mjs:470).

  • The missing-image warning text: verified (render.test.mjs:2877).

  • Only the image resolver reads the site's folder; tsconfig, StyleX and message paths keep the project's: verified (render-page.mjs:1048, :1067, :1608-1610).

  • The governed command is astryx experimental export, no record changes, and the guide names where a / path comes from: verified (export-pages.doc.mjs:60).

  • An engineering owner decided the rule: verified (the owner's decision comment and approval at this revision).

  • The files and changes in Smallest restoration: verified (the reverse takes the recorded public/ first, then the nearest, embedded-imports.mjs:361-376; the guide gains two sentences).

  • The listed export, script, click, two-folder and unit tests: verified (all pass at this revision; the outside-a-project stylesheet names /pics/bg.png).

  • The 22-page before and after set: not reproduced (the set is not in the pull request); the in-tree tests and a live export cover each layout it names.

  • The outside-a-project test fails on the base and the traversal and no-public/ unit test passes there: verified (10 of 13 new cases fail on the base).

  • An export run from / finishes and warns: verified (render.test.mjs:2920).

  • The recorded public/ wins over a nearer one, and a malformed record is ignored: verified (embedded-imports.test.mjs:82, :86).

  • The test command passes at this revision: verified (1,479 passed, 3 skipped).

  • No new public API or hidden direction, and no internal context in public text: verified.

  • .changeset/render-public-images.md: clear.

  • packages/cli/api/render/_adapter.mjs: clear (keeps main's recorded-file merge and adds publicDir).

  • packages/cli/api/render/render.interactive.test.mjs: clear.

  • packages/cli/api/render/render.test.mjs: clear.

  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.

  • packages/cli/foundation/render/embedded-imports.mjs: not blocking, a percent-escaped root path is listed as missing on --reverse.

  • packages/cli/foundation/render/embedded-imports.test.mjs: clear.

  • packages/cli/foundation/render/render-page.mjs: clear.

  • packages/cli/foundation/render/source-block.mjs: clear (keeps both record fields).

Automated review (maintainer link)

const publicPath = ref => {
/** @param {string} dir a tree folder holding `public/` files */
const under = dir => {
const joined = path.posix.normalize(`${dir}/${ref.slice(1)}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not blocking: this joins the raw string, while the render decodes percent-escapes before it reads the file (render-page.mjs:842). A page that names /pics/a%20b.png gets public/pics/a b.png carried and restored, yet --reverse reports exact: false with missing: ["public/pics/a%20b.png"]. Decoding the ref once (as assetRef does) before both this join and the relative one below also fixes the same gap for ./c%20d.png.

…s them

A path from the site root (/pics/a.png) is read only from public/: the
project's, else the nearest public/ above the page inside the project or
the folder the command runs in. The file carries each such image, also
one the page draws only later, so the script shows it offline and
--reverse puts it back in the public/ the export read (recorded in the
source). A path that leaves public/ is refused, and the missing-image
warning names the public/ folder searched.
@josephfarina
josephfarina force-pushed the josephfarina/render-public-images branch from f8762fa to d540ef7 Compare November 18, 2026 15:50
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec d540ef7

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: an image named from the site's root (/pics/shoe.png) now resolves only from the site's public/ folder, is carried in the exported file and comes back with both --reverse and the new experimental import, the engineering owner's /approve-spec covers this revision, and the remaining CI test shards still need to finish before merge.

  • Regression: not blocking, since main added experimental import, every other line of the export guide names the way back that way, while the new guide sentence (packages/cli/assets/docs/tree/export-pages.doc.mjs:60) and the changeset name only --reverse; both still work, so naming experimental import (or --reverse) would keep the guide in one voice.
  • Not blocking: a percent-escaped root path (/pics/a%20b.png) is shown and restored, but the way back still lists it as missing with exact: false, because reachableFiles joins the raw string (embedded-imports.mjs:355); decoding there once also fixes the same gap relative strings already have.
  • Not blocking: two descriptions still state only the old rule, the data.files description in packages/cli/api/render/render.type.mjs:49 (module-named files "by a relative path") and the theme editor's missing-image note in packages/cli/api/theme-edit/_context.mjs:879 ("beside the theme").
Claims and files checked

Review mode: full; reason: rebase

  • Release note, more images named from the site's root show in the file and come back with --reverse: verified (render.test.mjs:951, :2860; an export on each side).

  • Release note, without a project public/ the nearest public/ above the page inside the project, or outside a project inside the run folder: verified (render-page.mjs:154-166; render.test.mjs:951, :2860).

  • Release note, each such image is carried and --reverse puts it back in the public/ export read: verified (render.test.mjs:2860; embedded-imports.test.mjs:82; a live restore through both way-back commands).

  • Release note, an image drawn only later is carried and shown from the carried data: verified (render.interactive.test.mjs:522).

  • Release note, only public/ is read, a root-level file and a climbing path are not, and the warning names the public/ searched: verified (render-page.mjs:878-886, :950-952; render.test.mjs:2893, :2915).

  • Release note, the theme editor's image notes read a theme's url(/…) the same way: verified (api/theme-edit/_context.mjs:869 uses the shared resolver with the project as the site root).

  • The base looked in the project's public/, then the project's folder: verified (the base's resolver).

  • A site folder below a shared package.json, and a page outside a project with public/ above it, lost their images, and a later-drawn root-path image was never carried: verified (both cases fail on the base; an export on the base).

  • A / path resolves only from a public/ folder, and the search stops at the project or run folder, or the filesystem root: verified (render-page.mjs:160-164; render.test.mjs:2936).

  • A climbing path names no file and a root-level file outside public/ is no longer read: verified (render.test.mjs:2893).

  • The source record names the public/ read, as an optional field with no format change: verified (render-page.mjs:1693-1709; source-block.mjs:27, :84, :121).

  • A later-drawn relative string shows the page folder's file, and each module's own file is still carried: verified (render.interactive.test.mjs:572).

  • The missing-image warning text: verified (render.test.mjs:2893).

  • Only the image resolver reads the site's folder; tsconfig, StyleX and message paths keep the project's: verified (render-page.mjs:1098-1101, :1117).

  • The governed command is astryx experimental export, no record changes, and the guide names where a / path comes from: verified (export-pages.doc.mjs:60).

  • An engineering owner decided the rule: verified (the owner's decision comment and approval at this revision).

  • The files and changes in Smallest restoration: verified (the restore takes the recorded public/ first, then the nearest, embedded-imports.mjs:361-376; the guide gains one passage of two sentences).

  • The listed export, script, click, two-folder and unit tests: verified (all pass at this revision; the outside-a-project stylesheet names /pics/bg.png).

  • The 22-page before and after set: not reproduced (the set is not in the pull request); the in-tree tests and a live export cover each layout it names.

  • The outside-a-project test fails on the base and the traversal and no-public/ unit test passes there: verified (10 of 13 new cases fail on the base).

  • An export run from / finishes and warns: verified (render.test.mjs:2936).

  • The recorded public/ wins over a nearer one, and a malformed record is ignored: verified (embedded-imports.test.mjs:82, :86).

  • The test command passes at this revision: verified (1,482 passed, 3 skipped).

  • No new public API or hidden direction, and no internal context in public text: verified.

  • .changeset/render-public-images.md: not blocking, names only --reverse as the way back.

  • packages/cli/api/render/_adapter.mjs: clear (keeps main's recorded-file merge and adds publicDir; experimental import uses the same call).

  • packages/cli/api/render/render.interactive.test.mjs: clear.

  • packages/cli/api/render/render.test.mjs: clear.

  • packages/cli/assets/docs/tree/export-pages.doc.mjs: not blocking, the new sentence names only --reverse.

  • packages/cli/foundation/render/embedded-imports.mjs: not blocking, a percent-escaped root path is listed as missing on the way back.

  • packages/cli/foundation/render/embedded-imports.test.mjs: clear.

  • packages/cli/foundation/render/render-page.mjs: clear (the script rewrite now runs after the carried-text scan, before main's uncarried-image pass reads it).

  • packages/cli/foundation/render/source-block.mjs: clear (keeps both record fields).

Automated review (maintainer link)

{
type: 'prose',
text: 'The result is ONE file with nothing beside it: the markup, the CSS rules the page can use (from Core and from any stylesheet it imports, such as a theme), the page\u2019s own StyleX styles, local images as data: URIs, and the page\u2019s own script (see The page\u2019s script). For `experimental import`, it also carries every image, font or media file (up to 8 MB each) that a carried module or stylesheet names by a relative path inside the folder that holds the carried files, also when the page does not show it. It loads nothing from the network, so it opens from disk, attaches to a message, and displays inside a sandboxed frame that blocks the network; a frame that also blocks scripts shows the rendered markup. Colors follow the viewer\u2019s light or dark setting, and a `data-theme` of `light` or `dark` on the root element picks one. The file also carries the source of the page and of every local module, stylesheet, JSON file and image it imports, so whoever you share it with can read that code; keep secrets out of what the page imports.',
text: 'The result is ONE file with nothing beside it: the markup, the CSS rules the page can use (from Core and from any stylesheet it imports, such as a theme), the page\u2019s own StyleX styles, local images as data: URIs, and the page\u2019s own script (see The page\u2019s script). An image named from the site\u2019s root (`/pics/shoe.png`) comes from the site\u2019s `public/` folder, and `--reverse` puts it back there. That folder is the project\u2019s `public/`; when the project has none, it is the nearest `public/` above the page, inside the project (or, outside a project, inside the folder you run the command from). For `experimental import`, it also carries every image, font or media file (up to 8 MB each) that a carried module or stylesheet names by a relative path inside the folder that holds the carried files, also when the page does not show it. It loads nothing from the network, so it opens from disk, attaches to a message, and displays inside a sandboxed frame that blocks the network; a frame that also blocks scripts shows the rendered markup. Colors follow the viewer\u2019s light or dark setting, and a `data-theme` of `light` or `dark` on the root element picks one. The file also carries the source of the page and of every local module, stylesheet, JSON file and image it imports, so whoever you share it with can read that code; keep secrets out of what the page imports.',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not blocking: since main added experimental import, every other line of this guide names the way back that way, and this new sentence is the only one that says --reverse. Both work, so experimental import (or --reverse) puts it back there keeps the guide in one voice; the changeset (lines 5 and 8) could say the same.

@josephfarina
josephfarina merged commit 49896f6 into main Nov 18, 2026
81 checks passed
@github-actions
github-actions Bot deleted the josephfarina/render-public-images branch November 19, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — d540ef78 Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant