fix(desktop): stop the e2e project reaching into renderer src - #341
Merged
Conversation
`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>
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.
maindoes not typecheck. #337 asserted the context meter's tool-free round byformatting the expected figure with the status bar's own
compactNumber, whichmeant importing
src/lib/formatfrom a spec:tsconfig.e2e.jsoncarries"exclude": ["src", "electron"]. That is thedesign, 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-numberformatter and says not to hand-roll
/ 1000display math elsewhere, which isexactly 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 readinground-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 typecheckfails onmainat this commit's parent and passes here,which is the whole of the change.