test(e2e): compare project paths in the Host's stored spelling - #434
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
pnpm test:e2efailed on a Windows checkout in two project-removal scenarios, andthe failure was in the assertion's operand rather than in the product.
The Host stores and reports a project path in
canonical_project_pathspelling:the directory is resolved and the separators are normalized to
/(
crates/host-core/src/db/repositories.rs), soprojects.listreturnsC:/Users/.../e2e-project-kepton Windows. Both scenarios compared that againstrealpathSync, which keeps the platform separators (C:\Users\...), so theclauses 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
nothingDeletedA 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.mjsonly:storedProjectPath(path)helper —realpathSync(path).replace(/\\/g, "/")—reproduces the Host's storage spelling, and the scenarios compare
projects.listagainst it;
projects.create,session.create'sprojectPath,project.memory.*,projects.remove) stay platform-native, so the Host is stillexercised 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:e2eon the integrated localmain(557bd48b, Windows / PowerShell)→ exit 0,
Summary: 21 / 21 passed; 2 skipped. The 2 skips areE2E-008-live-model/E2E-009-stream, which needPI_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->0and
PASS E2E-PROJECT-delete-removes-project-and-owned-sessions-refuses-while-running — refused=1008/CONFLICT then removed=true sessionsRemoved=1.9c72eec0, the same command wasexit 1with19 / 21 passed; 2 skippedand byte-identical FAIL lines (the assertion fileblob
2aa09d54and 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.