Skip to content

fix(ci): clear pre-existing ruff + tsc failures on main#11

Merged
vikranthreddimasu merged 1 commit into
mainfrom
fix/ci-lint-cleanup
Apr 17, 2026
Merged

fix(ci): clear pre-existing ruff + tsc failures on main#11
vikranthreddimasu merged 1 commit into
mainfrom
fix/ci-lint-cleanup

Conversation

@vikranthreddimasu

Copy link
Copy Markdown
Owner

Summary

CI has been red on main since the research trust layer landed in #8 — every PR since has inherited the failure. Both the backend and desktop jobs fail with 6 lint errors each. This PR resolves all 12.

Backend (ruff)

File Rule Fix
models/chat.py:17 E501 Wrap Field() description to fit 120 cols
routes/chat.py:49 F841 Drop unused persist_warning flag
services/conversation_store.py:8 F401 Drop unused dataclasses.field import
services/conversation_store.py:9 F401 Drop unused pathlib.Path import
tests/test_conversation_store.py:146 F841 Drop unused c2 binding; the assertion only reads convs[0].title
tests/test_cross_notebook.py:5 F401 Drop unused VectorStoreManager import

Desktop (tsc)

File Rule Fix
types.ts Extend StreamSource and SourceChunk with relevance_score? + notebook_id? — fields the backend already sends. Eliminates the need for unsafe casts at read sites.
hooks/useChat.ts:50 TS2352 Read src.relevance_score directly (was (src as Record<string, unknown>).relevance_score)
components/layout/SourcePanel.tsx:30 TS2352 Read source.notebook_id directly
DocumentPreview.tsx:61 TS2345 Use 'str' in item to narrow pdfjs TextItem | TextMarkedContent union instead of an ad-hoc structural annotation
components/ui/SetupWizard.tsx:2 TS6133 Drop unused fetchConfig import
components/ui/SetupWizard.tsx:37 TS6133 Drop dead uploadedFilename state — only the setter was ever called
components/ui/ZoteroImport.tsx:2 TS6133 Drop unused useAppStore import

Verification

  • cd backend && uv run ruff check .All checks passed!
  • cd apps/desktop && npm run build → clean (✓ built in 872ms, no tsc errors)

Why the type extensions matter

The two as Record<string, unknown> casts in useChat and SourcePanel existed because the TS types for StreamSource / SourceChunk hadn't caught up with the backend. The backend has been shipping relevance_score and notebook_id for a while — extending the interfaces is both the real fix and makes downstream code type-safe.

🤖 Generated with Claude Code

CI has been red on main since the research trust layer merge (#8). None of
these issues were caught before merge, and every PR since has inherited the
failure. This commit resolves both jobs.

Backend (ruff):
- chat.py model: wrap Field() description so the line fits in 120 cols.
- chat stream route: drop the unused persist_warning flag.
- conversation_store: drop unused `field` and `Path` imports.
- conversation store + cross-notebook tests: drop unused locals / imports
  (c2 binding, VectorStoreManager import). Kept the ordering assertion by
  calling create_conversation without binding the returned value.

Desktop (tsc):
- types.ts: extend StreamSource and SourceChunk with the fields the backend
  actually returns (relevance_score, notebook_id). This removes the need for
  unsafe `as Record<string, unknown>` casts at read sites.
- useChat / SourcePanel: read the typed fields directly now that the shape
  is honest.
- DocumentPreview: use a proper `'str' in item` narrow for the pdfjs
  TextItem | TextMarkedContent union instead of an ad-hoc structural type.
- SetupWizard: drop the unused fetchConfig import and the dead
  uploadedFilename state (only the setter was ever called).
- ZoteroImport: drop the unused useAppStore import.

Verified locally: `uv run ruff check .` clean; `npm run build` clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vikranthreddimasu vikranthreddimasu merged commit 0fa97c1 into main Apr 17, 2026
2 checks passed
@vikranthreddimasu vikranthreddimasu deleted the fix/ci-lint-cleanup branch April 17, 2026 22:31
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