Skip to content

Localize executive-brief lead in news HTML + sharpen brief headline tradecraft#2834

Merged
pethers merged 2 commits into
mainfrom
copilot/improve-executive-briefs-generation
May 30, 2026
Merged

Localize executive-brief lead in news HTML + sharpen brief headline tradecraft#2834
pethers merged 2 commits into
mainfrom
copilot/improve-executive-briefs-generation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 29, 2026

Non-English news pages opened with the English executive brief even when a localized executive-brief_<lang>.md existed, and every page embedded all 13 localized briefs inline as ## Executive Brief Sv/De/… carrier sections (a representative proposition page was ~428 KB). The localized brief was only feeding the SEO <title>/<meta description> cascade — never the on-page body lead.

This brings the on-page lead into lock-step with that SEO cascade (localized if it exists, English otherwise) and strips the inline carrier bloat.

Changes

  • New scripts/render-lib/article-brief-lead.ts — pure (no-I/O) markdown transform applied by renderArticleHtml per language:
    • stripEmbeddedLocalizedBriefSections() removes every ## Executive Brief <Lang> carrier for all languages.
    • For non-English with a localized brief, the first <h2> lead-section body (## What Happened) is swapped to the cleaned executive-brief_<lang>.md — reusing the aggregator's cleanArtifactBody + rewriteRelativeLinks pipeline, deliberately skipping normalizeNarrativeTerminology so English first-use glosses never leak into localized prose. Lead heading stays the language-stable English ## What Happened (TOC localizes its label separately); provenance comment repoints to executive-brief_<lang>.md.
    • English, missing-brief, and empty/whitespace-brief all retain the English lead — mirroring SEO fallback layer Fix MCP server paths and add rule-based Copilot instructions #4.
  • Wired into scripts/render-lib/article.ts renderArticleHtml.
  • Carrier exclusion from the artifact listresolveArtifactList (render-articles.ts) and isReaderGuideEligible (aggregator/reader-guide.ts) now skip executive-brief_<lang>.md, so they no longer surface as Reader Intelligence Guide rows (which would dangle once the body carriers are stripped), Article Sources cards, or JSON-LD isBasedOn. They are translations of executive-brief.md, not independent analytical artifacts.
  • analysis/methodologies/ai-driven-analysis-guide.md — added a 🪝 Headline-tradecraft block (named actor + active verb + concrete stake, SERP-safe ≤70 chars, no date-stuffing, localize the angle not the words) and made Step 2B / Step 7 explicit that the brief H1/BLUF is now the on-page lead in every language, not just metadata.
  • Article-Generation.md — documents the on-page lead localization step alongside the existing metadata cascade.
  • tests/article-brief-lead.test.ts — 12 cases: carrier strip across all langs incl. EN, localized swap, EN passthrough, missing/empty fallback, provenance repoint, front-matter/H1 cleaning + ##### demotion, legacy ## Executive Brief H2, single-H2 lead.

Analysis findings (requested)

  • article.md completeness: all 22 root analytical artifacts on disk are aggregated (each carries a source: comment) — no valuable content is missing. The sole redundancy was the 13 translation carriers, which are functionally dead weight in HTML (SEO reads executive-brief_<lang>.md from disk, not the embedded copies) and are now stripped at render.

Notes

  • Verified renders for sv/ja/ar/en (2026-05-20/propositions): localized lead present, no English leak, zero carriers, ~428 KB → ~307 KB. Sample page renders were reverted — bulk HTML regeneration lands as its own dedicated commit per repo convention, so this PR is code + tests + docs only.

Copilot AI and others added 2 commits May 29, 2026 23:14
Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI requested a review from pethers May 29, 2026 23:26
@github-actions github-actions Bot added documentation Documentation updates testing Test coverage refactor Code refactoring size-l Large change (250-1000 lines) labels May 29, 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: documentation,testing,refactor,size-l

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 May 30, 2026 06:03
Copilot AI review requested due to automatic review settings May 30, 2026 06:03
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

Brings the on-page article lead into lock-step with the existing localized SEO cascade: non-English news pages now open with their own-language executive-brief_<lang>.md body (falling back to English when absent), and the 13 inline ## Executive Brief <Lang> carrier sections embedded by the aggregator are stripped for every language — dropping a sample proposition page from ~428 KB to ~307 KB. Localized brief carriers are also excluded from the artifact list so they stop appearing as Reader Guide rows, Article Sources cards, and JSON-LD isBasedOn.

Changes:

  • New pure transform scripts/render-lib/article-brief-lead.ts (carrier strip + lead-body swap reusing cleanArtifactBody + rewriteRelativeLinks, deliberately skipping normalizeNarrativeTerminology), wired into renderArticleHtml.
  • Carrier exclusion in resolveArtifactList and isReaderGuideEligible plus 12 unit tests in tests/article-brief-lead.test.ts.
  • Documentation: new "On-page lead localization" section in Article-Generation.md and a Headline-tradecraft block in analysis/methodologies/ai-driven-analysis-guide.md.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scripts/render-lib/article-brief-lead.ts New pure transform: strip carriers + swap lead body to localized brief
scripts/render-lib/article.ts Wires localizeExecutiveBriefLead into renderArticleHtml
scripts/render-lib/aggregator/reader-guide.ts Excludes executive-brief_<lang>.md from Reader Guide eligibility
scripts/render-articles.ts Excludes localized brief carriers from resolveArtifactList
tests/article-brief-lead.test.ts 12 cases pinning carrier strip, swap, fallback, cleaning, provenance
Article-Generation.md Documents on-page lead localization alongside SEO cascade
analysis/methodologies/ai-driven-analysis-guide.md Adds headline-tradecraft guidance + triple-duty H1 note

@pethers pethers merged commit d5647c3 into main May 30, 2026
19 checks passed
@pethers pethers deleted the copilot/improve-executive-briefs-generation branch May 30, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation updates refactor Code refactoring size-l Large change (250-1000 lines) testing Test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants