- SecLintAdapter implements SourceFetch, runs via shared queue/drain loop - Two new SourceKinds: sec-lint-holders, sec-lint-insiders (weekly schedules) - No-op cache handlers so drain->cache.set doesn't throw on lint keys - tRPC admin.queueLint(symbol, kind) — run lint for one symbol, returns LintResult - tRPC admin.queueLintAll(kind) — backfill ALL watched symbols at once - tRPC admin.dataQualityList() — query data_quality rows (filterable by symbol/kind) - InstitutionalDashboard: 'Lint holders' button + status badge in detail panel header - Admin queue page: Data Quality section with per-row status badges, 'Lint all' buttons - DEFAULT_RATE_MS includes 167ms (~6 req/s) for lint kinds matching EDGAR limiter
1.9 KiB
1.9 KiB
SPEC.md — queue-overhaul
Parent: investor-flow backend (AdapterQueue + SEC EDGAR fetching) Module: Backend queue orchestration & data reliability
Requirements
Overhaul the shared AdapterQueue (app/server/src/queue/AdapterQueue.ts) and the
admin queue tooling so SEC data (13F + Form 4) is fetched reliably and operable:
Queue control & observability
- Pause / resume, persisted across restarts in a new
queue_statetable. - Full error capture: every failed / backoff attempt appends to a new
queue_errorstable (attempt #, message, fullerror.stack); admin UI expands a failed job to stream the stack trace for troubleshooting. - Retry controls:
retryJob(key),retrySource(kind),clearDone(olderThanMs).
Scheduling (auto + manual)
queue_schedulestable with per-sourceinterval_ms; a 30s loop callsenqueueDueSchedules()to enqueue refreshes for all in-demand symbols when due.- Seed defaults:
sec-fetch24h,yfinance5min. Admin UI lists / adds / deletes schedules.
Reliability
- Startup recovery: jobs left
in_flightat shutdown reset topendingon boot. - Schema migration:
queue_errors,queue_schedules,queue_statetables pluserror/scheduled_forcolumns onadapter_queue(idempotent ALTER on startup).
Critical EDGAR bug fix
form4_txandform13f_holdingsbuild the archive URL from the filer CIK (the accession-number prefix), not the company CIK — resolves Cloudflare 429 that left SEC backfills sparse / empty.
Acceptance
node --testbackend suite passes (503 tests).- Full sec-fetch backfill succeeds for all watched symbols (NVDA 14,675 institution filings, CIFR 274 insider txns, TSLA 6,011, etc.).
- Admin queue page: pause/resume, failed-job stack traces, schedule management.
B1-B4 Completion Note (Jul 12 2026)
Completed lint+backfill system implementation. All acceptance criteria met, typecheck passes on changed files.