Commit graph

113 commits

Author SHA1 Message Date
587995a6bc fix(ci): fix ruff format in scholars router
Put each structured_log argument on its own line.
2026-03-07 15:56:40 +01:00
f3e94ec3f5 fix(test): add Pinia setup and admin user to AdminPdfQueueSection tests
The component uses useAuthStore() which requires an active Pinia
instance, and the "Queue all" button is admin-only (v-if="auth.isAdmin").
2026-03-07 15:51:49 +01:00
ef39ab6a41 fix(ci): fix import sorting, API contract, and pdf-queue test
- Add missing blank line after imports in application.py (ruff I001)
- Use full path string instead of template literal for export API call
  to avoid false positive in API contract drift check
- Update pdf-queue test to expect 200 for non-admin listing
2026-03-07 15:40:49 +01:00
7f78dd6353 feat(scholars): add multiselect and bulk actions (delete, toggle, export)
Add Set<number>-based selection state to ScholarsPage with checkboxes
in both table and card views, select-all toggle, and stale-key pruning.

Backend: POST /scholars/bulk-delete, POST /scholars/bulk-toggle, and
GET /scholars/export?ids= filter. Service functions use user-scoped
queries. Structured logging for bulk operations.

Frontend: useScholarBulkActions composable extracts selection and bulk
action logic. AppSelect-based action dropdown with dynamic options.
Delete prompts window.confirm; enable/disable applies immediately.
Export downloads filtered JSON.

Includes integration tests for all bulk endpoints and frontend unit
tests for selection toggle, select-all, and stale pruning.
2026-03-07 14:03:06 +01:00
6fa54db08f feat(settings): hours interval, pdf queue for all users, fix users tab loading
- Convert check interval setting from minutes to hours in the UI
- Show PDF queue tab to all authenticated users (not admin-only); requeue
  actions remain admin-only in both backend and frontend
- Fix users tab not loading on first visit by removing the AsyncStateGate
  wrapper that prevented child component refs from being populated before
  onMounted fired

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 13:53:20 +01:00
17727187fd feat(frontend): show run and cancel buttons to all users
Remove the auth.isAdmin guard from the Start check and Cancel check
buttons in the Activity Monitor. Admin-only route links (check history,
diagnostics) are unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 13:53:20 +01:00
JustinZeus
c6c89879c9
Merge pull request #47 from JustinZeus/feat/live-scholar-progress-counter
fix(ingestion,frontend): show live counter immediately on run start
2026-03-03 18:38:36 +01:00
2c591a0ca3 fix(ingestion,frontend): show live counter immediately on run start
Two issues with the initial implementation:
- Counter only appeared after the first SSE event arrived (scholarProgress null
  kept the v-else static template showing until a scholar completed)
- First events were often dropped because the EventSource hadn't subscribed yet

Fix:
- Backend: emit an initial scholar_progress kickoff event (0/0/N) at the
  start of run_scholar_iteration so the frontend receives total early
- Frontend: gate on isLikelyRunning alone (not scholarProgress); use optional
  chaining with fallbacks so "0 / … visited · 0 finished" shows immediately
  when a run starts, before any SSE events arrive

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 18:37:53 +01:00
JustinZeus
5754bffaa0
Merge pull request #46 from JustinZeus/feat/live-scholar-progress-counter
feat(ingestion,frontend): add live scholar progress counter to dashboard
2026-03-03 17:52:46 +01:00
4620978dce feat(ingestion,frontend): add live scholar progress counter to dashboard
Emit scholar_progress SSE events during two-pass ingestion so the
Activity Monitor shows "X / N visited · Y finished · Z new publications"
in real time instead of static post-run counts.

- scholar_processing: add on_progress callback to _run_first_pass and
  _run_depth_pass; build _emit closure in run_scholar_iteration that
  publishes visited/finished/total via run_events; batch-emit scholars
  finished in first pass before depth pass; skip emission on abort/cancel
- run_status store: add scholarProgress state, reset on stream open and
  reset(); subscribe to scholar_progress SSE events with safe parsing
- DashboardPage: show live counter during run, fall back to static text
  when run is not active or no progress received yet

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 17:36:43 +01:00
JustinZeus
cfb1033110
Merge pull request #45 from JustinZeus/bugfix/broken-import
openalex cooldown
2026-03-03 16:17:39 +01:00
f50b609a36 fix(db,frontend): reserve DB connections for API and reduce frontend polling
Background tasks (ingestion, PDF resolution, scheduler) now acquire an
asyncio.Semaphore before checking out a DB connection, guaranteeing at
least N connections remain available for API request handlers. Removes
duplicate polling loop from PublicationsPage, debounces publication
reload on run-status changes, and increases poll interval from 5s to 15s
since SSE handles live discovery.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 19:09:06 +01:00
a490e14126 openalex cooldown 2026-03-02 18:01:42 +01:00
JustinZeus
8ba3b3d41a
Merge pull request #44 from JustinZeus/bugfix/broken-import
added test for new publication detection
2026-03-02 13:59:07 +01:00
4c82fe4b8e added test for new publication detection 2026-03-02 13:58:50 +01:00
JustinZeus
92ad054b97
Merge pull request #43 from JustinZeus/bugfix/broken-import
fix: resolve mypy errors, fix arxiv test session isolation, and add p…
2026-03-02 12:46:35 +01:00
87aa89b58c fix: resolve mypy errors, fix arxiv test session isolation, and add premerge script
- Remove unused type:ignore comment in scholars.py
- Fix 51 mypy errors across test files (Any return types, cast(), protocol stubs)
- Fix arxiv unit test failures caused by session isolation (patch_session_factory fixture)
- Fix integration test rate-limit bleed between search and create
- Add scripts/premerge.sh for local CI verification
- Add docs/website/.docusaurus/ to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 12:46:10 +01:00
JustinZeus
acf23a7d6c
Merge pull request #42 from JustinZeus/bugfix/broken-import
fixed import
2026-03-02 00:03:55 +01:00
49cf7034b2 2026-03-02 00:03:27 +01:00
JustinZeus
4d949e8657
Merge pull request #41 from JustinZeus/openalex-size-reduction-scholar-hydration
fix: URL-length-aware OpenAlex batching and eager scholar metadata hy…
2026-03-01 23:44:12 +01:00
d9be57a6c1 fix: URL-length-aware OpenAlex batching and eager scholar metadata hydration
- Replace fixed batch_size=25 with URL-byte-length-aware chunking for
  OpenAlex title.search queries. Long/Unicode titles caused URLs to
  exceed server limits, resulting in 500 errors.
- Always hydrate scholar profile metadata (name, image) on creation,
  even when an initial scrape job is queued, so the UI shows profile
  info immediately.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 23:42:15 +01:00
JustinZeus
e2fe34946c
Merge pull request #40 from JustinZeus/mypi-fix
fix: align test assertion with rollback behavior
2026-03-01 23:18:05 +01:00
e4e9b94cfe fix: align test assertion with rollback behavior
The upsert rolls back the entire transaction on partial failure,
so new_pub_count and link count should be consistent (both 0),
not assuming the first publication survived.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 23:16:07 +01:00
JustinZeus
76469e2d1e
Merge pull request #39 from JustinZeus/mypi-fix
" "
2026-03-01 23:12:26 +01:00
83e0407491 " " 2026-03-01 23:11:52 +01:00
JustinZeus
9401aa9b69
Merge pull request #38 from JustinZeus/mypi-fix
db tets fix
2026-03-01 23:08:15 +01:00
c7d170a202 db tets fix 2026-03-01 23:07:49 +01:00
JustinZeus
6e17a65b2f
Merge pull request #37 from JustinZeus/mypi-fix
Mypi fix
2026-03-01 23:04:55 +01:00
6fe4814442 " " 2026-03-01 23:04:23 +01:00
0ee89136ff fix: handle optional cookie field for mypy type check
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 23:04:02 +01:00
JustinZeus
84faaad5eb
Merge pull request #36 from JustinZeus/ci-fixes
Ci fixes
2026-03-01 23:02:03 +01:00
f649c07e10 ci fixed 2026-03-01 23:01:06 +01:00
79f3e41471 fix: resolve CI lint and docs build failures
Apply ruff formatting to 3 files and add missing package-lock.json for docs/website.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 23:00:31 +01:00
JustinZeus
33f9579169
Merge pull request #19 from JustinZeus/feat/decomposition
Feat/decomposition
2026-03-01 22:55:32 +01:00
4403c9ebde Bugfixeds 2026-03-01 22:54:23 +01:00
a5165dc3ba after audit 2026-03-01 18:14:22 +01:00
e8e20637e6 Better crawling safety with preflight checks and cooldowns 2026-02-27 16:44:54 +01:00
839593e1b3 2026-02-27 16:25:51 +01:00
c0e66c509f style: fix ruff lint and format issues across service modules
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:24:36 +01:00
72bc046215 refactor: extract helpers from remaining long functions
- Extract _start_manual_run and _spawn_background_execution from run_manual route
- Extract _upsert_page_publications to deduplicate pagination loop
- Extract _classify_attempt from fetch_and_parse_with_retry
- Extract _log_alert_threshold_warnings from complete_run_for_user
- Functions 3f-3j accepted as kwargs-exception (body ≤50 lines excluding signatures)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:21:49 +01:00
2a6e573a52 refactor: extract helpers from long functions in ingestion core
- Extract _load_unenriched_publications, _enrich_batch, _flush_and_sweep_duplicates from enrich_pending_publications
- Extract _sanitize_titles shared helper for title cleaning
- Extract _run_iteration_and_complete and _inline_enrich_and_finalize from run_for_user
- Extract _run_first_pass and _run_depth_pass from run_scholar_iteration
- Extract _finalize_successful_queue_job and _finalize_failed_queue_job from _finalize_queue_job_after_run

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:18:21 +01:00
3fd9132176 refactor: fix naming, remove duplicate code from decomposition
- Rename _int_or_default → int_or_default (public API, was using private convention)
- Extract shared pdf_queue utilities (utcnow, event_row, queued_job, status constants) to pdf_queue_common.py to avoid circular imports
- Consolidate _effective_request_delay_seconds into queue_runner.py with explicit floor parameter
- Update tests to match new function locations and names

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 16:07:24 +01:00
74249fa24c fix: resolve all mypy type errors across service modules
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 15:49:27 +01:00
f11947aad2 refactor: extract helpers from oversized router and scheduler files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 15:41:23 +01:00
55315299c7 commit 2026-02-27 15:22:12 +01:00
b701583716 refactor: decompose scholars service and pdf_queue into focused modules
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 14:39:12 +01:00
8c6069c121 Decomp plan adjustment 2026-02-27 14:26:29 +01:00
6379c97e90 decompose application.py into enrichment, scholar processing, run completion 2026-02-27 14:19:39 +01:00
9a7fa5004e refactor: extract pagination engine and publication upsert from ingestion service
Split app/services/ingestion/application.py (2,955 lines) into three
focused modules:

- page_fetch.py (219 lines): PageFetcher class for single-page fetch,
  parse-or-layout-error handling, and retry with backoff
- pagination.py (486 lines): PaginationEngine class for multi-page
  orchestration, loop state management, and short-circuit detection
- publication_upsert.py (239 lines): module-level functions for
  resolve_publication, upsert_profile_publications, and all
  find/create/update helpers

Also fixes two external import paths in portability/ that incorrectly
sourced normalize_title and build_publication_url from application.py
instead of fingerprints.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 13:47:23 +01:00
4741a2da50 updated uv 2026-02-27 11:41:19 +01:00