Skip to content

Backfill and translate executive briefs; enforce H1 gate v4.4#2518

Merged
pethers merged 7 commits into
mainfrom
copilot/create-executive-briefs
May 16, 2026
Merged

Backfill and translate executive briefs; enforce H1 gate v4.4#2518
pethers merged 7 commits into
mainfrom
copilot/create-executive-briefs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 16, 2026

Combined executive-brief backfill, translation, and H1 gate rollout

This PR combines three related executive-brief deliverables:

  1. Backfills the missing analysis/daily/2026-05-04/realtime-pulse/executive-brief.md.
  2. Translates the seven canonical analysis/daily/2026-05-15/*/executive-brief.md briefs to English while preserving identifiers, dates, evidence, and audit traceability.
  3. Rolls out executive-brief H1 quality enforcement and the v4.4 template/methodology updates so canonical H1s are publishable before they are reused as <title>, og:title, JSON-LD headline, sitemap cards, RSS metadata, and downstream 14-language surfaces.

Scope

  • Adds TypeScript H1 quality enforcement in scripts/agentic/analysis-gate.ts.
  • Mirrors the H1 checks in .github/prompts/05-analysis-gate.md.
  • Blocks REPLACE THIS H1, Executive Brief Template, AI_MUST_REPLACE, AI-generated political intelligence, and bare Executive Brief headings.
  • Supports both Markdown # ... headings and the template’s centered HTML <h1>...</h1> form.
  • Replaces the prior tag-stripping pattern with safer heading normalization.
  • Adds regression coverage for HTML-H1 template placeholders.
  • Expands analysis/templates/executive-brief.md with the Headline-Candidates worksheet, six-axis BLUF rubric, and expanded 14-language H1 seed guidance.
  • Updates the executive-brief methodology and SEO metadata contract documentation.

Translation and preservation notes

The seven 2026-05-15 executive briefs were translated to English canonical content while preserving every dok_id, percentage, vote count, named MP/minister, and date. Swedish proper nouns and source terms remain where required, including party codes, committee abbreviations, Tidö, riksmöte, Riksdag, agencies, ministry names, Aurora 26, and Riksbank.

Quoted Swedish source phrases are retained in italics with English translation alongside for audit traceability. Markdown structure, Mermaid graph topology, evidence tables, and retrofit notes are preserved.

@github-actions github-actions Bot added documentation Documentation updates size-m Medium change (50-250 lines) labels May 16, 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,size-m

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

Copilot AI requested a review from pethers May 16, 2026 08:54
@github-actions github-actions Bot added the size-l Large change (250-1000 lines) label May 16, 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

@github-actions github-actions Bot added testing Test coverage refactor Code refactoring labels May 16, 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

Comment thread scripts/agentic/analysis-gate.ts Fixed
@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 16, 2026 10:15
Copilot AI review requested due to automatic review settings May 16, 2026 10:15
@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

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 combines three deliverables under one branch: (1) translating the seven 2026-05-15 executive briefs from Swedish to English so the canonical executive-brief.md H1 ships as the SERP <title>/og:title/JSON-LD headline across all 14 languages, (2) back-filling a missing analysis/daily/2026-05-04/realtime-pulse/executive-brief.md, and (3) introducing a new H1-quality gate (TypeScript + bash) that blocks template placeholders (REPLACE THIS H1, Executive Brief Template, AI_MUST_REPLACE, AI-generated political intelligence, and bare # Executive Brief), plus a v4.4 template rewrite (Headline-Candidates worksheet, 6-axis BLUF rubric, expanded 14-language seeds) and updated methodology / SEO contract docs.

Changes:

  • Add H1 quality enforcement in checkExecutiveBrief() (TS) and the inline bash gate, with 4 new placeholder patterns + bare-boilerplate detection and 5 new vitest cases.
  • Translate 7 × 2026-05-15 executive briefs to English (proper nouns preserved, retrofit notes appended) and backfill 2026-05-04/realtime-pulse/executive-brief.md.
  • Expand executive-brief.md template, per-artifact-methodologies.md, and seo-metadata-contract.md with the rubric/worksheet/14-language guidance and refresh the test seed H1.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/agentic/analysis-gate.ts Adds H1 placeholder/banned-phrase/bare-boilerplate checks to checkExecutiveBrief().
tests/agentic-analysis-gate.test.ts Updates valid-seed H1 and adds 4 new failure-mode cases + 1 emoji-tolerance case.
.github/prompts/05-analysis-gate.md Mirrors the TS H1 scan in inline bash; expands Check 7 rule text.
.github/prompts/seo-metadata-contract.md Cross-links the methodology and adds rubric / worksheet / nb checklist items.
analysis/methodologies/per-artifact-methodologies.md Adds an authoritative executive-brief ⭐ section.
analysis/templates/executive-brief.md Template v4.4: explicit placeholder H1, BLUF rubric, Headline-Candidates worksheet, expanded SEO seeds, self-audit additions.
analysis/daily/2026-05-15/committeeReports/executive-brief.md English H1 + Mermaid labels + retrofit note.
analysis/daily/2026-05-15/evening-analysis/executive-brief.md Full Swedish→English translation, new BLUF section, retrofit note.
analysis/daily/2026-05-15/interpellations/executive-brief.md Story-anchored H1, table/timeline/risk translation, retrofit note.
analysis/daily/2026-05-15/motions/executive-brief.md Glosses betänkanden / Lagrådet; retrofit note.
analysis/daily/2026-05-15/propositions/executive-brief.md Full translation + retrofit note.
analysis/daily/2026-05-15/realtime-pulse/executive-brief.md Full translation, Mermaid relabel, retrofit note.
analysis/daily/2026-05-15/week-ahead/executive-brief.md English renderings of two source quotes with Swedish kept in italics.
analysis/daily/2026-05-04/realtime-pulse/executive-brief.md New backfilled brief synthesised from existing Pass-2 artefacts.

Comment thread scripts/agentic/analysis-gate.ts Outdated
Comment on lines +656 to +662
const h1Match = content.match(/^#\s+(.+?)\s*$/m);
if (h1Match) {
const h1 = h1Match[1]
// Strip <p align="center"> / <h1 align="center"> wrappers (the
// template uses <h1 align="center">…</h1>; we extract the inner
// text in the fallback regex below). Markdown H1 is the primary
// path so this branch is mostly defensive.
Comment on lines +180 to +203
EB_H1="$(grep -m1 -E '^#[[:space:]]+' "$ANALYSIS_DIR/executive-brief.md" || true)"
if [ -n "$EB_H1" ]; then
EB_H1_LOWER="$(printf '%s' "$EB_H1" | tr '[:upper:]' '[:lower:]')"
case "$EB_H1_LOWER" in
*replace\ this\ h1*|*replace*this*h1*)
echo "❌ executive-brief.md: H1 still contains 'REPLACE THIS H1' placeholder — write a story-oriented publishable title (see methodology #executive-brief)"; FAIL=1 ;;
*executive\ brief\ template*)
echo "❌ executive-brief.md: H1 still says 'Executive Brief Template' — replace with a publishable title"; FAIL=1 ;;
*ai_must_replace*|*ai-must-replace*)
echo "❌ executive-brief.md: H1 contains AI_MUST_REPLACE stub marker"; FAIL=1 ;;
*ai-generated\ political\ intelligence*)
echo "❌ executive-brief.md: H1 contains banned phrase 'AI-generated political intelligence'"; FAIL=1 ;;
esac
# Strip leading H1 marker + emoji/whitespace + trailing dashes to detect
# the bare-boilerplate `# Executive Brief` case.
EB_H1_PLAIN="$(printf '%s' "$EB_H1_LOWER" \
| sed -E 's/^#[[:space:]]+//' \
| sed -E 's/^[^[:alnum:]]+//' \
| sed -E 's/[[:space:]—–-]+$//')"
if [ "$EB_H1_PLAIN" = "executive brief" ] || [ -z "$EB_H1_PLAIN" ]; then
echo "❌ executive-brief.md: H1 is bare boilerplate ('Executive Brief') — write a publishable story-oriented title (actor + active verb + instrument or number)"
FAIL=1
fi
fi
Comment on lines +654 to +707
// H1 quality check — block the template-placeholder and boilerplate-only
// headings that would ship as the SERP <title>.
const h1Match = content.match(/^#\s+(.+?)\s*$/m);
if (h1Match) {
const h1 = h1Match[1]
// Strip <p align="center"> / <h1 align="center"> wrappers (the
// template uses <h1 align="center">…</h1>; we extract the inner
// text in the fallback regex below). Markdown H1 is the primary
// path so this branch is mostly defensive.
.replace(/<[^>]+>/g, '')
.trim();
const h1Lower = h1.toLowerCase();
// Patterns that indicate the editor did not replace the template H1.
const placeholderPatterns: ReadonlyArray<{ pattern: RegExp; label: string }> = [
{ pattern: /replace\s*this\s*h1/i, label: "literal 'REPLACE THIS H1' placeholder" },
{ pattern: /executive\s+brief\s+template/i, label: "'Executive Brief Template' template heading" },
{ pattern: /ai[_\s-]*must[_\s-]*replace/i, label: "'AI_MUST_REPLACE' stub marker" },
{ pattern: /ai-generated\s+political\s+intelligence/i, label: "banned phrase 'AI-generated political intelligence'" },
];
for (const { pattern, label } of placeholderPatterns) {
if (pattern.test(h1)) {
results.push({
checkId: 'family-c-structure',
passed: false,
message: `executive-brief.md: H1 still contains ${label} — replace with a story-oriented publishable title (see methodology #executive-brief)`,
artifact: 'executive-brief.md',
});
}
}
// Bare-boilerplate H1: just "Executive Brief" (optionally with
// emoji / leading icon). `cleanArticleTitle()` strips the
// `Executive Brief — ` prefix and trailing date; if the H1 is
// literally just `Executive Brief`, nothing remains and the
// renderer falls back to `titleFromBluf()`.
const h1Plain = h1Lower
.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s—–-]+/u, '')
.replace(/[\s—–-]+$/u, '')
.trim();
if (h1Plain === 'executive brief' || h1Plain === '') {
results.push({
checkId: 'family-c-structure',
passed: false,
message:
"executive-brief.md: H1 is bare boilerplate ('Executive Brief') — write a publishable story-oriented title (55–70 chars EN, actor + active verb + instrument or number)",
artifact: 'executive-brief.md',
});
}
}

if (
hasBluf &&
hasDecisions &&
results.filter((r) => !r.passed && r.artifact === 'executive-brief.md').length === 0
) {
@pethers
Copy link
Copy Markdown
Member

pethers commented May 16, 2026

@copilot apply changes based on the comments in this thread

@pethers pethers changed the title Backfill missing executive-brief for 2026-05-04/realtime-pulse Backfill and translate executive briefs; enforce H1 gate v4.4 May 16, 2026
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 16, 2026

@copilot apply changes based on the comments in this thread

Implemented the requested review follow-up in ebc7aae: the TS and bash H1 gates now fall back to HTML <h1> headings, the CodeQL-flagged tag-stripping pattern was replaced, regression coverage was added for the HTML template placeholder, and the PR title/description now reflect the combined scope.

@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 merged commit ef7db66 into main May 16, 2026
19 checks passed
@pethers pethers deleted the copilot/create-executive-briefs branch May 16, 2026 10:48
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) size-m Medium change (50-250 lines) testing Test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants