Skip to content

fix(editor): say a missing folder of a link is missing before the trust prompt - #371

Open
Exeloo wants to merge 5 commits into
mainfrom
fix/load-missing-folder
Open

Exeloo wants to merge 5 commits into
mainfrom
fix/load-missing-folder

Conversation

@Exeloo

@Exeloo Exeloo commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Closes #318

Stacked on fix/load-page-trust (#367): merge that one first. Until it merges, this PR also shows its three commits (788b337, 5de0b8c, acfcbe1). This PR's own commits are 36ef7bd and f80f2f6.

/load?path=<folder> used to ask to trust a folder before saying it does not exist. It now checks the folder with a new projects.locate RPC first. locate runs the same hosted, root folder and directory checks as open, through one shared private method (_localFolder), and opens nothing, runs no project code and returns no path.

load page: Promise.all([locate(path), known(path)]) -> prompt | open
                 \-> NOT_FOUND / FORBIDDEN -> error view (no prompt)
  • packages/protocol: projects.locate: { input: { path }, output: null }, with TSDoc.
  • packages/server-core: ProjectRegistry.locate and its handler; _openLocal keeps its checks, codes and messages word for word.
  • packages/project: ProjectService.locate(path) (a new public method; the SDK exports only its token).
  • apps/editor: the /load page calls locate and the recent projects check together, then shows the prompt or opens the project.

Behaviour change: a folder outside the root folder also gets its error right away, without the prompt. On a hosted editor the page is unchanged (it still refuses path links before any RPC).

How do you test this PR?

  • Before (fix reverted, tests kept, pnpm build): load-page.spec.ts "a missing folder says so without asking to trust it" and workbench.spec.ts:172 "opens a project from a link" fail: the trust prompt shows instead of "No project folder at missing-folder". 2 failed, 4 passed.
  • After: load-page.spec trust.spec workbench.spec --retries 0: 17 passed, 0 failed, 0 skipped (on 36ef7bd and again on f80f2f6).
  • New server-core tests:
    • trust.spec.ts: locate finds a trusted folder without running its config, gives NOT_FOUND for a missing folder or a file, FORBIDDEN outside the root folder, and one refusal for any path on a hosted editor;
    • project-registry.spec.ts: a hosted registry refuses locate before it looks at the folder. Moving the hosted check after the folder lookup makes it fail with three different answers.
  • The e2e test "an error that replaces the trust prompt takes focus" now reaches its error by failing projects.open on a real folder, since a missing folder no longer goes through the prompt. AGENTS.md tells e2e authors to open such folders with /load?path= directly.
Command (final tree, f80f2f6) Result
pnpm build pass
pnpm lint pass
pnpm typecheck pass
server-core npx vitest run 25 files, 131 tests passed
e2e load-page.spec trust.spec workbench.spec, Chromium, --retries 0 17 passed
CHROME=… pnpm test (on 36ef7bd) 41/41 tasks; 1 skip (editor-native.spec.ts, no .examples/)

Integration: a scratch branch with every editor branch of this sweep merged (f80f2f6 included) passed pnpm build, lint, typecheck, pnpm test --force (1014 passed, 1 skipped) and the full e2e suite with the engine (141/141, Chromium only).

Merge danger

  • Two-way door. It adds one RPC method to the projects contract and removes nothing. Blast radius: the editor only; protocol, server-core and project are internal workspace packages. Merging to main deploys the editor app.
  • Merge order: fix/load-page-trust (fix(editor): focus the loading screen errors and keep the new project dialog open #367) first. This branch edits apps/editor/e2e/load-page.spec.ts, which that branch creates. If fix(editor): focus the loading screen errors and keep the new project dialog open #367 is squash-merged, rebase this branch on main before merging.
  • packages/server-core/test/project/project-registry.spec.ts is also created, on their own, by fix/server-plugins-deactivate and fix/server-core-fs-safety. Whoever merges second or third must fold the tests together: one top-level setup, and the later suites inside their own describe (this branch's suite is describe('ProjectRegistry.locate') with its own root and registry variables). The integration branch did this and the file passed 12/12.

Follow-up issues

None.

Quality gate

Small gate: one reviewer covering every lane, plus the security reviewer.

Lane Result HEAD covered
Docs Pass: AGENTS.md e2e note and the TSDoc updated; no user docs change needed 36ef7bd
Correctness Pass (Minor M1: run locate and the recent check together, fixed in f80f2f6) 36ef7bd
Performance Pass (M1 above) 36ef7bd
Accessibility Pass: the new error path takes focus and is described 36ef7bd
Security Pass (Minor: add a registry-level test for the hosted refusal, done in f80f2f6) 36ef7bd
Style Pass 36ef7bd

Last round f80f2f6 (Promise.all, the hosted registry test): producer red→green (order check) and the commands above, not re-reviewed.

The trust prompt of /load and the error views of /load and /project/[id]
replaced the live progress block without moving focus, so focus fell to
the page body and nothing was read out. The title now takes focus each
time an error is shown, with the hint as its description.

Closes #261
The dialog closed before the request while its trigger was disabled, so
focus fell to the page body and a failure showed behind the page. It now
stays open until the project is made, with the progress and the error
inside it and the entries kept.

Closes #316
Escape, Cancel and the close button no longer close the dialog while
the project is made, and closing it clears its error. The loading
screen's error detail is part of the title's description instead of a
second alert.
…st prompt

/load?path= now checks the folder with a new projects.locate RPC before
asking to trust it. locate runs the same hosted, root folder and stat
checks as open, through the same code, and opens nothing: a missing
folder or one outside the root folder gets its error at once.

Closes #318
…ther

The load page runs projects.locate and the recent projects check at once.
A registry test pins that a hosted editor refuses locate before it looks
at the folder: one refusal for an existing, a missing and an outside
folder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apps:editor Related to Editor app packages:project Related to Project package packages:protocol Related to Protocol package packages:server-core Related to Server core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/load of a missing folder asks for trust before saying it does not exist

1 participant