Skip to content

Improve political intelligence depth in news articles and workflows#1509

Merged
pethers merged 8 commits intomainfrom
copilot/improve-political-intelligence-articles
Apr 1, 2026
Merged

Improve political intelligence depth in news articles and workflows#1509
pethers merged 8 commits intomainfrom
copilot/improve-political-intelligence-articles

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

  • Phase 1: Delete all deprecated files and directories
  • Phase 2: Fix broken imports in consuming files
  • Review feedback: Restored THEME_COLORS backward-compat export
  • Phase 4: Fix all TypeScript build errors (CI failure)
    • Fix swot-analyzer.ts: added 'academia', 'labor' to StakeholderCategory; added 'academic', 'judiciary' entries to STAKEHOLDER_NAMES and STAKEHOLDER_ROLES
    • Fix config.ts: added 'quick' to AnalysisDepth type
    • Fix generators.ts: typed analyzeDashboardData return, null-coalesce topic args, type docTypeChart/docTypeTable, null→undefined for focusTopic
    • Fix helpers.ts: changed assessArticleQuality to accept readonly string[]
    • Fix breaking-news.ts: typed urgency as UrgencyLabel, imported UrgencyLabel
    • Fix pre-article-analysis.ts: expanded StubDocumentResult/StubBatchResult with crossDocumentLinks, keyInsights, confidenceScore; cast results for serializers
    • Fix markdown-serializer.ts: added confidence, keyActors, relatedPolicies to PerspectiveAnalysis; confidence, reason to DocumentLink; metricName to DashboardMetric; expanded document type fields
    • Fix shared.ts: replaced opaque unknown stubs with properly typed interfaces (DocumentAnalysis, RiskAssessment, ImplementationAssessment, PESTLEDimensions, StakeholderImpact)
    • Fix content-generators/index.ts: added generateStakeholderSwotSection stub, StakeholderSwotSectionOptions, StakeholderSwot types
    • All 3932 tests pass, 0 TypeScript errors

Summary of changes

  • Deleted ~21,900 lines of deprecated analysis-generation code
  • Fixed 11 consuming files by inlining needed types and replacing analysis functions with stubs
  • Enforced Rule 2: Scripts now only handle data download and HTML formatting
  • Restored THEME_COLORS as backward-compatible alias resolving to DARK_THEME_COLORS
  • Fixed all TypeScript build errors: 0 errors remaining, all 3932 tests passing

Copilot AI and others added 4 commits April 1, 2026 21:17
…, political intelligence depth requirements, quality issues, and script role boundary

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/0762a10a-cf54-44e3-8d3f-085e6cf59a62

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
… 8-stakeholder SWOT, Mermaid/risk/forward indicator requirements

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/0762a10a-cf54-44e3-8d3f-085e6cf59a62

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…r ai-driven-analysis-guide.md Rule 2

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/0762a10a-cf54-44e3-8d3f-085e6cf59a62

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions github-actions bot added documentation Documentation updates workflow GitHub Actions workflows ci-cd CI/CD pipeline changes refactor Code refactoring news News articles and content generation agentic-workflow Agentic workflow changes size-l Large change (250-1000 lines) labels Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🏷️ Automatic Labeling Summary

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

Applied Labels: documentation,workflow,ci-cd,refactor,size-l,news,agentic-workflow

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

github-actions bot commented Apr 1, 2026

🔍 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

… deprecated content generators, THEME_COLORS, and 19 test files

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/e8be0c62-6c4e-47df-8c0a-786f48e11ceb

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions github-actions bot added testing Test coverage size-xl Extra large change (> 1000 lines) labels Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🔍 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 1, 2026 22:24
Copilot AI review requested due to automatic review settings April 1, 2026 22:24
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.

Pull request overview

This PR removes deprecated AI analysis/framework modules and related tests, updates the browser theme/chart utilities to drop the deprecated THEME_COLORS alias, and tightens the “news” workflow prompt docs to require deeper, more structured political analysis output.

Changes:

  • Deleted deprecated scripts/ai-analysis/ + scripts/analysis-framework/ code and associated Vitest test suites.
  • Removed THEME_COLORS export and re-export from the browser theme/chart utility layer.
  • Expanded workflow prompt requirements (stakeholder coverage, Mermaid diagrams, risk matrices, forward indicators, and isolation rules).

Reviewed changes

Copilot reviewed 54 out of 59 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/generate-news-generators.test.ts Removed unit tests for enhanced news generators.
tests/generate-news-enhanced-integration.test.ts Removed integration tests for template/quality/leakage checks.
tests/coalition-detector.test.ts Removed tests for coalition tension heuristics.
tests/analysis-integration.test.ts Removed integration tests for analysis/content generator bridge.
tests/ai-visualisation.test.ts Removed tests for mindmap/dashboard builders.
tests/ai-urgency-classifier.test.ts Removed tests for watch points/policy assessment labels.
tests/ai-swot-builder.test.ts Removed tests for SWOT builder + localisation records.
tests/ai-swot-analyzer.test.ts Removed tests for AI SWOT stakeholder builder.
tests/ai-coalition-detector.test.ts Removed interface-level tests for coalition detector.
src/browser/shared/theme.ts Removed deprecated THEME_COLORS alias; comments updated to point to runtime theme selection.
src/browser/shared/chart-factory.ts Dropped import/re-export of THEME_COLORS from the chart factory convenience exports.
scripts/data-transformers/content-generators/stakeholder-swot-section.ts Deleted stakeholder SWOT section generator module.
scripts/analysis-framework/types.ts Deleted analysis framework type definitions.
scripts/analysis-framework/significance-scorer.ts Deleted framework significance/confidence scoring implementation.
scripts/analysis-framework/methodology-types.ts Deleted methodology type system (classification/risk/threat).
scripts/analysis-framework/lenses/opposition.ts Deleted opposition lens implementation.
scripts/analysis-framework/lenses/media.ts Deleted media lens implementation.
scripts/analysis-framework/lenses/international.ts Deleted international lens implementation.
scripts/analysis-framework/lenses/government.ts Deleted government lens implementation.
scripts/analysis-framework/lenses/economic.ts Deleted economic lens implementation.
scripts/analysis-framework/lenses/citizen.ts Deleted citizen lens implementation.
scripts/analysis-framework/index.ts Deleted framework orchestrator and re-exports.
scripts/analysis-framework/cross-reference.ts Deleted cross-document relationship detection implementation.
scripts/ai-analysis/visualisation/index.ts Deleted AI visualisation builders (mindmap/dashboard).
scripts/ai-analysis/types.ts Deleted AI pipeline type definitions.
scripts/ai-analysis/political-significance.ts Deleted political significance scoring implementation.
scripts/ai-analysis/pipeline.ts Deleted AI analysis pipeline orchestrator.
scripts/ai-analysis/index.ts Deleted barrel exports for AI analysis module.
scripts/ai-analysis/helpers.ts Deleted AI analysis helper utilities.
scripts/ai-analysis/coalition-detector.ts Deleted coalition detector implementation.
.github/workflows/news-translate.md Updated analysis depth gate requirements to include Mermaid diagrams + stakeholder minimums.
.github/workflows/news-realtime-monitor.md Added “Article Type Isolation” rule; expanded depth gate to include risk matrix + indicators.
.github/workflows/news-motions.md Added isolation rule; expanded depth gate and editorial profile requirements (8 stakeholders, risk, indicators).
.github/workflows/news-month-ahead.md Added isolation rule; expanded depth gate and editorial profile requirements (8 stakeholders, risk, indicators).
.github/workflows/news-interpellations.md Added isolation rule; expanded depth gate and editorial profile requirements (8 stakeholders, risk, indicators).
.github/workflows/news-evening-analysis.md Added isolation rule; expanded depth gate and editorial profile requirements (8 stakeholders, risk, indicators).
.github/workflows/news-committee-reports.md Added isolation rule; expanded depth gate and editorial profile requirements (8 stakeholders, risk, indicators).
.github/workflows/news-article-generator.md Added isolation rule; expanded depth gate requirements (risk matrix + indicators + 8 stakeholders).


import type { Chart as ChartType, ChartConfiguration, ChartTypeRegistry } from 'chart.js';
import { THEME_COLORS, CHART_PALETTE, BREAKPOINTS, getActiveThemeColors, getChartPalette } from './theme.js';
import { CHART_PALETTE, BREAKPOINTS, getActiveThemeColors, getChartPalette } from './theme.js';
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

Removing the THEME_COLORS re-export from this “convenience” module is a breaking API change for any callers importing THEME_COLORS from chart-factory.ts. If you want to keep the deprecation removal, consider providing a temporary compatibility export (deprecated) for one release cycle (e.g., re-export DARK_THEME_COLORS under the old name) or update the public-facing module contract to make consumers migrate to getActiveThemeColors() without runtime breakage.

Copilot uses AI. Check for mistakes.
export { THEME_COLORS, CHART_PALETTE, BREAKPOINTS, getActiveThemeColors, getChartPalette };
export { CHART_PALETTE, BREAKPOINTS, getActiveThemeColors, getChartPalette };

/**
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

Removing the THEME_COLORS re-export from this “convenience” module is a breaking API change for any callers importing THEME_COLORS from chart-factory.ts. If you want to keep the deprecation removal, consider providing a temporary compatibility export (deprecated) for one release cycle (e.g., re-export DARK_THEME_COLORS under the old name) or update the public-facing module contract to make consumers migrate to getActiveThemeColors() without runtime breakage.

Suggested change
/**
/**
* @deprecated Use getActiveThemeColors() instead.
* Temporary compatibility export to avoid breaking callers that import THEME_COLORS
* from this convenience module.
*/
export const THEME_COLORS = getActiveThemeColors();
/**

Copilot uses AI. Check for mistakes.

### Article Type Isolation

> 🚨 **This workflow writes analysis ONLY to `analysis/daily/${ARTICLE_DATE}/committeeReports/`**. NEVER write to the parent date directory or another article type's folder. See SHARED_PROMPT_PATTERNS.md "Article Type Isolation" section.
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

The new target directory uses committeeReports/ (camelCase), while other workflow docs in this PR use kebab-case or lowercase folder names (e.g., motions/, interpellations/, month-ahead/). If these paths are used as hard constraints for where automation writes outputs, this inconsistency can cause analysis artifacts to be written to the wrong location or split across multiple directories. Standardize directory naming across workflows (prefer a single convention) and ensure it matches the actual generator/output paths.

Suggested change
> 🚨 **This workflow writes analysis ONLY to `analysis/daily/${ARTICLE_DATE}/committeeReports/`**. NEVER write to the parent date directory or another article type's folder. See SHARED_PROMPT_PATTERNS.md "Article Type Isolation" section.
> 🚨 **This workflow writes analysis ONLY to `analysis/daily/${ARTICLE_DATE}/committee-reports/`**. NEVER write to the parent date directory or another article type's folder. See SHARED_PROMPT_PATTERNS.md "Article Type Isolation" section.

Copilot uses AI. Check for mistakes.
Comment on lines +896 to +898
| Depth | AI iterations | SWOT stakeholders | Charts | Mindmap | Mermaid diagrams | Risk matrix (L×I) | Forward indicators | Min. analysis time |
|-------|--------------|-------------------|--------|---------|-----------------|-------------------|-------------------|-------------------|
| standard | 1-2 | ≥5 (of 8 groups) | ≥1 | optional | ≥1 color-coded | ≥2 risks scored | ≥2 with triggers | 10 minutes |
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

The table rows are prefixed with ||, which renders as an extra empty leading column in Markdown tables on GitHub. Since these lines were modified in this PR, it’s a good opportunity to correct the table formatting by using a single leading pipe (|) (or no leading pipe at all) consistently across all rows so column alignment is unambiguous.

Copilot uses AI. Check for mistakes.

### Article Type Isolation

> 🚨 **This workflow writes analysis ONLY to `analysis/daily/${ARTICLE_DATE}/${REQUESTED_TYPE}/`**. NEVER write to the parent date directory or another article type's folder. See SHARED_PROMPT_PATTERNS.md "Article Type Isolation" section.
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

The PR description indicates “Phase 3: Add analysis transparency links to SHARED_PROMPT_PATTERNS.md” is not completed, but multiple workflow docs now instruct readers to consult SHARED_PROMPT_PATTERNS.md (including a specific “Article Type Isolation” section). To avoid internal doc drift, either include the corresponding SHARED_PROMPT_PATTERNS.md updates in this PR (so the references resolve), or adjust these references until Phase 3 is actually delivered.

Copilot uses AI. Check for mistakes.
@pethers
Copy link
Copy Markdown
Member

pethers commented Apr 1, 2026

@copilot apply changes based on the comments in this thread

…ypes and stub functions for ai-analysis, analysis-framework, and content-generators

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/e8be0c62-6c4e-47df-8c0a-786f48e11ceb

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🔍 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

…es to DARK_THEME_COLORS for backward-compat)

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/36ca13c7-0129-4102-ad12-47c8129137d5

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 1, 2026

@copilot apply changes based on the comments in this thread

Applied the review feedback in commit b6d11c8:

  • THEME_COLORS: Restored as a backward-compatible alias in chart-factory.ts that resolves to DARK_THEME_COLORS. Callers importing THEME_COLORS from this module will continue to work. The export from theme.ts itself remains removed since getActiveThemeColors() is the proper replacement there.
  • committeeReports/ naming: This is the established convention — the script code (pre-article-analysis.ts validates against 'committeeReports'), SHARED_PROMPT_PATTERNS.md, and actual on-disk directories all use camelCase. Changing to kebab-case would break the pipeline. Not a bug.
  • Double-pipe table formatting: Not present in the current code — the || matches in news-realtime-monitor.md are shell || true fallbacks, not Markdown table pipes.
  • SHARED_PROMPT_PATTERNS.md references: The "Article Type Isolation" section already exists at line 12 of SHARED_PROMPT_PATTERNS.md, so the cross-references from other workflow docs resolve correctly.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🔍 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
Copy link
Copy Markdown
Member

pethers commented Apr 1, 2026

@copilot analyse and fix all issues in TypeScript & JavaScript Testing / Unit Tests (Vitest) (pull_request)
TypeScript & JavaScript Testing / Unit Tests (Vitest) (pull_request)Failing after 40s

… stub types, fix StakeholderCategory union

Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/25294c5d-0866-4ece-b10b-6d46f41538b6

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🔍 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

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 1, 2026

@copilot analyse and fix all issues in [TypeScript & JavaScript Testing / Unit Tests (Vitest) (pull_request)](https://github.com/Hack23/riksdagsmonitor/actions/runs/23874547032/job/696...

Fixed all TypeScript build errors in commit a16938a. The 58 errors were caused by:

  1. StakeholderCategory missing 'academia', 'labor' variants and STAKEHOLDER_NAMES/STAKEHOLDER_ROLES missing 'academic', 'judiciary' entries
  2. AnalysisDepth missing 'quick' variant
  3. generators.tsstring | null passed to string params, unknown[] return types, untyped docTypeChart/docTypeTable
  4. markdown-serializer.tsPerspectiveAnalysis, DocumentLink, DashboardMetric interfaces missing fields used by serialization code
  5. shared.ts — opaque { [key: string]: unknown } stub types needed proper typed interfaces
  6. content-generators/index.ts — missing generateStakeholderSwotSection stub after module deletion

All 3932 tests pass, 0 TypeScript errors, 0 CodeQL alerts.

@pethers pethers merged commit bf65b7b into main Apr 1, 2026
25 checks passed
@pethers pethers deleted the copilot/improve-political-intelligence-articles branch April 1, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentic-workflow Agentic workflow changes ci-cd CI/CD pipeline changes documentation Documentation updates news News articles and content generation refactor Code refactoring size-l Large change (250-1000 lines) size-xl Extra large change (> 1000 lines) testing Test coverage workflow GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants