Skip to content

fix(desktop): stop the e2e project reaching into renderer src - #341

Merged
OmarB97 merged 1 commit into
mainfrom
fix/e2e-typecheck-src-import-fork-2026-08-02
Aug 2, 2026
Merged

fix(desktop): stop the e2e project reaching into renderer src#341
OmarB97 merged 1 commit into
mainfrom
fix/e2e-typecheck-src-import-fork-2026-08-02

Conversation

@OmarB97

@OmarB97 OmarB97 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

main does not typecheck. #337 asserted the context meter's tool-free round by
formatting the expected figure with the status bar's own compactNumber, which
meant importing src/lib/format from a spec:

e2e/context-meter-spawn.spec.ts(30,31): error TS6307: File 'apps/desktop/
src/lib/format.ts' is not listed within the file list of project
'apps/desktop/tsconfig.e2e.json'.

tsconfig.e2e.json carries "exclude": ["src", "electron"]. That is the
design, not an oversight — the e2e project is deliberately a separate island
from renderer source, and the two compile under different lib/DOM assumptions.
Adding the file to that project's include would fight the boundary to buy one
test a prettier assertion.

Re-implementing the formatter in the spec is the other obvious move and is
worse: compactNumber's own docstring calls itself THE compact-number
formatter and says not to hand-roll / 1000 display math elsewhere, which is
exactly what a copy in a test would be.

So the assertion compares numbers instead of labels — against the count the
mock actually served, never a literal, since the usage schedule is a function
of conversation length. The gauge renders one decimal in k, so a reading
round-trips to within half a step of the real figure; ±100 tokens covers that,
and the rounds are 3k apart, so the slack cannot let a neighbouring round pass
for the one under test.

npm run typecheck fails on main at this commit's parent and passes here,
which is the whole of the change.

`main` does not typecheck. #337 asserted the context meter's tool-free round by
formatting the expected figure with the status bar's own `compactNumber`, which
meant importing `src/lib/format` from a spec:

    e2e/context-meter-spawn.spec.ts(30,31): error TS6307: File 'apps/desktop/
    src/lib/format.ts' is not listed within the file list of project
    'apps/desktop/tsconfig.e2e.json'.

`tsconfig.e2e.json` carries `"exclude": ["src", "electron"]`. That is the
design, not an oversight — the e2e project is deliberately a separate island
from renderer source, and the two compile under different lib/DOM assumptions.
Adding the file to that project's include would fight the boundary to buy one
test a prettier assertion.

Re-implementing the formatter in the spec is the other obvious move and is
worse: `compactNumber`'s own docstring calls itself THE compact-number
formatter and says not to hand-roll `/ 1000` display math elsewhere, which is
exactly what a copy in a test would be.

So the assertion compares numbers instead of labels — against the count the
mock actually served, never a literal, since the usage schedule is a function
of conversation length. The gauge renders one decimal in `k`, so a reading
round-trips to within half a step of the real figure; ±100 tokens covers that,
and the rounds are 3k apart, so the slack cannot let a neighbouring round pass
for the one under test.

`npm run typecheck` fails on `main` at this commit's parent and passes here,
which is the whole of the change.

Co-authored-by: Omar Baradei <omar@kostudios.io>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@OmarB97
OmarB97 merged commit 6f35f58 into main Aug 2, 2026
28 checks passed
@OmarB97
OmarB97 deleted the fix/e2e-typecheck-src-import-fork-2026-08-02 branch August 2, 2026 19:37
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