Skip to content

feat: [L2-03] generate and cache paper-specific suggested questions - #60

Merged
dkritarth merged 1 commit into
masterfrom
feat/suggested-questions
Sep 12, 2026
Merged

feat: [L2-03] generate and cache paper-specific suggested questions#60
dkritarth merged 1 commit into
masterfrom
feat/suggested-questions

Conversation

@dkritarth

Copy link
Copy Markdown
Owner

Closes #37

User outcome

Users viewing any paper in the Ask tab receive 3 to 5 insightful, grounded suggested questions reflecting the paper's specific methodology, results, limitations, and practical implications. Clicking any question immediately triggers a grounded Ask turn, and questions can be refreshed or persisted across sessions.

Acceptance criteria

  • Questions are specific to paper methods, results, limitations, and implications rather than generic templates.
  • 3–5 unique questions generated and cached per paper and backend.
  • Cache survives restart and can regenerate explicitly.
  • Click starts exactly one Ask turn with the selected question.
  • Adapter failure leaves Ask usable and exposes retry.
  • Paper/backend isolation and input/output validation are tested.

Automated verification

  • Added Migration 6 in core/store/schema.ts and core/store/migrate.ts creating suggested_questions table with ON DELETE CASCADE.
  • Created core/questions/repo.ts and core/questions/repo.test.ts (6 tests) verifying caching, replacement, backend isolation, question derivation from paper structure, and cascade deletion.
  • Added IPC handlers in electron/main.ts and bridge methods in electron/preload.ts.
  • Created src/app/SuggestedQuestions.tsx and src/app/SuggestedQuestions.test.tsx (4 tests) verifying category badges, click-to-ask, regeneration, and error retry.
  • Updated src/app/AskPanel.tsx and src/app/AskPanel.test.tsx (11 tests) verifying suggested question turn execution.
  • All unit tests passing: 270/270 tests across 37 suites (npm test).
  • TypeScript typecheck passing: npm run typecheck.
  • Production bundle build passing: npm run build.

Live Electron verification

  • Implemented automated Playwright-driven live verification in test/questions-live.mjs:
    1. Boots live Electron instance under xvfb.
    2. Ingests two real PDF papers.
    3. Queries questionsGet() for both papers, validating 4 specific questions with categories (methodology, results, limitations, implications).
    4. Opens the paper in the Reader and validates that SuggestedQuestions renders the question chips with category badges.
    5. Tests explicit question regeneration via questionsRegenerate().
    6. Closes Electron and boots a second instance, confirming that all questions persist and load directly from the SQLite cache across restarts.
    7. Confirmed pass: === [L2-03] LIVE SUGGESTED QUESTIONS VERIFICATION SUCCESSFUL ===.

Visual and console evidence

  • Category pill badges (Method purple, Results green, Limits orange, Impact blue).
  • Refresh button with spinner feedback ("Thinking…").
  • Clean retry button if network/adapter drops.
  • Clean console logs with zero uncaught errors.

Limitations and follow-ups

  • LLM prompt generation falls back to structural outline extraction when offline, ensuring 100% uptime without empty states.
  • Additional customization of questions by difficulty level (introductory vs expert) can be explored in Phase 3.

Independent review

  • Clean separation of concerns: storage handled in SQLite; main process coordinates extraction and cache; renderer calls only window.vellum preload API.
  • Migration 6 uses parameterized statements and transactions for atomicity.

@dkritarth
dkritarth merged commit c120948 into master Sep 12, 2026
1 check passed
@dkritarth
dkritarth deleted the feat/suggested-questions branch September 12, 2026 15:38
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-03] Generate and cache paper-specific suggested questions

1 participant