Repository navigation
Drop write-only values and the casts that hid types - #364
Merged
Merged
Conversation
Delete values nothing reads: canvas store fitToSpread, requestedTokens, the considered/readFailures action result fields, and the umapIndex store return. Derive the chat and run status types from Prisma and remove the casts onto them. Declare processEmbeddingRun's result type so the route can drop its cast; the inferred union hid umapProjection. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Nov 28, 2026
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.
This removes values that nothing reads, and the casts that kept the type checker from checking six status and role fields and one action result. Nothing changes on screen.
User impact: None.
Why
A srcly measurement on
d59937fefound dead values and casts onto copied types. Each delete or cast removal:fitToSpreadfrom the canvas store.fitToSpreadaccess on base. The 4 hits left are the route's own function inroutes/canvas.tsxrequestedTokensconsideredfrom the path-round and image-scan results, andreadFailuresfrom the image-scan resultapp/src,app/scriptsorapp/tests. The one UI caller readsupdated,failedandmatches. Both values stay in the server logsumapIndexfrom the positions store returnChatThreadStatus,ChatMessageRole,RunStatus$Enumstype, so the 6 casts are gone and a schema change reaches the query typesProcessEmbeddingResultcast on the embedding run pageprocessEmbeddingRunnow declares its result typeOne finding was wrong. The measurement said the server never sets
umapProjection, so the page's "Auto-projected" line was dead. It does set it, on both returns that embed notes. The inferred return type had lost the field, and the cast hid that. This PR keeps the line and fixes the type.Proof
Matching lines in
app/src(git grep -P):ProcessEmbeddingResult(local type and casts)as ChatThreadStatus|ChatMessageRole|RunStatusfitToSpreadrequestedTokensreadFailures?:umapIndex,in the store returnRemoving only the cast, with no declared type, fails the type check. This is the hidden mismatch:
A temporary test, not committed, ran
processEmbeddingRunwith one trained UMAP run and mocked database and embedding calls:Checks:
pnpm type-checkandpnpm lintpass.pnpm test: 924 passed, 86 skipped.--workers 1(route-hydration-smoke, which loads/canvas,/embeddingsand/ai;canvas-note-panel;no-page-flashandnote-safety-gaps, which open chat;homepage): 29 of 31 pass.canvas-note-panel: "unsaved edits ask before the panel closes" and "a save in flight blocks closing until it finishes". Both also fail withorigin/main'sapp/srcon the same server.Limits
routes/embeddings/[id].tsx. To resolve it, delete the whole conflicted block and the};after it. A trial merge resolved that way passes the type check and lint. Use one DocDetail type and stop casting fetch* query results #361 merges cleanly.🤖 Generated with Claude Code