Skip to content

[Methodology] Add IMF connectivity pre-validation & pre-warm gate before analysis generation #2032

@pethers

Description

@pethers

📋 Issue Type

Feature / Methodology Hardening

🎯 Objective

Add a pre-flight IMF connectivity check + pre-warm step to all news/analysis workflows so missing IMF context is detected before Pass 1 starts (fail-fast or annotate), rather than discovered mid-run.

📊 Current State (evidence from 2026-04-26 reflections)

Aggregated across 6 of 10 methodology-reflection.md files for 2026-04-26:

  • monthly-review/methodology-reflection.md §"IMF Data Unavailability (Non-Fatal)": "The IMF CLI (tsx scripts/imf-fetch.ts) returned a connection error during this workflow run. As a result, no IMF economic context (WEO, FM, IFS dataflows) was injected into any artifact."
  • committeeReports/methodology-reflection.md Improvement 3: "IMF WEO Apr-2026 data was referenced conceptually … but not actually retrieved via scripts/imf-fetch.ts. Economic claims … are inference-based rather than IMF-grounded."
  • propositions/methodology-reflection.md Improvement 1: "Pre-fetch IMF SDMX data for fiscal-relevant propositions … tsx scripts/imf-fetch.ts weo --country SWE --indicator GGXWDG_NGDP --years 5."
  • week-ahead/methodology-reflection.md Improvement 3, month-ahead/methodology-reflection.md Improvement 1, interpellations/methodology-reflection.md Limitation 3 — same gap.

Mitigation today is reactive (Riksbank minutes as C4 substitute).

🚀 Desired State

  1. New script scripts/check-imf-connectivity.ts performs:
    • imf-fetch.ts weo --country SWE --indicator NGDP_RPCH --years 1
    • Validates HTTP 200 + JSON parses + economicProvenance.vintage ≤ 6 months.
  2. All 11 agentic workflows in .github/workflows/news-*.md invoke the check in their pre-warm step.
  3. On failure: workflow continues but writes data/imf-unavailable.flag + auto-injects a standard ⚠️ IMF context unavailable block into executive-brief.md, comparative-international.md, synthesis-summary.md.
  4. On stale vintage (>6 mo): annotate every economicProvenance block per ECONOMIC_DATA_CONTRACT.md v2.1.

📊 CIA Data Integration Context

Not directly CIA-product driven — this is upstream economic-data canon enforcement per .github/aw/ECONOMIC_DATA_CONTRACT.md v2.1 and analysis/imf/agentic-integration.md.

🔧 Implementation Approach

  1. Create scripts/check-imf-connectivity.ts (3 dataflows: WEO, FM, IFS).
  2. Add imf-precheck: step (60-sec timeout) to each news-*.md workflow before analysis-gate.
  3. Add Vitest test in tests/imf-context.test.ts asserting precheck runs and emits imf-context.json or imf-unavailable.flag.
  4. Document in analysis/imf/agentic-integration.md §"Pre-warm gate".

🤖 Recommended Agent

data-pipeline-specialist — owns scripts/imf-fetch.ts, imf-client.ts, imf-codes.ts, vintage cache per AGENTS.md cross-agent IMF rule.

✅ Acceptance Criteria

  • scripts/check-imf-connectivity.ts exists and exits 0/1 + emits structured JSON
  • All 11 news-*.md workflows invoke the pre-check
  • Failure path generates data/imf-unavailable.flag and auto-injects warning block
  • Vitest coverage ≥ 1 test per code path (success / network-fail / stale-vintage)
  • No banned-phrase regressions in tests/imf-precedence-contract.test.ts
  • Doc update in analysis/imf/agentic-integration.md

📚 References

  • Methodology evidence: analysis/daily/2026-04-26/{monthly-review,committeeReports,propositions,week-ahead,month-ahead,interpellations}/methodology-reflection.md
  • Contract: .github/aw/ECONOMIC_DATA_CONTRACT.md v2.1
  • Hub: analysis/imf/README.md, analysis/imf/agentic-integration.md
  • ISMS: Secure_Development_Policy.md, Change_Management.md

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions