Skip to content

feat: [L2-01] build hierarchical collections and Library filtering - #58

Merged
dkritarth merged 1 commit into
masterfrom
feat/collections-and-library-filtering
Sep 12, 2026
Merged

dkritarth merged 1 commit into
masterfrom
feat/collections-and-library-filtering

Conversation

@dkritarth

Copy link
Copy Markdown
Owner

Closes #35

User outcome

Users can organize papers into nested local collections in the sidebar folder tree, filter their library by selecting a collection, see live paper count badges, and clear filters without duplicating paper files on disk.

Acceptance criteria

  • Create, rename, nest, select, and delete collection with validated names.
  • Assign/remove paper without duplicate relation (ON CONFLICT DO NOTHING).
  • Library filter and counts update immediately with active collection banner.
  • Restart preserves tree, assignments, and active-state policy in SQLite.
  • Paper remains single filesystem copy (cascade delete removes collection mapping without touching papers table or disk files).
  • Cycles, missing parents, and unsafe self-parenting are rejected.
  • Empty and error states are usable.
  • Migration/backward compatibility and cascade behavior are tested.

Automated verification

  • Added core/collections/repo.test.ts (6 tests) covering CRUD, cycle detection, re-parenting, idempotent paper assignment, recursive deletion, and tree building with paper counts.
  • Added collection filtering test to core/library/repo.test.ts.
  • Added unit tests for CollectionsTree in src/app/CollectionsTree.test.tsx (5 tests).
  • Added collection filter banner and collection tag test in src/app/Library.test.tsx.
  • Updated src/app/Sidebar.test.tsx to verify active CollectionsTree rendering in Files view.
  • Full test suite passes (34 files, 247 tests): npm test.
  • TypeScript typecheck passes: npm run typecheck.
  • Production bundle build passes: npm run build.

Live Electron verification

  • Implemented automated Playwright-driven live Electron verification in test/collections-live.mjs:
    1. Boots live Electron instance under xvfb.
    2. Confirms preload bridge window.vellum.ping() -> pong.
    3. Ingests two sample PDF papers (sample.pdf, sample2.pdf).
    4. Creates hierarchical collections ("Computer Science" root, "NLP" child).
    5. Assigns papers to collections.
    6. Verifies collections tree and paper counts via bridge.
    7. Navigates to Library, selects "NLP" collection, verifies filter banner and single-paper view.
    8. Clears filter and verifies restored all-papers view.
    9. Renames collection to "Natural Language Processing".
    10. Re-launches second Electron instance to verify full SQLite persistence of collections and assignments across restarts.
    11. Executed and confirmed pass: === [L2-01] LIVE COLLECTIONS VERIFICATION SUCCESSFUL ===.

Visual and console evidence

  • Sidebar Files tab renders hierarchical tree with folder icons, collection names, paper count pills, and hover actions (+, edit, delete).
  • Library view displays active filter banner when collection is selected: Filtered by collection: <name> with a working Clear filter action.
  • Individual paper cards display collection tags matching their assigned collections.
  • Zero uncaught errors or console warnings during live test execution.

Limitations and follow-ups

  • Drag-and-drop of paper cards directly into sidebar collection folders can be added in a future polish iteration.
  • Multi-selection of papers for bulk assignment will follow in Phase 3.

Independent review

  • Code conforms strictly to AGENTS.md: zero renderer fs/node imports, all collection operations flow through typed window.vellum preload bridge and ipcRenderer.invoke.
  • Safe SQL execution via parameterized statements; sort and filter injection prevented.

@dkritarth
dkritarth merged commit e00b05b into master Sep 12, 2026
1 check passed
@dkritarth
dkritarth deleted the feat/collections-and-library-filtering branch September 12, 2026 15:28
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.

[L2-01] Build hierarchical collections and Library filtering

1 participant