mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5644] [MERGED] feat(tooling): type-check the Playwright e2e specs in pnpm check #6864
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6864
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5644
Author: @kolacheee
Created: 8/29/2026
Status: ✅ Merged
Merged: 8/29/2026
Merged by: @kolacheee
Base:
staging← Head:feat/e2e-type-lane📝 Commits (1)
8e26644feat(tooling): type-check the Playwright e2e specs in pnpm check📊 Changes
7 files changed (+150 additions, -92 deletions)
View changed files
📝
e2e/core-flows.e2e.ts(+88 -85)➕
e2e/page-context-modules.d.ts(+38 -0)📝
package.json(+4 -2)📝
packages/client/src/lib/slash-commands.ts(+1 -1)📝
packages/client/src/localization/locale-loader.ts(+2 -2)📝
pnpm-lock.yaml(+3 -0)📝
tsconfig.json(+14 -2)📄 Description
Why
The root tsconfig has always included
e2e/**/*.ts, but no check lane ever ran tsc on it —pnpm checkruns only the three package lints. That let a plain runtimeReferenceError(a variable moved into a closure while still referenced outside it) passpnpm checkuntouched and only surface when the test executed, during the #5642 work. This PR makes the specs type-checkable and wires the check intopnpm check, so that class of bug dies in CI.Note: there is no linked issue for this — it came out of a follow-up task spun off from the #5642 investigation.
The interesting part: typing browser-context imports
The specs import app modules inside
page.evaluatecallbacks through dev-server URLs (import("/src/stores/ui.store.ts")). tsc cannot resolve those — and because rooted (/-prefixed) specifiers are classified as relative, ambientdeclare moduleblocks can never match them either (tried first; silently ignored). The working pattern, applied at all 58 call sites:as stringwidens the specifier so tsc skips resolution — it's erased at transpile, so the browser receives the literal unchanged (the repo already had TS casts inside evaluate callbacks passing CI, proving Playwright transpiles the callbacks before serializing them). ThePage*Modulealiases live in a new globale2e/page-context-modules.d.tsand type-query the real client sources, so the specs type-check against the actual app APIs and drift surfaces as a type error instead of at runtime. The one.tsxpage import (GameSurface) keeps its existing structural cast rather than dragging the component tree into the program.What the lane immediately caught
~50 genuine strictness misses, all fixed: wrong element types on
evaluatecallbacks (textarea/input selection APIs onHTMLElement | SVGElement), unchecked indexed access across measurement arrays, and a missing four-bounds guard in the home-hub layout assertions (now a real assertion with a useful message). ThestoredSchedule()chains use!rather than?.deliberately, preserving the exact throw-on-missing poll semantics of the untyped code (expect.pollfails immediately on a throw but soft-times-out onundefined).Two client sources that the type queries pull into the root program were hardened one line each (
slash-commands.ts,locale-loader.ts) fornoUncheckedIndexedAccess, which the root project enables and the client project doesn't. A minimalImportMetainterface merge covers the vite-specificimport.meta.env/globthose sources use.Wiring
check:e2e-types=tsc --noEmit -p tsconfig.json, withtypescript@^5.9.3(matching the workspaces) as a root devDependency.pnpm checkbetween lint and build — verified build-independent (--traceResolutionshows every@marinara-engine/sharedimport resolving topackages/shared/src, neverdist), so it works on a fresh clone before anything is built.libbumped ES2022 → ES2023 to match the client project the type-queried sources normally compile under.Validation
check:e2e-typesexit 0; fullpnpm checkgreen.--retries=0./src↔packages/client/srccorrespondence exact, no behavior change in any "type-only" edit, and lockfile drift limited to the one devDependency. The same pass caught an encoding corruption in an intermediate version of this branch (PowerShell mojibake across the spec's non-ASCII literals) — the final commit was rebuilt byte-exactly via Node and the canary tests above prove it.pnpm checkon a fresh checkout of this branch; optionally re-add a bogusvoid someUndeclaredName;line toe2e/core-flows.e2e.tsand confirmpnpm check:e2e-typesrejects it.Summary by CodeRabbit
Bug Fixes
Tests
Chores
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.