Spaces:
Sleeping
Sleeping
Commit History
-
feat: The Brief renders as the published research note
The Brief was a stack of ~20 cards. It is now one document, reproduced from the note published on 2026-09-02: masthead, ten sections in a fixed order, sticky contents bar, sticky data rail, sourced footer. Same palette, same typography, same placements. The reproduction is asserted, not asserted-to-be. tests/test_note_fidelity.py compares against tests/fixtures/published_note.html and passes only if the stylesheet matches declaration for declaration (117 rules, no additions) and each of the three figures is byte-identical -- coordinates, order, attributes. Two encodings are allowed to differ and both are pinned by that test: the .rt-note selector prefix, and xmlns on every <svg>. The palette is the app's now, not the document's. Every hardcoded colour across 19 modules -- 330 of them -- was remapped onto the note's thirteen tokens, config.toml was repointed, and Inter gave way to the note's three families. A light document inside a dark shell would have been two designs. What the fi…93f9cc0
-
docs: how to publish to each remote, and a script for the awkward one
The two remotes have opposite rules and neither is a plain push, so the procedure was living only in one session's head. GitHub is source-only and its history is unrelated by SHA -- it was seeded from a git-filter-repo export, so the same work carries different hashes on each side. A plain push is rejected and forcing one would destroy 260+ commits. scripts/sync_github.py replays every non-data commit onto the mirror's own history through a temporary index, so the working tree is never touched, and refuses to push if a data/ file reached the tree or the result is not a fast-forward. Documenting that as prose would have invited someone to re-derive it and reach for --force. Hugging Face is the opposite case: it is PUBLIC, it deploys the live app, and it NEEDS data/ because it serves the corpus and cannot rebuild it. Its slug still reads amplegest, a real Paris asset manager, which is why deploying under it is a decision to raise rather than a step to take quietly. Also corrected two …c3e56a1
-
fix: re-extract the stored period set, not EDGAR's newest window
fetch_all_edgar_data returns the most recent N filings as of today, and that window has slid forward since these rows were ingested. Asking for 12 quarters months later returns a set shifted past the oldest stored rows -- which are the legacy rows needing repair -- so AMD's oldest stored 10-Q would never have been re-extracted and criterion 1 would have failed silently. The window is now wider than any plausible drift, and the surplus is discarded: only periods already in the table are upserted, because adding periods is ingest.py's job and growing the table mid-run would change what the acceptance report measures. Both mismatches are reported -- stored periods the run did not reach, and newer filings it deliberately skipped. A test now also reads all ten new columns back through the upsert. That splat is where every task in this plan meets, and stripping it left the whole suite green.baebccc -
feat: the acceptance criteria as a runnable report
Eight criteria, each a query against the shipped databases, so the run's outcome is checked rather than asserted and stays re-checkable after every future ingest. Three of them permit a shortfall provided it is enumerated, so each prints the exact ticker, period and concept. A filer that does not tag a concept is a fact about the filer; a quietly lower number is not a result.2f5da7d -
feat: re-extraction mode that repairs rows without touching Chroma
Delta mode skips the 33 legacy rows because they have metrics and a resolved transcript -- it skips precisely what needs repairing. --full wipes the ticker's Chroma collection and re-embeds 4.3 M characters that are already correctly indexed. This script re-runs extraction and nothing else. Transcripts come from sections.db, so it makes zero Alpha Vantage calls, and it enumerates every row that stays unverified with the warning that kept it there rather than reporting a quietly lower number.fb7a832 -
feat: decompose the EPS headline and read the statements behind it
Two blocks on The Brief, both answering the question the headline raises and never settles: where did the number come from. analytics/eps_bridge.py partitions the year-on-year change in earnings per share into revenue, operating margin, interest, tax rate, share count and a residual carried openly as "other, non-operating". The identity holds by construction and is re-verified per computation; a bridge that fails its own checksum does not render. Five refusals keep it honest -- no prior-year comparable, a period without SEC lineage, a missing input, a diluted share count that moved more than 25% (a split, not dilution), and a residual larger than half the move. That last gate caught a real defect: Alphabet's quarterly EPS rows hold cumulative figures, so the panel withdraws for GOOGL rather than explain 8% of a move and invent the rest. analytics/statement_signals.py adds three figures that are always worth seeing -- incremental margin, two-year stack, cash conversion -- and a list o…bb3ad6b -
feat: rebuild The Brief around a sourced article and scannable panels
The Brief was fourteen stacked cards that repeated each other. It is now a piece of writing with the evidence arranged around it. The article is composed by a second model call that runs AFTER deterministic verification and is shown nothing but what passed it: verified facts, the code-computed quarter deltas, the XBRL segment lines. The fail-closed gate is not relaxed to allow prose, it is reused as the prose's input filter. validate_article then discards any paragraph citing no known entry or containing a number its citations do not state, and voids the whole piece on recommendation or price-target language, in four languages. Around it: - a scorecard of four to six coloured tiles, each carrying the figure that justifies its direction, validated exactly like a paragraph; - the product and region mix, an eight-quarter revenue and margin chart, and figures placed between article sections by role rather than by the model: what moved the group, what the company itself quantified,…0f869bb -
feat: read per-product and per-region results from the filing's XBRL instance
companyfacts returns only undimensioned facts, which is why the brief has never had a segment breakdown. The detail is in the inline-XBRL instance document that ships inside the filing itself, where facts carry explicit dimension members (srt:ProductOrServiceAxis, us-gaap:StatementBusinessSegmentsAxis). One fetch per filing yields the quarter and its prior-year comparable, so year-on-year costs no extra request. Two traps that would produce plausible wrong numbers, both covered by tests: - A filing tags subtotals beside detail members (Apple's "Products" equals iPhone + Mac + iPad + Wearables). Plotting both inflates the mix by 72%. The subtotal is found by anchoring on consolidated revenue and taking the subset equal to the excess, so no per-issuer member list is needed. - The structural fallback enumerates subsets, and an early break on an oversized sum is wrong: itertools.combinations is not ordered by sum. analytics/impact.py adds the arithmetic that turns the breakdown …232b6f9
-
fix: key backfill snapshot_id on fiscalDateEnding, not the derived label
snapshot_id was derived from target_period, which is DERIVED, not observed: it is Alpha Vantage's fiscalDateEnding date string until a matching quarterly row lands in metrics.db, then it flips to "Q{n}{YYYY}". ingest.py adds such rows every quarter, so the next re-run of this backfill would have minted new ids for those observations and appended them a second time under the other label -- exactly the duplication Ruling 13 had to clean by hand, in an archive whose only asset is being trustworthy. Per Ruling 18 the fix is structural rather than a docstring caveat: identity now comes from fiscalDateEnding, an observed provider fact that never moves, which leaves target_period free to improve without forking the record. The module docstring's idempotency claim is rewritten to match, including the consequence -- a re-run after an ingest writes nothing, so an archived label stays as first written and a consumer wanting the current label joins on period_end_date. The backfill half is regene…4d76839 -
fix: make consensus capture opt-in so briefs stop archiving wrong labels
agent/tools.py:288 fetches estimates with the LAST REPORTED period, because that is the period the brief is about. fetch_analyst_estimates then reads yfinance's "0q" row, which is the CURRENT, UNREPORTED quarter. Capture was an automatic side effect of every fetch, so every brief run appended a record asserting "consensus for Q1-2027 was X" where X is the street's estimate for Q2-2027. It cannot produce a false comparison today -- those captures post-date the report, so the gate refuses them on no_pre_release_snapshot -- and the 12 committed live records all came from the daily job and are clean. But it is a wrong observation in an archive whose entire asset is being trustworthy years from now, and sub-project E's backtest joins on that label. fetch_analyst_estimates gains an explicit keyword-only snapshot_period. Supply it and the call archives under that label; omit it and it archives nothing. scripts/snapshot_consensus.py supplies it (it derives the correct next-unreported period)…ac0fe57 -
fix: fail the daily job when it archives nothing, and log why
main() returned `0 if ok else 1`, where `ok` counted successful yfinance fetches. The append happens later and elsewhere -- inside record_consensus_snapshot, whose entire body sits in `except Exception: return 0`. So if every append failed the script printed a success line per ticker, exited 0, the workflow committed nothing and GitHub showed green: nothing captured, nothing alerted, and a day of consensus that no public source can give back. - main() now returns non-zero when zero records were written, and says on stderr which of the two causes it was. - record_consensus_snapshot logs the exception it swallows, plus the missing-as_of/target_period early return. Swallowing is correct -- a failed capture must never break a brief -- but the spec says the job logs a failed capture, and a bare `return 0` logs nothing. The module docstring already promised both behaviours; only the code disagreed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>49203e0 -
fix: restrict Alpha Vantage backfill matching to quarterly rows only
Ruling 11's join to metrics.report_date, unrestricted by row type, matched 18 quarterly Alpha Vantage estimates to annual (FY{YYYY}) rows whenever a fiscal Q4's period end fell within 7 days of the fiscal year end -- a category error labelling a quarterly estimate with an annual period. Restrict the join to rows whose period matches ^Q[1-4]\d{4}$; a fiscal Q4 has no 10-Q row in this repo's scheme and correctly falls back to the date-string identifier. Also regenerates the archive's backfill portion: unlike live_snapshot records (irrecoverable once the source cache rolls), backfill_at_report records can always be re-fetched, so the append-only protection that matters for the former doesn't apply to the latter. Stripped all backfill_at_report records (byte-for-byte preserving the 12 live_snapshot records, verified against a backup before and after) and re-ran the corrected backfill from scratch, avoiding the duplicate-observation problem the unrestricted join introduced. Result: 38 mat…4ae956f -
fix: join Alpha Vantage backfill on fiscalDateEnding, not reportedDate
metrics.report_date holds a fiscal period-end date despite its name (it comes from SEC's filings.recent.reportDate), not an announcement date. Alpha Vantage's reportedDate is an announcement date ~30 days later, so joining on it matched 0 of 617 real records. Switch the join key to Alpha Vantage's fiscalDateEnding (also a period-end date, 0-5 days of drift measured across the six covered tickers) and widen the match window from 3 to 7 days. target_period_source string is left unchanged for consistency with records already written under it. Re-running the backfill appends 56 newly-matched records (quarter and FY periods) alongside the existing date-string fallback records for the same underlying observations — expected append-only behavior, not deduplicated here per controller instruction.5a03a83 -
feat: backfill historical consensus EPS from Alpha Vantage
One-off import of ~15-20 years of quarterly EPS estimates per covered ticker into the append-only consensus archive, marked capture_kind="backfill_at_report" so aligned_consensus refuses them (no capture timestamp means none can be proven pre-release). Each Alpha Vantage quarter is labelled by joining its reportedDate against metrics.report_date (exact, else within 3 days) and borrowing that row's period verbatim; otherwise it falls back to Alpha Vantage's own fiscalDateEnding string as the identifier, which aligned_consensus can never resolve to a reported row but which still preserves the (estimate, actual, report date) triple for the calibration backtest. Adds unit tests for the matching/fallback logic against a tmp_path metrics DB (never the network).5b40465 -
fix: move filing_staleness to analytics/staleness so the snapshot job avoids Streamlit
scripts/snapshot_consensus.py imported dashboard.provenance.filing_staleness, and dashboard/provenance.py imports streamlit at module level. The daily GitHub Actions job only installs yfinance, so the scheduled run would die on first import with ModuleNotFoundError. filing_staleness is pure date arithmetic with no Streamlit dependency, so it moves verbatim to the stdlib-only analytics package (its __init__ already states that's the package's contract). dashboard/provenance.py re-exports the name so its existing callers (dashboard/verdict.py, tests/test_verdict.py) keep working unchanged. Adds tests/test_staleness.py covering the moved function directly.5f932b3 -
fix: derive target_period for the daily consensus capture
Controller ruling on the gap found while implementing Task 4: the daily job called fetch_analyst_estimates(ticker) with no target_period, so every captured payload carried target_period=None and record_consensus_snapshot's guard silently dropped every record — the archive stayed permanently empty. - analytics/consensus.py: next_unreported_period(ticker) derives the quarter after the most recently reported one from metrics.period labels (Q{n}{YYYY} / FY{YYYY}), taking the max on parsed (year, quarter) rather than lexicographically, since "Q12027" < "Q42026" as strings. Returns None when nothing parses. - scripts/snapshot_consensus.py: calls next_unreported_period first and skips (rather than fetches with a None period) when it returns None. Also warns, per ticker, when the latest reported filing is more than 120 days old (dashboard/provenance.py::filing_staleness's threshold) since the derived period is then probably wrong. - ingestion/analyst.py: every snapshot now car…6bdcc4d -
feat: add daily consensus capture script
Adds storage.metrics_db.list_tickers() (the app's de facto coverage universe, previously duplicated inline in warm_runtime_cache.py and deploy_check.py) and scripts/snapshot_consensus.py, which iterates it and calls ingestion.analyst.fetch_analyst_estimates per ticker. No data/consensus_snapshots.jsonl is included: a live run against all six covered tickers (AAPL, AMD, GOOGL, MSFT, NVDA, TSLA) wrote zero archive records. fetch_analyst_estimates(ticker) is called without target_period, so every captured payload carries target_period=None, and record_consensus_snapshot's `if not target_period: return 0` guard silently drops every record. See task-4-report.md for the full analysis; this needs a decision before the archive can hold real data.a95bfa1
-
fix: stop unverified EPS reaching the screen; make the shipped cache deliberate
Three follow-ups from watching the deployed Space rather than the local one. **Unverified EPS was being displayed.** analytics/eps_quality read metrics.db directly and so bypassed the per-row quality verdict the dashboard enforces. Some filers' quarterly EPS is extracted as a year-to-date total — Microsoft's reads 3.30, 6.53, 9.99 across a year — and those rows are flagged rather than shown. Feeding them to the fourth-quarter subtraction turned an annual figure minus three cumulative ones into a negative quarter, presented as a 242% "adjustment". The gate is now mirrored in analytics, and a ticker whose EPS cannot be verified says so instead of inventing a comparison. **Post-earnings price moves never worked in production.** The computation reaches Yahoo's price-history endpoint, which refuses datacenter addresses far more readily than the fundamentals endpoints the rest of the app uses, so it succeeded locally and returned nothing from the Space — silently, since it fails closed. an…694c11f -
feat: analyst-edge screens for events, wording, Q&A and earnings quality
Surface the research a retail investor cannot assemble by hand, and explain every panel in plain language before it shows a number. What Changed becomes four readings of the same quarter instead of one undifferentiated stream: what the company filed (8-K item codes as a dated event log), what it rewrote (grouped by meaning rather than by which analyser found it), what analysts kept pressing on, then the full signal feed. Financials gains the management track record, whether beating the published estimate actually moves the stock, GAAP versus adjusted profit, and the balance-sheet ratios that lead the income statement — including whether buybacks really shrank the share count or merely offset employee stock. dashboard/explain.py carries the comprehension layer: each block states what it is, how to read it, where the figure came from and what it does not prove. Panels that come back empty say why, so a genuine absence cannot read as a broken feature. Three defects surfaced and were f…5b9b478
-
fix: keep fail-closed per fact but stop zero-verified synthesis from emptying the whole brief
When no AI-generated claim passes deterministic evidence verification, the brief used to be replaced wholesale by an empty _partial_brief skeleton, discarding filing_date, company_name, what_to_watch, coverage, etc. even though those don't depend on LLM verification. Now only the per-fact filtering (unchanged, still fail-closed) empties individual sections, and a plain-language notice + data freshness banner (120-day staleness heuristic) tell the user what's missing instead of hiding the whole report. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>b419b7b