Skip to content

fix(project): reopen a swept project and bound the file system lookups - #375

Open
Exeloo wants to merge 12 commits into
mainfrom
fix/project-fs-sync
Open

Exeloo wants to merge 12 commits into
mainfrom
fix/project-fs-sync

Conversation

@Exeloo

@Exeloo Exeloo commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Closes #268
Closes #271
Closes #259
Refs #258

Four fixes in the client file system of a project (packages/project, ProjectFs and ClientProject):

Why #258 stays open: the runtime panels' streams are not resubscribed after a reopen, nothing listens to onDidLose yet (the tab stays as it was), and a server copy opened for a reopen that gave up stays open until the sweep, because the projects contract has no close. AGENTS.md documents this under "Server streams and the idle sweep".

How do you test this PR?

New tests in packages/project/test:

  • fs/project-fs-races.spec.ts: a large change batch is checked 16 stats at a time and told in its order; a file a batch made in a folder the same batch saw deleted is kept; at most 32 cached files are looked up at once, in order; the children of a folder match a scan of the whole tree.
  • fs/project-fs.spec.ts: the project opens again after the idle sweep closed it while the tab was away.
  • service/client-project.spec.ts (new, 9 tests against a fake RPC): reopens and follows again; gives up on another trust, with no recent entry, when the open fails; opens nothing once disposed; a project lost again and again opens only once; tries again when the open may pass; gives up within 30 s of a reopen, not after; ignores a refusal of a request sent before the reopen.

Red before green, from the producer reports:

  • at e1de3e2 the six first client-project.spec.ts tests fail (onDidLose did not exist); at a413bd7 the dispose test fails (expected "vi.fn()" to not be called at all, but actually been called 1 times);
  • "tries again on the next loss when the open may pass" fails at a7cea11, where any error gave up;
  • the 30 s window test fails with the window set to 0, and the reattach guard test fails with the guard removed.

No red run or timing is recorded for the #268, #271 and #259 tests (the first producer report was not kept).

Command Result
CHROME=… pnpm test:unit in packages/project (Node, Chromium, Firefox), on af9bf77 11 files, 77 tests passed, 0 skipped
pnpm lint, pnpm typecheck, on af9bf77 pass
pnpm build (round 1, a7cea11) pass
plugins/file-manager (25 tests), packages/code (48 tests), packages/sdk (3 tests, snapshot unchanged), round 1 pass

Integration: a scratch branch with every editor branch of this sweep merged 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 (a revert is enough). Internal to packages/project; ProjectFs.onDidLose, ProjectFs.reattach and ClientProject.onDidLose are tagged @internal. No protocol or server change. Merging to main deploys the editor app.
  • AGENTS.md: fix/server-core-fs-safety and fix/tooling-scripts also add text there (fix/tooling-scripts edits the same "after changing a plugin manifest" area). Keep both texts when resolving.

Follow-up issues

Quality gate

Lane Result HEAD covered
Docs Updated (AGENTS.md, fff4528, reworded in af9bf77) fff4528
Correctness Round 1 findings fixed (a413bd7…a7cea11); re-review found one regression (any error gave up), fixed in 82ea0d6 a7cea11
Performance Pass (Minor: the deletion scan, filed as #339) fff4528
Accessibility N/A: no UI change fff4528
Security Pass (Minor: comment reworded in a413bd7) fff4528
Style Pass (Minor: a test title over 100 columns, fixed in a7cea11) fff4528

Last round 82ea0d6, 6572993, af9bf77: producer red→green and the coordinator read the 82ea0d6 diff, not re-reviewed.

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

Labels

packages:project Related to Project package

Projects

None yet

1 participant