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:
@@ -101,8 +101,12 @@ One `fundamental_snapshots` row per accession, representing the filing's
|
||||
Q3≈9mo, FY≈12mo). **If the YTD fact is absent, store null — never a discrete
|
||||
masquerading as cumulative** (that would poison read-time differencing).
|
||||
- **Balance-sheet instants → at `end == reportDate`.** `shares_outstanding` is
|
||||
the exception: take `dei:EntityCommonStockSharesOutstanding` for that accession
|
||||
and store *its own* `end` in `shares_outstanding_date` (cover date ≠ period_end).
|
||||
the exception: prefer the `dei:EntityCommonStockSharesOutstanding` cover-page
|
||||
fact and store *its own* `end` in `shares_outstanding_date` (cover date ≠
|
||||
period_end); when there is no dei fact (e.g. Alphabet) fall back to
|
||||
`us-gaap:CommonStockSharesOutstanding` at `reportDate`. A single consolidated
|
||||
value — never a class sum (companyfacts is non-dimensional) nor
|
||||
weighted-average/diluted; conflicting values → null.
|
||||
- **Amendments:** a real `10-K/A` / `10-Q/A` is a new accession → a new immutable
|
||||
row for the same `(cik, fy, fp)`; readers pick the newest valid `accepted_at`.
|
||||
- **Out of scope (stated, not silent):** restatements that appear *only* as
|
||||
|
||||
Reference in New Issue
Block a user