Skip to content

[WIP] Add IMF connectivity pre-validation and pre-warm gate for analysis generation#2038

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/add-imf-connectivity-pre-validation
Closed

[WIP] Add IMF connectivity pre-validation and pre-warm gate for analysis generation#2038
Copilot wants to merge 3 commits intomainfrom
copilot/add-imf-connectivity-pre-validation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>[Methodology] Add IMF connectivity pre-validation & pre-warm gate before analysis generation</issue_title>
<issue_description>## 📋 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
    </issue_description>

<agent_instructions>Use the documentation-architect custom agent (owns templates/schemas). Define schemas/pir-status.schema.json. Coordinate with data-pipeline-specialist for scripts/roll-forward-pirs.ts. CI gate at .github/prompts/05-analysis-gate.md must enforce presence + validity. Update analysis/methodologies/ai-driven-analysis-guide.md §PIR.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@github-actions github-actions Bot added the size-xs Extra small change (< 10 lines) label Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🏷️ Automatic Labeling Summary

This PR has been automatically labeled based on the files changed and PR metadata.

Applied Labels: size-xs

Label Categories

  • 🗳️ Content: news, dashboard, visualization, intelligence
  • 💻 Technology: html-css, javascript, workflow, security
  • 📊 Data: cia-data, riksdag-data, data-pipeline, schema
  • 🌍 I18n: i18n, translation, rtl
  • 🔒 ISMS: isms, iso-27001, nist-csf, cis-controls
  • 🏗️ Infrastructure: ci-cd, deployment, performance, monitoring
  • 🔄 Quality: testing, accessibility, documentation, refactor
  • 🤖 AI: agent, skill, agentic-workflow

For more information, see .github/labeler.yml.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers marked this pull request as ready for review April 27, 2026 06:51
Copilot AI review requested due to automatic review settings April 27, 2026 06:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers closed this Apr 27, 2026
@pethers pethers deleted the copilot/add-imf-connectivity-pre-validation branch April 27, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-xs Extra small change (< 10 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants