feat: effective tariff rate source (#1790)

* feat: effective tariff rate source

* fix(trade): extract parse helpers, fix tests, add health monitoring

- Extract htmlToPlainText/toIsoDate/parseBudgetLabEffectiveTariffHtml
  to scripts/_trade-parse-utils.mjs so tests can import directly
- Fix toIsoDate to use month-name lookup instead of fragile
  new Date(\`\${text} UTC\`) which is not spec-guaranteed
- Replace new Function() test reconstruction with direct ESM import
- Add test fixtures for parser patterns 2 and 3 (previously untested)
- Add tariffTrendsUs to health.js STANDALONE_KEYS + SEED_META
  (key trade:tariffs:v1:840:all:10, maxStaleMin 900 = 2.5x the 6h TTL)

* fix(test): update sourceVersion assertion for budgetlab addition

---------

Co-authored-by: Elie Habib <elie.habib@gmail.com>
This commit is contained in:
Fayez Bast
2026-03-19 01:45:32 +02:00
committed by GitHub
parent 5ba0d8db83
commit cf1fdefe92
17 changed files with 560 additions and 20 deletions

View File

@@ -9380,6 +9380,87 @@ a.prediction-link:hover {
text-decoration: underline;
}
.trade-policy-note {
margin-bottom: 8px;
padding: 8px 10px;
background: var(--overlay-subtle);
border-left: 2px solid var(--accent);
border-radius: 4px;
font-size: 10px;
line-height: 1.45;
color: var(--text-secondary);
}
.trade-policy-note strong {
color: var(--text);
}
.trade-policy-inline-note {
margin-top: 4px;
font-size: 9px;
line-height: 1.4;
color: var(--text-secondary);
}
.trade-policy-inline-sep {
margin: 0 4px;
color: var(--text-faint);
}
.trade-tariff-summary {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
gap: 8px;
margin-bottom: 8px;
}
.trade-tariff-card {
padding: 8px 10px;
background: var(--overlay-subtle);
border: 1px solid var(--border);
border-radius: 4px;
}
.trade-tariff-card-muted {
opacity: 0.85;
}
.trade-tariff-label {
font-size: 9px;
font-weight: 600;
letter-spacing: 0.4px;
text-transform: uppercase;
color: var(--text-dim);
}
.trade-tariff-value {
margin-top: 4px;
font-size: 16px;
font-weight: 700;
font-variant-numeric: tabular-nums;
color: var(--text);
}
.trade-tariff-meta {
margin-top: 4px;
font-size: 10px;
line-height: 1.4;
color: var(--text-dim);
}
.trade-tariff-source {
display: inline-block;
margin-left: 6px;
}
.trade-tariff-gap-positive {
color: var(--orange, #ffab40);
}
.trade-tariff-gap-negative {
color: var(--green, #69f0ae);
}
/* Trade Tariffs Table */
.trade-tariffs-table {
width: 100%;