fix(sec): A3 slice-2b review — no index cap, full discrepancy + malformed gate
1. Removed the 45-day index-walk cap: it discarded the older part of a long outage while still advancing source_max_date, permanently losing filings. The walk now covers every unprocessed date (a large gap is one-time cost). 2. Discrepancy detection meets the immutability contract: it compares ALL source snapshot fields (not five), read-only during stage/validate, reports the differing accessions + fields in validation_json, and promote emits a warning system event (in-transaction) — never mutating the stored row. 3. Malformed companyfacts (missing facts/units structure) are recorded separately and FAIL validation, instead of silently degrading to skipped rows that the 50% backfill coverage floor could still pass. Also corrected the stale "sum share classes" / DEI-only wording in the snapshot model docstring and the A3 design doc to describe the us-gaap fallback. Tests: +4 regressions (>45-day gap loses nothing, newly-added issuer backfills without filing, malformed payload fails, shares discrepancy detected + evented). 23 passed, 1 skipped. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -20,11 +20,13 @@ class FundamentalSnapshot(Base):
|
||||
capex, depreciation_amortization) hold the filing's normalized **cumulative
|
||||
YTD/FY** value over (period_start -> period_end). Balance-sheet facts
|
||||
(cash_and_st_investments, total_debt, shares_outstanding) are **period-end**
|
||||
values. ``shares_outstanding`` is a point-in-time count
|
||||
(``dei:EntityCommonStockSharesOutstanding``, summed across share classes for
|
||||
a multi-class issuer) — deliberately not the weighted-average diluted share
|
||||
count, since both consumers (estimated market cap, YoY dilution read) want a
|
||||
point-in-time value. Discrete quarters (10-Q YTD deltas, Q4 = FY - Q1..Q3), TTM, YoY and
|
||||
values. ``shares_outstanding`` is a single consolidated point-in-time count —
|
||||
the ``dei:EntityCommonStockSharesOutstanding`` cover-page fact, or
|
||||
``us-gaap:CommonStockSharesOutstanding`` at period end when no dei fact exists
|
||||
(e.g. Alphabet). It is never a class sum (companyfacts is non-dimensional) nor
|
||||
the weighted-average diluted count, since both consumers (estimated market cap,
|
||||
YoY dilution read) want a point-in-time value. Discrete quarters (10-Q YTD
|
||||
deltas, Q4 = FY - Q1..Q3), TTM, YoY and
|
||||
the quarter tape are all derived at read time — so non-calendar fiscal years
|
||||
resolve correctly and a later amendment never leaves a stale frozen quarter.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user