-
Notifications
You must be signed in to change notification settings - Fork 2
Fix 2026-04-18 weekly-review economic context violations and auto-emit Sankey for future review articles #1837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c6f526b
664de0d
8531257
a45c322
a46b537
07094df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -737,12 +737,26 @@ EN/SV only: all headings, meta, content in correct language; no untranslated `da | |
|
|
||
| ## Step 3d: Economic Commentary (MANDATORY) | ||
|
|
||
| > After Step 3c and **before** calling `safeoutputs.create_pull_request`, re-open `economic-data.json` and replace the placeholder `commentary` string with a 2–4 sentence paragraph that: | ||
| > - cites **2–3 concrete numeric values** from `dataPoints`; | ||
| > - ties the numbers to the day's political developments (not definitions of indicators); | ||
| > After Step 3c and **before** calling `safeoutputs.create_pull_request`, re-open `economic-data.json` and replace the placeholder `commentary` string with a **4–6 sentence paragraph of ≥150 words** (enforced by `scripts/validate-economic-context.ts` — `weekly-review` = 150, `monthly-review` = 200) that: | ||
| > - cites **≥3 concrete numeric values** from `dataPoints` (e.g. Nordic GDP comparison + Swedish unemployment trajectory); | ||
| > - ties the numbers to the week's political developments (not definitions of indicators); | ||
| > - is written in plain English (translations are produced downstream by `news-translate`); | ||
| > - meets the minimum word count in the coverage matrix for this article type. | ||
| > | ||
| > Banned phrasings (the multi-dim quality score flags these): "The political landscape remains fluid…", "Touches on X policy…", pure indicator definitions. | ||
| > | ||
| > **Sankey / flow diagram** (required for `weekly-review`): `scripts/generate-news-enhanced/generators.ts` calls `buildArticleVisualizationSections` with `alwaysEmit: true` for this article type, so `class="sankey-section"` is auto-appended whenever the week has at least **one** document — even when every document collapses into a single doc-type bucket. The only case where no Sankey is emitted is an empty week (`docs.length === 0`); in that edge case the visualization builder returns an empty section list. The AI writer does not need to emit Sankey HTML directly — just verify the generated HTML contains `class="sankey-section"` before opening the PR: | ||
| > ```bash | ||
| > if grep -l 'class="sankey-section"' news/$ARTICLE_DATE-weekly-review-*.html; then | ||
| > echo "✅ Sankey section present" | ||
| > else | ||
| > doc_count=$(find "analysis/daily/$ARTICLE_DATE/weekly-review/documents" -maxdepth 1 -name '*.json' 2>/dev/null | wc -l) | ||
| > if [ "$doc_count" = "0" ]; then | ||
| > echo "ℹ️ Sankey section not emitted — the week has 0 documents (validator allows this)" | ||
| > else | ||
| > echo "❌ Sankey section missing — the validator will block the PR"; exit 1 | ||
| > fi | ||
| > fi | ||
|
Comment on lines
+748
to
+759
|
||
| > ``` | ||
| > | ||
| > Full rules: [`.github/aw/ECONOMIC_DATA_CONTRACT.md`](../aw/ECONOMIC_DATA_CONTRACT.md) §"Writing the AI commentary — workflow Step 3d". | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Step 3d Sankey verification snippet computes
doc_countfromanalysis/daily/$ARTICLE_DATE/monthly-review/economic-data.jsonusing.docs, buteconomic-data.jsondoesn’t include adocsfield (it hasdataPoints,commentary,charts,source, etc.). This makes the jq expression effectively always return 0, which can incorrectly treat a missingclass="sankey-section"as acceptable. Please basedoc_counton the monthly-review documents source of truth (e.g., count JSONs underanalysis/daily/$ARTICLE_DATE/monthly-review/documents/if that directory is produced, or use the manifest the generator writes).