Skip to content

test(e2e): compare project paths in the Host's stored spelling - #434

Merged
Tioit-Wang merged 1 commit into
mainfrom
fix/e2e-smoke-windows-project-path-spelling
Sep 15, 2026
Merged

Tioit-Wang merged 1 commit into
mainfrom
fix/e2e-smoke-windows-project-path-spelling

Conversation

@Tioit-Wang

Copy link
Copy Markdown
Collaborator

What

pnpm test:e2e failed on a Windows checkout in two project-removal scenarios, and
the failure was in the assertion's operand rather than in the product.

The Host stores and reports a project path in canonical_project_path spelling:
the directory is resolved and the separators are normalized to /
(crates/host-core/src/db/repositories.rs), so projects.list returns
C:/Users/.../e2e-project-kept on Windows. Both scenarios compared that against
realpathSync, which keeps the platform separators (C:\Users\...), so the
clauses could never be satisfied:

  • E2E-PROJECT-delete-removes-project-and-owned-sessions
    projectsAfter.projects.some((project) => project.path === keptProjectPath)
  • E2E-PROJECT-delete-removes-project-and-owned-sessions-refuses-while-running
    the same comparison inside nothingDeleted

A second clause was disguised by the same mismatch:
projectsAfter.projects.every((project) => project.path !== removedProjectPath)
passed vacuously on Windows, because a backslash spelling can never equal a
slash spelling. Both clauses are about which projects exist, not about separators.

Change

scripts/e2e-smoke.mjs only:

  • a storedProjectPath(path) helper — realpathSync(path).replace(/\\/g, "/")
    reproduces the Host's storage spelling, and the scenarios compare projects.list
    against it;
  • the request paths (projects.create, session.create's projectPath,
    project.memory.*, projects.remove) stay platform-native, so the Host is still
    exercised with native input rather than only with a normalized spelling.

Test-only: no renderer, host, IPC, permission, plugin-contract, or schema change,
and no product behavior change, so no spec or E2E scenario document changes.

No issue is closed by this PR; the failure was found while validating the
queue/chat/desktop changes delivered as #429, #430 and #431.

Validation

  • pnpm test:e2e on the integrated local main (557bd48b, Windows / PowerShell)
    exit 0, Summary: 21 / 21 passed; 2 skipped. The 2 skips are
    E2E-008-live-model / E2E-009-stream, which need PI_DESKTOP_TEST_API_KEY.
    Both scenarios that previously failed now report
    PASS E2E-PROJECT-delete-removes-project-and-owned-sessions — removed=true sessionsRemoved=2 artifacts=10->0
    and
    PASS E2E-PROJECT-delete-removes-project-and-owned-sessions-refuses-while-running — refused=1008/CONFLICT then removed=true sessionsRemoved=1.
  • Before this change, on 9c72eec0, the same command was exit 1 with
    19 / 21 passed; 2 skipped and byte-identical FAIL lines (the assertion file
    blob 2aa09d54 and the host path code were unchanged between the two runs).
  • node --check scripts/e2e-smoke.mjs → clean.

The assertion is stronger after the change, not weaker: the "removed project is
gone" clause can now fail, where before it was a tautology on Windows.

The project removal scenarios compared projects.list output against

ealpathSync, which keeps the platform's own separators. The Host stores and
reports a project path in canonical_project_path spelling — the directory is
resolved and the separators are normalized to / — so on Windows those two
spellings never matched and the suite failed on two scenarios:

- E2E-PROJECT-delete-removes-project-and-owned-sessions failed on
  projectsAfter.projects.some((project) => project.path === keptProjectPath).
- ...-refuses-while-running failed on the same comparison inside

othingDeleted.

Both clauses are about the project set, not about path separators, so the fix is
the comparison operand: a storedProjectPath helper resolves the directory and
normalizes the separators, and the two scenarios compare projects.list against
it. The request paths stay platform-native, the way a real client sends them, so
the host is still exercised with native input.

This also makes the sibling clause able to fail: projectsAfter.projects.every(
(project) => project.path !== removedProjectPath) passed vacuously on Windows,
because a backslash spelling can never equal a slash spelling.

Renderer/host/spec behavior is unchanged; the file is test-only.
@Tioit-Wang
Tioit-Wang merged commit 8fff510 into main Sep 15, 2026
3 checks passed
@Tioit-Wang
Tioit-Wang deleted the fix/e2e-smoke-windows-project-path-spelling branch September 15, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant