test: add golden output parity gate and live A/B compare

Phase 0 of docs/DESIGN.md, before any refactor code:

- tests/golden.rs runs every case in tests/golden/cases.toml (126
  outputs across help, completions, config, cache, all stocks commands
  on MSN and Yahoo mocks, error paths, and ownership queries on a seeded
  fixture DB) and compares exit code, stdout, and stderr byte for byte.
  Regenerate only with UPDATE_GOLDEN=1 for a reviewed output change.
- scripts/live-smoke.sh --compare <old-idx> runs each live case with
  both binaries and fails on differing exit codes, added/missing/retyped
  JSON keys, or changed values for slow-moving data.
- Exclude golden files from the whitespace/EOF pre-commit fixers, which
  would otherwise rewrite pinned help output.

Both gates were fault-injected: a one-word table change fails exactly
the three history goldens, and a binary dropping profile.long_name fails
only the profile live comparison.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hermes 2026-10-14 08:33:25 +00:00
commit fe627496dd
133 changed files with 6033 additions and 23 deletions

View file

@ -0,0 +1,36 @@
exit: 0
--- stdout
{
"instrument": {
"id": "bn91jc",
"symbol": "BBCA.JK",
"name": "Bank Central Asia Tbk PT"
},
"balance_sheet": {
"values": {
"cashAndShortTermInvestments": 500000000.0,
"totalEquity": 900000000.0
},
"currency": "IDR",
"report_date": "2025-12-31",
"end_date": "2025-12-31"
},
"cash_flow": {
"values": {
"operatingCashFlow": 600000000.0
},
"currency": "IDR",
"report_date": "2025-12-31",
"end_date": "2025-12-31"
},
"income_statement": {
"values": {
"netIncome": 400000000.0,
"totalRevenue": 1000000000.0
},
"currency": "IDR",
"report_date": "2025-12-31",
"end_date": "2025-12-31"
}
}
--- stderr