Skip to content

Strip English Executive Brief carrier so it no longer leaks into the article TOC#2840

Merged
pethers merged 3 commits into
mainfrom
copilot/analyse-and-improve-localisation
May 30, 2026
Merged

Strip English Executive Brief carrier so it no longer leaks into the article TOC#2840
pethers merged 3 commits into
mainfrom
copilot/analyse-and-improve-localisation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 30, 2026

An executive-brief_en.md artifact is embedded by the aggregator as a ## Executive Brief En carrier heading. Because the lead-localizer's suffix list excluded English, that carrier survived into the rendered output and leaked into both the in-article TOC and body — visible in the committed 2026-05-15/propositions build (the only subfolder with this artifact), not just single-language isolation.

Root cause

  • stripEmbeddedLocalizedBriefSections (article-brief-lead.ts) strips ## Executive Brief <Lang> carriers, but LOCALIZED_BRIEF_TITLE_SUFFIXES was built from LANGUAGES.filter((l) => l !== 'en').
  • The unstripped <h2 id="rm-executive-brief-en"> has no slug localization, so generateArticleToc falls back to raw text "Executive Brief En" → TOC leak (and a duplicate brief body section).

Changes

  • scripts/render-lib/article-brief-lead.ts — include all 14 languages (English included) in LOCALIZED_BRIEF_TITLE_SUFFIXES. The \b boundary in EMBEDDED_BRIEF_SECTION_RE still preserves the legacy unsuffixed ## Executive Brief / ## What Happened canonical lead. JSDoc updated to explain the English inclusion.
  • tests/article-brief-lead.test.ts — regression tests for (a) stripping a stray ## Executive Brief En carrier, (b) preserving the legacy unsuffixed lead, (c) the English render-path stripping the En carrier while keeping the canonical lead.
  • news/2026-05-15-propositions-*.html (14 languages) — regenerated; the leaked TOC entry and duplicate carrier section are removed while the canonical What Happened lead is preserved.
// before: English excluded → "## Executive Brief En" never stripped
const LOCALIZED_BRIEF_TITLE_SUFFIXES = LANGUAGES.filter((l) => l !== 'en').map(/* … */);
// after: all langs, incl. English
const LOCALIZED_BRIEF_TITLE_SUFFIXES = LANGUAGES.map(/* … */);

Notes

  • TOC section-title localization coverage was audited as part of "improve all" — every SECTION_TITLES slug resolves through localizedSectionTitle (0 uncovered), so no additional i18n gaps remain.
  • A pre-existing mermaid-coverage-regression on the unmodified 2026-05-15/propositions/article.md is unrelated to this change.

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI requested a review from pethers May 30, 2026 11:40
@github-actions github-actions Bot added testing Test coverage refactor Code refactoring size-l Large change (250-1000 lines) labels May 30, 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: 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

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@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

…Brief En TOC entry

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI changed the title Localise article TOC section titles across all 14 languages Strip English Executive Brief carrier so it no longer leaks into the article TOC May 30, 2026
@github-actions github-actions Bot added html-css HTML/CSS changes translation Translation updates rtl RTL language support (Arabic, Hebrew) news News articles and content generation size-xl Extra large change (> 1000 lines) labels May 30, 2026
@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 11:58
Copilot AI review requested due to automatic review settings May 30, 2026 11:58
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 fixes an edge case in the article lead localization pipeline where an embedded executive-brief_en.md artifact could survive as a ## Executive Brief En carrier and leak into the rendered article body and in-article TOC. The change makes carrier stripping include English suffixes while preserving the legacy unsuffixed ## Executive Brief lead heading.

Changes:

  • Update carrier-stripping logic to treat Executive Brief En as a removable embedded carrier section (same as other localized carriers).
  • Add regression tests covering (a) stripping the English carrier, (b) preserving the legacy unsuffixed heading, and (c) English render-path behavior.
  • Regenerate affected news/2026-05-15-propositions-*.html outputs to remove the leaked TOC entry and duplicated carrier section.

Reviewed changes

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

Show a summary per file
File Description
scripts/render-lib/article-brief-lead.ts Includes English in localized brief suffix matching so Executive Brief En carriers are stripped without impacting the canonical/legacy lead headings.
tests/article-brief-lead.test.ts Adds regression coverage for stripping Executive Brief En while preserving canonical/legacy lead behavior.
tests/section-title-i18n.test.ts Expands TOC localization coverage assertions for additional mapped slugs and adds targeted regression expectations.
news/2026-05-15-propositions-en.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.
news/2026-05-15-propositions-sv.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.
news/2026-05-15-propositions-da.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.
news/2026-05-15-propositions-no.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.
news/2026-05-15-propositions-de.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.
news/2026-05-15-propositions-fr.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.
news/2026-05-15-propositions-es.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.
news/2026-05-15-propositions-nl.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.
news/2026-05-15-propositions-ar.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.
news/2026-05-15-propositions-he.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.
news/2026-05-15-propositions-ja.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.
news/2026-05-15-propositions-ko.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.
news/2026-05-15-propositions-zh.html Regenerated to remove leaked Executive Brief En TOC entry/body section and update timestamps.

@pethers pethers merged commit 2726257 into main May 30, 2026
20 checks passed
@pethers pethers deleted the copilot/analyse-and-improve-localisation branch May 30, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

html-css HTML/CSS changes news News articles and content generation refactor Code refactoring rtl RTL language support (Arabic, Hebrew) size-l Large change (250-1000 lines) size-xl Extra large change (> 1000 lines) testing Test coverage translation Translation updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants