Skip to content

Fix the data-flow hits: declared embedding result, unused fields, Prisma enums - #365

Closed
byronwall wants to merge 1 commit into
claude/cleanup-batch-2-5e0a9afrom
claude/dataflow-fixes
Closed

byronwall wants to merge 1 commit into
claude/cleanup-batch-2-5e0a9afrom
claude/dataflow-fixes

Conversation

@byronwall

@byronwall byronwall commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

This PR fixes the hits from a data-flow measurement of Visual Notes: one cast that patched a lost field, three unused values, two unread response fields, and three hand-copied enum types.

User impact: None. The embeddings page still shows the UMAP projection summary after "Process more" and "Process changed".

What changed

  • processEmbeddingRun declares its return type. The function returns umapProjection on its main path, but not on its early returns. TypeScript's inferred union dropped the optional field, so routes/embeddings/[id].tsx cast the result to a local ProcessEmbeddingResult to get it back. ProcessEmbeddingResult and UmapProjectionSummary are now exported from embeddings.server.ts. The route's copy and both casts are gone.
  • fitToSpread removed from canvas.store.ts. Nothing called it: routes/canvas.tsx has its own fitToSpread, which animates through animateToView.
  • requestedTokens removed from getContextLimitExceeded in embeddings.utils.ts. It was declared and written, never read.
  • considered and readFailures removed from the responses of processPathRound and scanRelativeImages, and from ScanRelativeImagesResult. The docs index reads only updated, failed and matches. The counters and their log lines stay.
  • ChatThreadStatus, ChatMessageRole and RunStatus come from the Prisma enums. They were hand-copied string unions in ai-chat.queries.ts and ai-runs.queries.ts. The query modules now re-export the Prisma types, so every importer is unchanged, and the six casts that hid the copies are gone.

Proof

The cast scan that found these hits (casts.mjs from planning TASK-0017), run at d59937fe and on this branch:

d59937fe this branch
casts onto a same-name type declared elsewhere 16 6
) as Promise<…> casts 12 0
incompatible casts in routes/embeddings/[id].tsx 1 0

The 6 that remain are the known non-copies: anonymous object types in CleanupDetail.tsx and pathways/layout.ts, and library ReadableStreams. #361 and #362 remove the other as Promise casts.

Nothing references the removed names any more:

$ git grep -c "\bfitToSpread\b" -- app/src
app/src/routes/canvas.tsx:4        # the route's own function
$ git grep -c "\brequestedTokens\b" -- app/src
(none)
$ git grep -c "\breadFailures\b" -- app/src
app/src/features/docs-index/data/docs.actions.scan-relative-images.ts:8   # the counter and its log lines

Checks on this branch: pnpm type-check passed, pnpm lint passed (exit 0, warnings only, all from before), and pnpm test passed (924 passed, 86 skipped).

E2E against an isolated audit DB ran route-hydration-smoke, homepage and canvas-note-panel. 20 passed and 4 were skipped. /canvas, /embeddings, /ai and /umap all hydrate without errors. 2 tests failed in the parallel run: /docs/new hydrates and recent list follows edits. This PR does not touch either page. Both passed 4 of 4 with --workers 1 --repeat-each 2, on this branch and on #362's branch.

Limits

  • No test drives "Process more" against a real OpenAI key, so the projection summary is checked by types, not end to end. The returned object itself did not change.
  • scanRelativeImages and processPathRound still return other fields the client does not read (ok, total, init, extend). They were not in the measured set.

Stack: cleanup batches, layer 3 of 3

This slice: the fixes from the data-flow measurement (planning TASK-0017 W8.5).
Why it is its own layer: It edits routes/embeddings/[id].tsx and the AI query modules after #362's changes there, so it stacks on #362 instead of conflicting with it.
Full story: #361

🤖 Generated with Claude Code

…esponse fields, Prisma enums

- processEmbeddingRun declares its return type. The inferred union dropped
  umapProjection, and the route cast its result to a local copy to get it back.
- Drop canvas.store fitToSpread (the canvas route has its own), the unread
  requestedTokens, and the considered/readFailures response fields.
- ChatThreadStatus, ChatMessageRole and RunStatus come from the Prisma enums
  instead of hand-copied unions, so the six casts that hid the copies go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@byronwall
byronwall added this pull request to stack #363 November 28, 2026 05:45
@byronwall byronwall changed the title Fix the data-flow hits: declared embedding result, unused store and response fields, Prisma enums Fix the data-flow hits: declared embedding result, unused fields, Prisma enums Nov 28, 2026
@byronwall

Copy link
Copy Markdown
Owner Author

Closing as a duplicate of #364, which made the same fixes and is already merged to main.

@byronwall byronwall closed this Nov 28, 2026
@byronwall
byronwall removed this pull request from stack #363 November 28, 2026 05:46
@byronwall
byronwall deleted the claude/dataflow-fixes branch November 28, 2026 05:47
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