Skip to content

Fix valuation metadata loss and stock list updater safety#3

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-investigation-abc7
Draft

Fix valuation metadata loss and stock list updater safety#3
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-investigation-abc7

Conversation

@cursor

@cursor cursor Bot commented Jun 17, 2026

Copy link
Copy Markdown

Bug and impact

  • The ticker overview and historical report endpoints rebuilt ReportData with an incomplete field list, dropping persisted valuation metadata. The new valuation snapshot UI would show N/A/hidden values even though the valuation report stored fair value, method summary, bridge, sensitivity, and assumptions.
  • The new Wikipedia stock-list updater accepted any non-empty parse, so a partial or wrong table parse could overwrite curated S&P 500 / NASDAQ-100 lists with a severely truncated universe.

Root cause

  • backend/routers/tickers.py duplicated partial ReportData(...) mappings instead of preserving the full ReportService report dictionary shape.
  • scripts/update_stock_lists.py treated non-empty fetched lists as valid without count or removal sanity checks.

Fix

  • Added a shared ticker report mapper that passes through valuation metadata fields for latest and historical ticker report responses.
  • Added stock-list safety validation for minimum counts and excessive removals, plus a --force override for deliberate large changes.
  • Deferred the updater's pandas requirement to fetch-time so safety helpers remain importable/testable.

Validation

  • PYTHONPATH=backend:. python3 -m unittest backend.tests.test_ticker_widgets_api scripts.test_update_stock_lists
Open in Web View Automation 

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