Skip to content

[experimental] export --reverse: use the project's own copy of an aliased file, or restore the page's copy with its paths entry - #12322

Closed
josephfarina wants to merge 3 commits into
mainfrom
josephfarina/rl-reverse-alias-on-236ff3e
Closed

josephfarina wants to merge 3 commits into
mainfrom
josephfarina/rl-reverse-alias-on-236ff3e

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A page that imports through a path alias (@/components/Hello, with tsconfig paths) could not be given back in a project where that alias leads outside the new folder. That is the page's own project, the same project after a Core upgrade, or a new project after the caller pasted the paths entry an earlier reverse printed. --reverse refused it, so render, reverse, edit and render again worked once and then broke.

Problem and solution fit

  1. Why it occurs: the reverse treated an alias that resolves outside the folder it creates as unsafe, and refused.
  2. Why it harms the task: in the page's own project that is the normal case.
  3. Why that matters: the way back is the file's promise, and it must hold in the project the page came from.

When the file the alias reaches is byte for byte the page's copy, and so is every carried file below it, the page uses the project's files and the copies are not written (aliased.sameAsProject). When that file differs or is not there, the page's copy comes back in its own layout inside the new folder, never into a folder that exists. The answer names the file the alias reaches today and says it differs or is not there (aliased.differs), with the paths entry that leads the import to the copy. A file from an early canary that has no alias record gets the same entry, from the one carried file the import names.

Expected behavior and authority

astryx experimental export is experimental (spec:AST-017 FR27). The maintainers decided that a reverse never writes into an existing folder and never lets a restored page use a different file without saying so.

Smallest restoration

  • foundation/render/embedded-imports.mjs, api/render/_adapter.mjs, api/render/render.type.mjs and the reverse text: the decision and its report.
  • The render guide and render() docs.
  • A changeset.

Evidence

  • api/render/render.test.mjs: "restores an aliased page in its own project again and again" (same, changed, paste, render) and "names the paths for an alias import from a file that records none"; the two earlier refusal tests now check the new behavior.
  • A frozen set of alias round trips across every published canary of this release, in four kinds (same, changed, missing, new project), judged by exit codes, byte-exact files, a render again and a second reverse: 0 of 272 before, 272 of 272 after.

Scope

  • 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.

@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 7:38pm UTC

Request Review

@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, 7:50 PM UTC

@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 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.

An engineering owner needs to decide the new alias handling before this can be approved, and two defects need fixing.

  • Owner decision: no current record decides how experimental render --reverse handles an alias target outside the new folder (reuse a byte-identical project file, restore a differing one with paths advice, find a target by path suffix when the file has no alias record) or the four new experimental RenderAliased fields; an engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner), or names the governing clause.
  • A reused alias file's relative imports are never compared (packages/cli/api/render/_adapter.mjs:912-916), so when a helper it imports changed in the project, the restored page silently renders the changed helper, the answer still says exact: true, and the carried helper is written where nothing imports it.
  • The paths entry printed in the differs case (_adapter.mjs:637-640, render.mjs:136-149) applies to the whole project, so pasting it makes every other file that imports that name, such as another page, build against the restored page's old copy, and the text, type doc and render guide do not say so.

For the first defect, reuse a file only when every file it reaches by relative imports also matches the project, else restore it as differs, and add that case to the round-trip test; for the second, state the project-wide effect or advise a relative import instead.

Claims and files checked

Review mode: full; reason: no-earlier-review

Claims:

  • Reverse gives back an aliased page whose alias leads outside the new folder instead of refusing it: verified (the four alias tests fail against the base code, which refuses these pages, and pass on the head).
  • A byte-identical project file is used and its copy not written: verified for that file (_adapter.mjs:912-916); its relative imports are not compared (defect 1).
  • Render, reverse, edit and render again work in the page's own project: verified by the round-trip test; an edited dependency changes the page silently (defect 1).
  • A differing or missing file comes back in the page's layout inside the new folder, never into an existing folder: verified (_adapter.mjs:917, :934-944; render.test.mjs:688-701).
  • The answer names the project's file and the paths entry that leads the import to the copy: verified (render.test.mjs:728-764); the entry's project-wide effect is not stated (defect 2).
  • A file with no alias record gets the same paths entry from the carried file the import ends with: verified (embedded-imports.mjs:504-505; render.test.mjs:766-789).
  • config and paths appear only when imports is not empty: verified (_adapter.mjs:926-933).
  • The base refused these pages, so the round trip broke after one pass: verified (the same tests fail against the base code).
  • A reverse never writes into an existing folder: verified (_adapter.mjs:934-944).
  • A restored page never uses a different file without saying so: false (defect 1).
  • Maintainers decided this direction: no record states it (owner decision above).
  • A frozen canary sweep passes every case after and none before: not verifiable, as the harness is not in the pull request.
  • The two earlier refusal tests now check the new behaviour and two tests are added: verified.
  • The command is experimental: verified (experimental namespace, @experimental type, experimental patch changeset).
  • The listed test command: the two render test files pass at the head (178 tests).

Files:

  • .changeset/render-reverse-alias-in-project.md: clear (claims above).
  • packages/cli/api/render/_adapter.mjs: defects 1 and 2.
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear; it lacks the changed-dependency case (defect 1).
  • packages/cli/api/render/render.type.mjs: four experimental fields wait on the owner decision; the differs doc omits the project-wide effect (defect 2).
  • packages/cli/assets/docs/tree/render-pages.doc.mjs: omits the project-wide effect (defect 2).
  • packages/cli/clients/cli/commands/experimental/render.mjs: defect 2.
  • packages/cli/foundation/render/embedded-imports.mjs: clear.

Automated review (maintainer link)

Comment thread packages/cli/api/render/_adapter.mjs Resolved

@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.

An engineering owner needs to decide the new alias handling before this can be approved, and the two defects from the last review still need fixing; the new commit adds a test but changes neither.

  • Owner decision: no current record decides how experimental render --reverse handles an alias target outside the new folder (reuse a byte-identical project file, restore a differing one with paths advice, find a target by path suffix when the file has no alias record) or the four new experimental RenderAliased fields, so an engineering owner names the governing clause or records the decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner).
  • A reused alias file's relative imports are never compared (packages/cli/api/render/_adapter.mjs:912-916), so when a helper it imports changed in the project, the restored page silently renders the changed helper, the answer still says exact: true, and the carried helper is written where nothing imports it.
  • The paths entry printed in the differs case (_adapter.mjs:637-640, render.mjs:136-149) applies to the whole project, so pasting it makes every other file that imports that name build against the restored page's old copy, and neither the CLI text, the type doc nor the render guide says so.

For the first, reuse a file only when every carried file it reaches by relative imports also matches the project, else restore it as differs, and add that case to the round-trip test; for the second, state the project-wide effect or advise a relative import instead.

Claims and files checked

Review mode: incremental; reason: none

changed rules (0): none

Claims:

  • Reverse gives back an aliased page whose alias leads outside the new folder instead of refusing it: verified (the alias tests at this head; the base refused these pages with a path-traversal error).
  • A byte-identical project file is used and its copy is not written: verified for that file (_adapter.mjs:912-916); its relative imports are not compared (defect 1).
  • Render, reverse, edit and render again work in the page's own project, again and again: verified by render.test.mjs:728-764; a changed dependency of a reused file changes the page silently (defect 1).
  • A differing or missing file comes back in the page's own layout inside the new folder, never into an existing folder: verified (_adapter.mjs:917, :934-948; render.test.mjs:688-701).
  • The answer names the file the alias reaches today and the paths entry that leads the import to the copy: verified (render.test.mjs:766-808); the entry's project-wide effect is not stated (defect 2).
  • A file with no alias record gets the same paths entry from the carried file the import's path ends with: verified (embedded-imports.mjs:504-505; render.test.mjs:810-833).
  • aliased.config and aliased.paths appear only when aliased.imports is not empty: verified (_adapter.mjs:926-933).
  • A reverse never writes into an existing folder: verified (_adapter.mjs:934-948).
  • A restored page never uses a different file without saying so: false (defect 1).
  • The maintainers decided this direction: no current record states it (owner decision above).
  • A frozen set of canary round trips passes every case after and none before: not verifiable, as its harness is not in the pull request.
  • The two earlier refusal tests now check the new behaviour and two named tests are added: verified; a third test, that no tsconfig.json is edited, is also added.
  • The command is experimental: verified (experimental namespace, @experimental type, experimental patch changeset).
  • The listed test command passes at this head: verified.

Files:

  • .changeset/render-reverse-alias-in-project.md: clear (claims above).
  • packages/cli/api/render/_adapter.mjs: defects 1 and 2.
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear; it lacks the changed-dependency case (defect 1).
  • packages/cli/api/render/render.type.mjs: four experimental fields wait on the owner decision; the differs doc omits the project-wide effect (defect 2).
  • packages/cli/assets/docs/tree/render-pages.doc.mjs: omits the project-wide effect (defect 2).
  • packages/cli/clients/cli/commands/experimental/render.mjs: defect 2.
  • packages/cli/foundation/render/embedded-imports.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/rl-reverse-alias-on-236ff3e branch from a5344d0 to ec2b3e2 Compare November 17, 2026 15:32
@josephfarina
josephfarina changed the base branch from josephfarina/render-interactive to main November 17, 2026 15:32
@josephfarina
josephfarina marked this pull request as ready for review November 17, 2026 15:32
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 01ea722

Storybook · Sandbox · built from this PR's head

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

API changes: cli +2 · ~2 · −0

4 API changes (advisory)
Package Where Signature Usage
+ cli ./api/experimental · Types · type RenderAliased differs?: { import: string; project: string; exists: boolean; file: string; changed?: string[]; projectWide: true; instead: { file: string; import: string }[] }[] | undefined import type {RenderAliased} from '@astryxdesign/cli/api/experimental'; const x: RenderAliased = {differs: …}
+ cli ./api/experimental · Types · type RenderAliased sameAsProject?: { import: string; file: string }[] | undefined import type {RenderAliased} from '@astryxdesign/cli/api/experimental'; const x: RenderAliased = {sameAsProject: …}
~ cli ./api/experimental · Types · type RenderAliased config: string → config?: string | undefined import type {RenderAliased} from '@astryxdesign/cli/api/experimental'; const x: RenderAliased = {config: …}
~ cli ./api/experimental · Types · type RenderAliased paths: Record<string, string[]> → paths?: Record<string, string[]> | undefined import type {RenderAliased} from '@astryxdesign/cli/api/experimental'; const x: RenderAliased = {paths: …}

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

@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.

An engineering owner needs to decide the new alias handling before this can be approved, and two defects need fixing; the latest push rebases the same two commits and changes neither.

  • Owner decision: no current record decides how experimental render --reverse handles an alias target outside the new folder (reuse a byte-identical project file, restore a differing or missing one with paths advice, find a target by path suffix when the file has no alias record) or the four new experimental RenderAliased fields, so an engineering owner names the governing clause or records the decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner).
  • A reused alias file's relative imports are never compared (packages/cli/api/render/_adapter.mjs:912-916), so when a file it imports changed in the project, the restored page silently renders the changed file, the answer still says exact: true, and the carried copy is written where nothing imports it.
  • The paths entry printed in the differs case (_adapter.mjs:637-640, render.mjs:136-146) applies to the whole project, so pasting it makes every other file that imports that name build against the restored page's old copy, and neither the CLI text, the type doc nor the render guide says so.

For the first, reuse a file only when every carried file it reaches through relative imports also matches the project, else restore it as differs, and add that case to the round-trip test; for the second, state the project-wide effect or advise a relative import instead.

Claims and files checked

Review mode: full; reason: rebase

Claims:

  • Reverse gives back an aliased page whose alias leads outside the new folder instead of refusing it: verified (render.test.mjs:367-379, :728-764; the base refused these pages with a path-traversal error).
  • Before this change the round trip worked once and then broke: verified from the base, which refused every alias target outside the new folder.
  • A byte-identical project file is used and its copy is not written: verified for that file (_adapter.mjs:912-916); its relative imports are not compared (defect 1).
  • Render, reverse, edit and render again work in the page's own project, again and again: verified by render.test.mjs:728-764; a changed dependency of a reused file changes the page silently (defect 1).
  • A differing or missing file comes back in the page's own layout inside the new folder, never into an existing folder: verified (_adapter.mjs:917, :934-948; render.test.mjs:688-701).
  • The answer names the file the alias reaches today and the paths entry that leads the import to the copy: verified (render.test.mjs:766-808); the entry's project-wide effect is not stated (defect 2).
  • A file with no alias record gets the same paths entry from the one carried file the import's path ends with: verified (embedded-imports.mjs:329-337, :504-505; render.test.mjs:810-833).
  • aliased.config and aliased.paths appear only when aliased.imports is not empty: verified (_adapter.mjs:926-933).
  • A reverse never writes into an existing folder: verified (_adapter.mjs:934-948).
  • A restored page never uses a different file without saying so: false (defect 1).
  • The maintainers decided this direction: no current record states it (owner decision above).
  • A frozen set of canary round trips passes every case after the change and none before: not verifiable, as its harness is not in the pull request.
  • The two earlier refusal tests now check the new behaviour and two named tests are added: verified; a third test, that no tsconfig.json is edited, is also added.
  • The command is experimental and no new public API is hidden under the fix: verified (experimental namespace, @experimental type, [experimental] patch changeset that names the four fields), with those fields waiting on the owner decision.
  • The listed test command passes: verified (307 passed, 3 skipped).

Files:

  • .changeset/render-reverse-alias-in-project.md: clear (claims above).
  • packages/cli/api/render/_adapter.mjs: defects 1 and 2.
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear; it lacks the changed-dependency case (defect 1).
  • packages/cli/api/render/render.type.mjs: four experimental fields wait on the owner decision; the differs doc omits the project-wide effect (defect 2).
  • packages/cli/assets/docs/tree/render-pages.doc.mjs: omits the project-wide effect (defect 2).
  • packages/cli/clients/cli/commands/experimental/render.mjs: defect 2.
  • packages/cli/foundation/render/embedded-imports.mjs: clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): astryx experimental render --reverse restores a page whose file imports a project alias. It reuses the project's own file only when that file, and every carried file it reaches through relative imports, matches what the page carried; otherwise it restores the page's copy and reports it as differing. It never edits a file it did not write, the project's TypeScript config included: when the restored copy needs a paths entry, it prints the exact entry, says the entry applies to the whole project, and offers a relative import instead.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 31041e4

@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.

An engineering owner needs to decide the new alias handling before this can be approved, and two new defects need fixing; the two defects from the last review are fixed.

  • Owner decision: no current record decides how experimental render --reverse handles an alias target outside the new folder (use a matching project file, restore a differing one with paths and relative-import advice, find a target by path suffix when the file has no alias record) or the four experimental RenderAliased fields, so an engineering owner names the governing clause or records the decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner).
  • reachableFiles now takes a reused option that its JSDoc options type (packages/cli/foundation/render/embedded-imports.mjs:285) does not declare, so the CLI's declaration build fails with TS2353 and TS2339 and CI's typecheck, build-storybook, docsite-build and test-ui (1/4) jobs fail on it.
  • instead keeps only the page and files reached by a relative import (packages/cli/api/render/_adapter.mjs:967-968), so when a restored copy imports another differing file through the alias, that import gets no relative-import advice and following "change only the restored page" silently renders the project's changed file.

Add reused?: Set<string> to the options type; build instead from every restored copy that makes the import, and add the chained case (the page imports Header, Header imports Icon, both through the alias) to the round-trip test.

Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Reverse gives back an aliased page whose alias leads outside the new folder instead of refusing it: verified (render.test.mjs:367-379, :728-817; the base refused these pages with a path-traversal error).
  • Before this change the round trip worked once and then broke: verified from the base, which refused every alias target outside the new folder.
  • A project file with the page's bytes, and every carried file it imports, is used and their copies are not written: verified (_adapter.mjs:888-916; render.test.mjs:728-817).
  • Render, reverse, edit and render again work in the page's own project, again and again: verified (render.test.mjs:728-817).
  • A differing or missing file comes back in the page's own layout inside the new folder, never into an existing folder: verified (_adapter.mjs:959-961, :991-1001; render.test.mjs:688-701).
  • The answer names the file the alias reaches today, any file below it that differs, and the paths entry: verified (render.test.mjs:789-806, :819-869).
  • The answer says the entry applies to the whole project: verified (render.mjs:140).
  • The answer gives the relative import of the copy for each restored file that makes the import: false for a restored copy reached through the alias (defect 2).
  • A file with no alias record gets the same paths entry from the one carried file the import's path ends with: verified (embedded-imports.mjs:333-341, :518-519; render.test.mjs:871-894).
  • aliased.config and aliased.paths appear only when aliased.imports is not empty: verified (_adapter.mjs:983-990).
  • A restored page never uses a different file without saying so: holds for the reverse's own answer; following its narrower advice can (defect 2).
  • The maintainers decided this direction: no current record states it (owner decision above).
  • A frozen set of canary round trips passes every case after the change and none before: not verifiable, as its harness is not in the pull request.
  • The two earlier refusal tests now check the new behaviour and two named tests are added: verified; a third test, that no tsconfig.json is edited, is also added.
  • The command is experimental and no new public API is hidden under the fix: verified (experimental namespace, @experimental type, [experimental] patch changeset that names the fields), with those fields waiting on the owner decision.
  • The listed test command passes: verified (307 passed, 3 skipped); the declaration build fails (defect 1).

Files:

  • .changeset/render-reverse-alias-in-project.md: the instead sentence is false (defect 2); the rest verified.
  • packages/cli/api/render/_adapter.mjs: defect 2.
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear; it lacks the chained alias case (defect 2).
  • packages/cli/api/render/render.type.mjs: four experimental fields wait on the owner decision; the differs doc's instead sentence (defect 2).
  • packages/cli/assets/docs/tree/render-pages.doc.mjs: the instead sentence (defect 2).
  • packages/cli/clients/cli/commands/experimental/render.mjs: clear.
  • packages/cli/foundation/render/embedded-imports.mjs: defect 1.

Automated review (maintainer link)

Comment thread packages/cli/api/render/_adapter.mjs Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec c37e5a7

@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 engineering owner's decision on this pull request now settles the alias direction, and two gaps against it need fixing.

  • instead keeps only the page and files reached by a relative import (packages/cli/api/render/_adapter.mjs:967-968), so when a restored copy imports another differing file through the alias, that import gets no relative-import advice and following "change only the restored page" silently renders the project's changed file.
  • Miss: when the project does not have the aliased file, the CLI prints a paths entry that reaches the whole project without saying so and without the relative import the JSON's instead already holds (packages/cli/clients/cli/commands/experimental/render.mjs:139-144), although the changeset says the answer for a target that "differs or is not there" says the entry applies to the whole project and gives the narrower fix.

Build instead from every restored copy that makes the import and add the chained case (the page imports Header, Header imports Icon, both through the alias) to the round-trip test; for a missing file, print instead and the project-wide note too, or narrow the changeset's sentence. The declaration-build failure from the last review is fixed.

Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Before this change a reverse refused an aliased page whose alias leads outside the new folder, so the round trip broke after one pass: verified (the base's path-traversal refusal; the rewritten tests at render.test.mjs:367-379 and :674-726).
  • A byte-identical project file is used and its copy not written: verified, and stricter, since every carried file it reaches must match too (_adapter.mjs:893-916; render.test.mjs:728-817).
  • Render, reverse, edit and render again work in the page's own project, again and again: verified (render.test.mjs:728-817).
  • A differing or missing file comes back in the page's own layout inside the new folder, never into an existing folder: verified (_adapter.mjs:959-961, :991-1001; render.test.mjs:674-726).
  • The answer names the file the alias reaches today, any differing file below it, and the paths entry: verified (render.test.mjs:728-869).
  • The answer says the entry applies to the whole project: false for a missing project file (second finding).
  • The answer gives the relative import of the copy for each restored file that makes the import: false for a restored copy reached through the alias (first finding).
  • A file with no alias record gets the same paths entry from the one carried file its import names: verified (embedded-imports.mjs:334-341, :519; render.test.mjs:871-894).
  • aliased.config and aliased.paths appear only when aliased.imports is not empty: verified (_adapter.mjs:983-990).
  • The maintainers decided never to write into an existing folder or let a restored page use a different file unannounced: an engineering owner's decision on this pull request states it; the first finding shows the relative-import advice can still lead there.
  • The command and its result type are experimental: verified (experimental namespace, [experimental] patch changeset).
  • The named tests exist and pass, and the two refusal tests now check the new behaviour: verified (the render and render-foundation suites pass).
  • 272 of 272 round trips across published canaries: not checkable; that corpus is not in the repository.
  • No new public API hidden under a bug-fix label, and no internal context in public text: verified; the RenderAliased change is declared in the title and changeset.

Files:

  • .changeset/render-reverse-alias-in-project.md: two false sentences (both findings).
  • packages/cli/api/render/_adapter.mjs: first finding (:967-968); no projectWide for a missing file (:977, second finding).
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear; the chained case is missing (first finding).
  • packages/cli/api/render/render.type.mjs: the differs doc repeats the first finding's claim.
  • packages/cli/assets/docs/tree/render-pages.doc.mjs: the guide repeats the first finding's claim.
  • packages/cli/clients/cli/commands/experimental/render.mjs: second finding (:139-144).
  • packages/cli/foundation/render/embedded-imports.mjs: clear; the reused option is now typed.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 8d8b04a

@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: one duplicated helper needs to call the existing one. The two gaps from the last review are fixed, and an engineering owner's decision, approved for this head, settles the alias direction.

  • Miss: relativeImport in packages/cli/api/render/_adapter.mjs:979-982 reimplements relativeSpecifierBetween from packages/cli/api/swizzle/_moduleGraph.mjs:897-903 (the two already differ on .d.ts files), so call that helper, or move it to a shared module both commands import, and delete the copy.

The CI run for this head was cancelled before its jobs ran because CI was full, so re-run it with the fix.

Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Before this change a reverse refused an aliased page whose alias leads outside the new folder, so the round trip broke after one pass: verified (the removed refusal in _adapter.mjs; the rewritten tests at render.test.mjs:367-379 and :685-701).
  • When the aliased file and every carried file it imports match the project's, the page uses the project's files and their copies are not written: verified (_adapter.mjs:888-916, :958-961; render.test.mjs:728-817).
  • Render, reverse, edit and render again work in the page's own project, again and again: verified (render.test.mjs:728-817).
  • A differing or missing file comes back in the page's own layout inside the new folder, never into an existing folder: verified (_adapter.mjs:962-964, :1000-1010; render.test.mjs:685-701, :819-889).
  • The answer names the file the alias reaches today, any differing file below it, and the paths entry: verified (render.test.mjs:785-806, :819-889).
  • The answer says the entry applies to the whole project: verified for a differing, changed-below and missing file (render.mjs:136-140; render.test.mjs:864-889).
  • The answer gives the relative import of the copy for each restored file that makes the import: verified, chains of restored copies included (_adapter.mjs:975-989; render.test.mjs:819-863).
  • A file with no alias record gets the same paths entry from the one carried file its import names: verified (embedded-imports.mjs:333-341, :518-519; render.test.mjs:944-967).
  • aliased.config and aliased.paths appear only when aliased.imports is not empty: verified (_adapter.mjs:992-999).
  • The maintainers decided never to write into an existing folder or let a restored page use a different file unannounced: an engineering owner's decision on this pull request states it, and the tests above hold it.
  • The command and its result type are experimental, released as an experimental patch: verified (experimental namespace; [experimental] patch changeset).
  • The named tests exist and pass, and the earlier refusal tests now check the new behaviour: verified (the render and render-foundation suites pass).
  • 272 of 272 round trips across published canaries: not checkable; that corpus is not in the repository.
  • No new public API hidden under a bug-fix label, and no internal context in public text: verified; the RenderAliased change is declared in the title and changeset.

Files:

  • .changeset/render-reverse-alias-in-project.md: clear.
  • packages/cli/api/render/_adapter.mjs: the duplicated helper (:979-982).
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear.
  • packages/cli/api/render/render.type.mjs: clear.
  • packages/cli/assets/docs/tree/render-pages.doc.mjs: clear.
  • packages/cli/clients/cli/commands/experimental/render.mjs: clear.
  • packages/cli/foundation/render/embedded-imports.mjs: clear.

Automated review (maintainer link)

Comment thread packages/cli/api/render/_adapter.mjs Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec c51b01d

@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: CI has not run its full checks on this head yet, because the run was turned away when CI was full, so re-run all jobs before merging.

The duplicated relative-import helper from the last review now lives once in packages/cli/foundation/fs/relative-specifier.mjs, and both render reverse and swizzle copy call it. An engineering owner's decision, approved for this head, settles the alias direction, and no other finding remains.

Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Before this change a reverse refused an aliased page whose alias leads outside the new folder, so the round trip broke after one pass: verified (the removed refusal in _adapter.mjs; the rewritten tests at render.test.mjs:367-379 and :685-701).
  • When the aliased file and every carried file it imports match the project's, the page uses the project's files and their copies are not written: verified (_adapter.mjs:889-917, :959-961; render.test.mjs:728-817).
  • Render, reverse, edit and render again work in the page's own project, again and again: verified (render.test.mjs:728-817).
  • A differing or missing file comes back in the page's own layout inside the new folder, never into an existing folder: verified (_adapter.mjs:962-973; render.test.mjs:685-701, :819-890).
  • The answer names the file the alias reaches today, any differing file below it, and the paths entry: verified (render.test.mjs:785-806, :819-890).
  • The answer says the entry applies to the whole project and gives the relative import of the copy for each restored file that makes the import: verified, chains of restored copies and a missing file included (render.mjs:138; _adapter.mjs:980-986; render.test.mjs:819-890).
  • A file with no alias record gets the same paths entry from the one carried file its import names: verified (embedded-imports.mjs:334-341, :518-519; render.test.mjs:944-967).
  • aliased.config and aliased.paths appear only when aliased.imports is not empty: verified (_adapter.mjs:989-996).
  • The maintainers decided that a reverse never writes into an existing folder or lets a restored page use a different file without saying so: an engineering owner's decision on this pull request states it, and the tests above hold it.
  • The command and its result type are experimental, released as an experimental patch: verified (experimental namespace; [experimental] patch changeset).
  • The named tests exist and pass, and the earlier refusal tests now check the new behaviour: verified (the render, render-foundation and swizzle suites pass).
  • 272 of 272 round trips across published canaries: not checkable, because that corpus is not in the repository.
  • No new public API is hidden under a bug-fix label, and public text holds no internal context: verified; the RenderAliased change is declared in the title and changeset.
  • The smallest-restoration list: accurate for the render change. It does not name the relative-import helper now shared in foundation/fs, a refactor that leaves swizzle's output unchanged.
  • The testing command passes: verified.

Files:

  • .changeset/render-reverse-alias-in-project.md: clear.
  • packages/cli/api/render/_adapter.mjs: clear (calls the shared helper at :985).
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear.
  • packages/cli/api/render/render.type.mjs: clear.
  • packages/cli/api/swizzle/_adapter.mjs: clear (the re-export it drops is not reachable from the package's exports).
  • packages/cli/api/swizzle/_moduleGraph.mjs: clear (the copy is removed).
  • packages/cli/api/swizzle/copy/copy.mjs: clear (imports the shared helper).
  • packages/cli/assets/docs/tree/render-pages.doc.mjs: clear.
  • packages/cli/clients/cli/commands/experimental/render.mjs: clear.
  • packages/cli/foundation/fs/relative-specifier.mjs: clear (the same output as swizzle's former helper).
  • packages/cli/foundation/render/embedded-imports.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/rl-reverse-alias-on-236ff3e branch from c51b01d to 9645820 Compare November 18, 2026 11:34
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 9645820

@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 engineering owner approved the alias direction for this exact head, and no defect remains. CI has not run on this head yet.

Before it can land, rebase onto main: #12404 changed the same lines in packages/cli/api/render/_adapter.mjs (the reachableFiles call in reverseToFile) and render.type.mjs (the data.exact and data.missing docs), so GitHub reports a conflict. Keep both changes when you resolve it. The rebased head needs a new review and its own /approve-spec.

Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Before this change, a reverse refused an aliased page whose alias leads outside the new folder (its own project, the same project after an upgrade, a new project after pasting the printed entry), so the round trip broke after one pass: verified (the base exits 1 in all three fixture cases; the rewritten tests at render.test.mjs:368-380 and :685-702).
  • When the aliased file and every carried file below it match, the page uses the project's files and the copies are not written: verified (_adapter.mjs:937-957, :999-1001; render.test.mjs:729-818).
  • When that file differs or is missing, the page's copy comes back in its own layout inside the new folder, never into a folder that exists: verified (_adapter.mjs:1003-1013, :1037-1046; render.test.mjs:685-702, :820-891).
  • The answer names the file the alias reaches today, says it differs or is not there, and gives the paths entry that leads the import to the copy: verified (export.mjs:172-185; head transcripts).
  • A file with no alias record gets the same entry from the one carried file the import names: verified (embedded-imports.mjs:339-346, :523-524; render.test.mjs:945-968).
  • The command is experimental: verified; it sits under the experimental group.
  • The maintainers decided that a reverse never writes into an existing folder or lets a restored page use a different file without saying so: an engineering owner's decision on this pull request states it, approved for this head.
  • The smallest-restoration list: accurate for the reverse change; it does not name the relative-import helper now shared with swizzle, whose output is unchanged.
  • The named tests exist and pass, and the two earlier refusal tests now check the new behaviour: verified (render.test.mjs:368, :685, :729, :945).
  • The testing command passes: verified.
  • 272 of 272 round trips across published canaries: not checkable, because that corpus is not in the repository.
  • No new public API hidden under a bug-fix label, and no internal context in public text: verified; the RenderAliased change is declared in the changeset.
  • Changeset: every sentence matches the code and tests above, aliased.config and aliased.paths appear only with imports (_adapter.mjs:1029-1036), and it ships as an experimental patch.

Files:

  • .changeset/render-reverse-alias-in-project.md: clear.
  • packages/cli/api/render/_adapter.mjs: clear (conflicts with main).
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear.
  • packages/cli/api/render/render.type.mjs: clear (conflicts with main).
  • packages/cli/api/swizzle/_adapter.mjs: clear (the dropped re-export is not reachable from the package's exports).
  • packages/cli/api/swizzle/_moduleGraph.mjs: clear.
  • packages/cli/api/swizzle/copy/copy.mjs: clear.
  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.
  • packages/cli/clients/cli/commands/experimental/export.mjs: clear.
  • packages/cli/foundation/fs/relative-specifier.mjs: clear (the same output as swizzle's former helper).
  • packages/cli/foundation/render/embedded-imports.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/rl-reverse-alias-on-236ff3e branch from 2930cb9 to 6603a51 Compare November 18, 2026 14:13
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 6603a51

@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.

Approval waits on an engineering owner's decision for this head. No current record decides how astryx experimental export --reverse handles a path-alias import whose project file lies outside the new folder: reusing an identical project file (aliased.sameAsProject), restoring the page's copy with a project-wide paths entry and relative-import alternatives (aliased.differs), finding an unrecorded import's target by path suffix, and the four changed rows of the experimental RenderAliased type. The owner decision on this pull request was approved for earlier heads; this head rebases the same change, so an engineering owner records it again by commenting /approve-spec <full head SHA> (the author may do so as an engineering owner).

No defect was found, and the new tests fail on the base and pass on this head.

Claims and files checked

Review mode: full; reason: rebase

Claims:

  • Before this change, a reverse refused an aliased page whose alias leads outside the new folder (its own project, the same project later, a new project after pasting the printed entry), so the round trip broke after one pass: verified (the base exits 1 in each of those cases; the head's new tests fail on the base code).
  • When the aliased file and every carried file below it match, the page uses the project's files and the copies are not written: verified (_adapter.mjs:957-977, :1019-1022; render.test.mjs:729-818).
  • When that file differs or is missing, the page's copy comes back in its own layout inside the new folder, never into a folder that exists: verified (_adapter.mjs:1023-1033, :1057-1067; render.test.mjs:686-702, :820-891).
  • The answer names the file the alias reaches today, says it differs or is not there, and gives the paths entry that leads the import to the copy: verified (export.mjs:172-185; render.test.mjs:820-943).
  • A file with no alias record gets the same entry from the one carried file the import names: verified (embedded-imports.mjs:343-350, :524-529; render.test.mjs:945-968).
  • The command is experimental: verified; it sits under the experimental group.
  • The maintainers decided that a reverse never writes into an existing folder and never lets a restored page use a different file without saying so: an engineering owner's decision on this pull request states it, approved for earlier heads only.
  • The smallest-restoration list: accurate for the reverse change; it does not name the relative-import helper now shared with swizzle, whose output is unchanged.
  • The named tests exist and pass, and the two earlier refusal tests now check the new behaviour: verified (render.test.mjs:368, :686, :729, :945).
  • The testing command passes: verified (one environmental temp-folder test in a neighbouring suite fails the same way on the base).
  • 272 of 272 round trips across published canaries: not checkable, because that corpus is not in the repository.
  • No new public API hidden under a bug-fix label, and no internal context in public text: verified; the RenderAliased change is declared in the changeset.
  • Changeset: every sentence matches the code and tests above, aliased.config and aliased.paths appear only with imports (_adapter.mjs:1049-1056), and it ships as an experimental patch.

Files:

  • .changeset/render-reverse-alias-in-project.md: clear.
  • packages/cli/api/render/_adapter.mjs: clear (the rebase keeps main's missing rule).
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear.
  • packages/cli/api/render/render.type.mjs: clear; its four rows wait on the owner decision.
  • packages/cli/api/swizzle/_adapter.mjs: clear (the dropped re-export is not reachable from the package's exports).
  • packages/cli/api/swizzle/_moduleGraph.mjs: clear.
  • packages/cli/api/swizzle/copy/copy.mjs: clear.
  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.
  • packages/cli/clients/cli/commands/experimental/export.mjs: clear.
  • packages/cli/foundation/fs/relative-specifier.mjs: clear (the same output as swizzle's former helper).
  • packages/cli/foundation/render/embedded-imports.mjs: clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision update (engineering owner, covering this pull request at its current head): when astryx experimental export --reverse restores a page that imports a project path alias whose project file lies outside the new folder, it reuses the project's own file only when that file and every carried file it reaches match what the page carried (aliased.sameAsProject). Otherwise it restores the page's copy, prints the exact project-wide paths entry the copy needs, and offers relative imports instead (aliased.differs). For an import the file did not record, it finds the target by its path suffix. The experimental RenderAliased type describes these rows. It never edits a file it did not write.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 5d29d1b

@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 engineering owner approved the alias direction for this exact head and no defect was found, but CI has not run on this head yet.

  • Regression: the branch now conflicts with main, where experimental import moved the reverse's text output into printRestored in render-output.mjs, which calls Object.entries(d.aliased.paths) whenever aliased is set, so the rebase has to carry the sameAsProject and differs lines and their imports.length && paths guard from export.mjs there, or a reuse-only result crashes with a TypeError.

The rebased head needs a new review and approval, and a CLI-text test of the reuse-only answer would catch that crash.

Claims and files checked

Review mode: incremental; reason: none

Changed rules (0): none.

Claims:

  • Before this change, a reverse refused an aliased page whose alias leads outside the new folder (its own project, the same project later, a new project after pasting the printed entry), so the round trip broke after one pass: verified (the base exits 1 in each of those cases; the head's new tests fail on the base code).
  • The cause was that the reverse treated such an alias as unsafe and refused: verified (the base's refusal says the alias points outside the folder the restore creates).
  • When the aliased file and every carried file below it match, the page uses the project's files and the copies are not written: verified (_adapter.mjs:957-977, :1019-1022; render.test.mjs:729-818).
  • When that file differs or is missing, the page's copy comes back in its own layout inside the new folder, never into a folder that exists: verified (_adapter.mjs:1023-1033, :1057-1070; render.test.mjs:675-702, :820-891).
  • The answer names the file the alias reaches today, says it differs or is not there, and gives the paths entry that leads the import to the copy: verified (export.mjs:172-185; render.test.mjs:893-943).
  • A file with no alias record gets the same entry from the one carried file the import names: verified (embedded-imports.mjs:343-350, :527-528; render.test.mjs:945-968).
  • The command is experimental: verified; it sits under the experimental group.
  • The maintainers decided that a reverse never writes into an existing folder and never lets a restored page use a different file without saying so: verified; an engineering owner's decision on this pull request, approved for this head, states the direction, and every write stays inside the new folder.
  • The smallest-restoration list: accurate for the reverse change; it does not name the relative-import helper now shared with swizzle, whose output is unchanged.
  • The named tests exist and pass, and the two earlier refusal tests now check the new behaviour: verified (render.test.mjs:368, :675, :729, :945).
  • The testing command passes: verified (one temp-folder test in a neighbouring suite fails the same way on the base).
  • 272 of 272 round trips across published canaries: not checkable, because that corpus is not in the repository.
  • No new public API hidden under a bug-fix label, and no internal context in public text: verified; the RenderAliased change is declared in the changeset.
  • Changeset: every sentence matches the code and tests above, aliased.config and aliased.paths appear only with imports (_adapter.mjs:1049-1056), and it ships as an experimental patch.

Files:

  • .changeset/render-reverse-alias-in-project.md: clear.
  • packages/cli/api/render/_adapter.mjs: clear.
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear.
  • packages/cli/api/render/render.type.mjs: clear; its four rows are covered by the owner decision.
  • packages/cli/api/swizzle/_adapter.mjs: clear (the dropped re-export is not reachable from the package's exports).
  • packages/cli/api/swizzle/_moduleGraph.mjs: clear.
  • packages/cli/api/swizzle/copy/copy.mjs: clear.
  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.
  • packages/cli/clients/cli/commands/experimental/export.mjs: clear at this head; it conflicts with main, as above.
  • packages/cli/foundation/fs/relative-specifier.mjs: clear (the same output as swizzle's former helper).
  • packages/cli/foundation/render/embedded-imports.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/rl-reverse-alias-on-236ff3e branch from 5d29d1b to 64ed337 Compare November 18, 2026 16:10
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 64ed337

@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 engineering owner approved the alias direction for this exact head, and no defect remains. CI has not finished on this head yet: the node test shards, one UI test shard, the build test and the docsite build were still running, with nothing failing so far.

The rebase onto main carries the reuse and differs text, with its paths guard, into the output that experimental import and export --reverse now share, so a reuse-only answer no longer fails. A CLI-text assertion for the reuse-only answer would keep that path covered.

Claims and files checked

Review mode: full; reason: rebase

Description claims:

  • Before this change, the reverse refused an aliased page whose alias leads outside the new folder, so the round trip broke after one pass: verified (the base exits 1 when the project's file is unchanged, changed, changed below or missing; the six alias tests fail on the base code).
  • The cause was that the reverse treated such an alias as unsafe and refused: verified (the base's refusal says the alias points outside the folder the restore creates).
  • When the aliased file and every carried file below it match, the page uses the project's files and the copies are not written: verified (_adapter.mjs:957-977, :1019-1021; render.test.mjs:368, :729-818).
  • When that file differs or is missing, the page's copy comes back in its own layout inside the new folder, never into a folder that exists: verified (_adapter.mjs:1023-1033, :1057-1067; render.test.mjs:689-702, :820-891).
  • The answer names the file the alias reaches, says it differs or is not there, and gives the paths entry that leads the import to the copy: verified (render-output.mjs:145-163; render.test.mjs:809-812, :886-889, :938-940).
  • A file with no alias record gets the same entry from the one carried file the import names: verified (embedded-imports.mjs:343-350, :517-528; render.test.mjs:945-968).
  • The command is experimental: verified; it is registered under the experimental group.
  • The maintainers decided that a reverse never writes into an existing folder and never lets a restored page use a different file without saying so: verified; an engineering owner's decision on this pull request, approved for this head, states the direction, and every write stays inside the new folder.
  • The smallest-restoration list: accurate for the reverse change; it does not name the relative-import helper now shared with swizzle, whose output is unchanged.
  • The named tests exist and pass, and the two earlier refusal tests now check the new behaviour: verified (render.test.mjs:368, :675, :729, :945).
  • The testing command passes: verified.
  • 272 of 272 round trips across published canaries: not checkable, because that corpus is not in the repository.
  • No new public API hidden under the bug-fix label, and no internal context in public text: verified; the RenderAliased change is declared in the changeset.

Changeset claims:

  • The reverse gives such a page back instead of refusing it, and reuses the project's files when the aliased file and the carried files it imports match, so export, reverse, edit and export again keep working: verified (render.test.mjs:729-818).
  • Otherwise the page's copy comes back inside the new folder, and the answer names the file the alias reaches and any file below it that differs: verified (_adapter.mjs:1023-1030).
  • The answer says the entry applies to the whole project and gives the relative import for each restored file that makes the import: verified (render.test.mjs:820-891).
  • A file from a CLI that recorded no alias imports gets the same entry from the carried file the import's path ends with: verified (render.test.mjs:945-968).
  • aliased.config and aliased.paths appear only when aliased.imports is not empty: verified (_adapter.mjs:1053).
  • It ships as an experimental patch: verified; the changeset check passes.

Files:

  • .changeset/render-reverse-alias-in-project.md: clear.
  • packages/cli/api/render/_adapter.mjs: clear.
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear.
  • packages/cli/api/render/render.type.mjs: clear.
  • packages/cli/api/swizzle/_adapter.mjs: clear.
  • packages/cli/api/swizzle/_moduleGraph.mjs: clear.
  • packages/cli/api/swizzle/copy/copy.mjs: clear.
  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.
  • packages/cli/clients/cli/commands/experimental/render-output.mjs: clear.
  • packages/cli/foundation/fs/relative-specifier.mjs: clear.
  • packages/cli/foundation/render/embedded-imports.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/rl-reverse-alias-on-236ff3e branch from 64ed337 to 01ea722 Compare November 18, 2026 19:25
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 01ea722

@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 engineering owner approved the alias direction for this exact head, and no defect remains. CI has not finished on this head yet: two node test shards, the build test, the node browser contracts and the docsite browser check were still running, with nothing failing so far.

  • Non-blocking: when a file the alias reaches names an image from the site root (/logo.png) and the project's public/logo.png differs, the reverse declines reuse and offers paths and relative imports, but the restored copy still loads the project's image, so that advice cannot bring the carried image back (packages/cli/api/render/_adapter.mjs:960).
Claims and files checked

Review mode: full; reason: rebase

Changeset claims:

  • The reverse gives back a page whose alias leads outside the new folder instead of refusing it: verified (_adapter.mjs:1008-1035; render.test.mjs:368, :729).
  • When the aliased file and every carried file it imports match, the page uses the project's files and their copies are not written: verified (_adapter.mjs:957-977, :1019-1022; render.test.mjs:368, :729).
  • Export, reverse, edit and export again keep working in the page's own project: verified (render.test.mjs:729).
  • When that file differs or is missing, the page's copy comes back in its own layout inside the new folder, never into a folder that exists: verified (_adapter.mjs:1023-1033, :1057-1067; render.test.mjs:675, :820).
  • The answer names the file the alias reaches and any file below it that differs, with the paths entry that leads the import to the copy: verified (render-output.mjs:145-163; render.test.mjs:729, :893).
  • The answer says that entry applies to the whole project and gives the relative import for each restored file that makes the import: verified (_adapter.mjs:1040-1046; render.test.mjs:820).
  • A file from a CLI that recorded no alias imports gets the same entry from the carried file the import's path ends with: verified (embedded-imports.mjs:344-351, :556-571; render.test.mjs:945).
  • aliased.config and aliased.paths appear only when aliased.imports is not empty: verified (_adapter.mjs:1049-1056).

Description claims:

  • Before this change the reverse refused such a page, so the round trip worked once and then broke: verified (the six changed alias tests fail against the base code with its refusal).
  • The cause was that the reverse treated an alias leading outside the new folder as unsafe: verified (the base's refusal message says so).
  • Reuse when the aliased file and every carried file below it match; otherwise restore the page's copy with its paths entry, also for an early file with no alias record: verified (as above).
  • The command is experimental: verified (it sits in the experimental command group, and the type is tagged experimental).
  • The maintainers decided that a reverse never writes into an existing folder and never uses a different file without saying so: verified (an engineering owner's decision on this pull request, approved for this head; _adapter.mjs:1057-1067).
  • The smallest-restoration file list: accurate for the reverse change; it does not name the relative-import helper now shared with swizzle, whose output is unchanged.
  • The named tests exist and pass, and the two earlier refusal tests now check the new behaviour: verified (render.test.mjs:368, :675, :729, :945).
  • The testing command passes: verified for the render tests (205 of 205).
  • 272 of 272 round trips across published canaries: not checkable, because that set is not in the repository.
  • No new public API hidden under the bug-fix label, and no internal context in public text: verified; the RenderAliased change is declared in the changeset.

Files:

  • .changeset/render-reverse-alias-in-project.md: clear.
  • packages/cli/api/render/_adapter.mjs: clear; one non-blocking note above.
  • packages/cli/api/render/render.doc.mjs: clear.
  • packages/cli/api/render/render.test.mjs: clear.
  • packages/cli/api/render/render.type.mjs: clear.
  • packages/cli/api/swizzle/_adapter.mjs: clear.
  • packages/cli/api/swizzle/_moduleGraph.mjs: clear.
  • packages/cli/api/swizzle/copy/copy.mjs: clear.
  • packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.
  • packages/cli/clients/cli/commands/experimental/render-output.mjs: clear.
  • packages/cli/foundation/fs/relative-specifier.mjs: clear.
  • packages/cli/foundation/render/embedded-imports.mjs: clear.

Automated review (maintainer link)

for (const [p, r] of reached) {
for (const abs of r.aliased) {
if (abs === target || within(abs) || reused.has(abs) || changedBelow.has(abs) || !sameFile(abs, carried(p))) continue;
const sub = reachableFiles([/** @type {{path: string, base64: string}} */ (byPath.get(p)), ...source.files.filter(f => f.path !== p)], {aliases, recorded: {}, publicDir: source.publicDir});

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.

Non-blocking: with publicDir, this walk also reaches images a carried file names from the site root (/logo.png → public/logo.png). When that image changed in the project, reuse is declined, the answer says files it imports differ, and it offers paths and instead. The restored copy still loads /logo.png from the project's public/, because the page's copy lands under the new folder, which the site does not serve. Leaving site-root images out of this comparison, or naming them as served by the project, would keep the advice accurate.

josephfarina added a commit that referenced this pull request Nov 19, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12072 fix(templates): payment form and checkout wrap the summary below the form on a narrow first paint
  Author: Joey Farina <[email protected]>
- #12274 fix(core): cap the Selector family's trigger-width list minimum at the viewport
  Author: josephfarina <[email protected]>
- #12215 fix(cli): advise keeping one dependency when two packages declare one provider ID
  Author: Joey <[email protected]>
- #12322 [experimental] export --reverse: use the project's own copy of an aliased file, or restore the page's copy with its paths entry
  Author: josephfarina <[email protected]>
- #12403 docs(core): Text's as and PowerSearch's statusVariant list every value their types allow
  Author: Joey Farina <[email protected]>
- #12494 fix(templates): dashboard templates use page sections, not cards, for page regions
  Author: Joey Farina <[email protected]>
- #12282 fix(cli): theme build --check and doctor ignore which CLI release, and which command name, built a theme
  Author: Joey Farina <[email protected]>
- #12420 fix(Chat): ChatToolCalls and ChatDictationButton without a required prop name it and the fix in development
  Author: Joey Farina <[email protected]>
- #12205 fix(cli): equally scored icons put first one whose id the query names in full
  Author: Joey Farina <[email protected]>
- #12455 fix(core): a theme sets the room between a checkbox or a switch and its label
  Author: josephfarina <[email protected]>
- #12658 perf(cli): the first theme build after a CLI upgrade reuses the JavaScript it compiled from a theme's local modules
  Author: Joey <[email protected]>
- #12323 [experimental] export: React logs no render timings while the export draws a page
  Author: Joey Farina <[email protected]>
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12713.

@github-actions
github-actions Bot deleted the josephfarina/rl-reverse-alias-on-236ff3e branch November 19, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 01ea7228 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