Skip to content

Improve political analysis methods, AI prompts, and news quality#930

Merged
pethers merged 17 commits intomainfrom
copilot/improve-political-analysis-methods
Apr 3, 2026
Merged

Improve political analysis methods, AI prompts, and news quality#930
pethers merged 17 commits intomainfrom
copilot/improve-political-analysis-methods

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

Replaces [AI_ANALYSIS_REQUIRED] placeholders with deterministic, data-driven political analysis text, improves placeholder handling in rendered HTML/CSS, tightens workflow quality gates, and fixes i18n/a11y issues for non-English articles.

Changes Made

  • Data-driven analysis builders: All 5 builders (voting, prospective, breaking, propositions, committee) now generate concrete narrative text for why, impact assessment, outlook, stakeholder reasoning, consequences, and mistakes instead of [AI_ANALYSIS_REQUIRED] markers.
  • AI-pending rendering: Added isAiMarker() + AI_PENDING_CLASS rendering path to show styled "analysis pending" notices instead of raw markers, with corresponding CSS styling that correctly distinguishes inline (em.ai-analysis-pending) from block-level container styles to avoid duplicated hourglass icons.
  • Placeholder/SEO filtering: Filtered placeholder and fallback strings out of SEO keywords using isPlaceholderText(). All keyword builders (weekly-review, motions, monthly-review) now filter-then-slice (instead of slice-then-filter) to reliably include up to N real keywords.
  • Vote margin handling: deriveConsequencesFromVoting() uses Math.abs(margin) for size buckets and includes direction ("majority in favour" vs "majority against") so consequences read correctly for both adopted and rejected results. Extracted describeVoteMargin() helper that handles tied votes (margin === 0) explicitly as "tied vote with no clear majority" and includes direction for all margin buckets including narrow. Severity classification is now bidirectional, using Math.abs(votesFor - votesAgainst) > totalVotes / 2 so strong majorities against are also classified as high.
  • i18n fixes: Breaking and committee strategies now pass contentLang='en' to buildDeepAnalysisSection() so English analysis text gets correct lang attributes in non-English articles. SWOT empty quadrant fallback uses language-neutral ellipsis instead of hard-coded English.
  • Localized AI-pending notices: All 7 hard-coded English AI-pending notice strings in deep-analysis-content.ts (why, stakeholder, impact, consequences, mistakes/alternatives, outlook, and stakeholder perspectives sections) are now localized via a new pendingNotice field in DEEP_ANALYSIS_STRINGS with translations for all 14 supported languages. Non-English articles no longer display English-only fallback notices when AI markers slip through.
  • Accessibility: SWOT empty-quadrant fallback now includes aria-label="No items available" so screen readers announce the empty state meaningfully instead of reading punctuation.
  • RTL support: Added [dir='rtl'] CSS overrides for .ai-analysis-pending block containers, swapping border-leftborder-right, padding-leftpadding-right, and repositioning the hourglass icon. Uses individual border properties (width/style/color) instead of shorthand to preserve dark-mode RTL border-right-color override specificity.
  • Dark theme toggle support: Added explicit html[data-theme='dark'] overrides for AI pending indicators (border color, text muted color, impact-card background, and RTL equivalents) and D3 visualization backgrounds/text fills, so manual dark-mode toggle works correctly regardless of OS color scheme preference.
  • CSS cleanup: Removed duplicate .dashboard-panel / .dashboard-panel:hover rules that were overriding the main dashboard styles, unintentionally removing the transform transition and changing hover shadow values.
  • Workflow quality gates: Expanded methodology and checklists to prevent placeholder metadata and silent zero-metrics from shipping. Placeholder-keywords quality gate now scopes checks to <meta name="keywords"> content only (not the full HTML body) to avoid false positives on legitimate body text. Fixed over-escaped bash quoting in the meta-keywords extraction snippet.

Testing

  • ✅ TypeScript compilation passes
  • ✅ ESLint passes (0 errors, 110 warnings)
  • ✅ 2724 tests passing
  • ✅ Prettier formatting clean
  • ✅ CodeQL security scan clean

Copilot AI and others added 5 commits April 3, 2026 16:16
- Filter placeholder/fallback text from article meta keywords in motions,
  weekly-review, and monthly-review strategies to prevent contamination
- Render [AI_ANALYSIS_REQUIRED] markers as user-friendly "analysis pending"
  notices in deep-analysis-content.ts instead of raw marker strings
- Add isAiMarker() helper and aiPendingNotice() to analysis-constants.ts
- Add AI_PENDING_CLASS CSS class for styling pending analysis sections

Agent-Logs-Url: https://github.com/Hack23/euparliamentmonitor/sessions/2ba3bb30-556b-4af8-974b-df5237aeb020

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
… gates

- Add 5 new quality issues to Top 15 in ai-driven-analysis-guide.md
- Add visualization data generation rules (Chart.js, D3, SWOT completeness)
- Add AI-first content generation protocol with field-by-field requirements
- Add article-analysis cross-reference requirements
- Add placeholder keyword and zero metrics gates to all 9 workflow files
- Add visualization completeness gates to all 9 workflow files
- Update guide version to 4.0

Agent-Logs-Url: https://github.com/Hack23/euparliamentmonitor/sessions/2ba3bb30-556b-4af8-974b-df5237aeb020

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…prove SWOT empty states

- Add CSS for .ai-analysis-pending indicators with orange border and clock icon
- Add CSS for D3 treemap, network, and SWOT chart wrappers with dark mode
- Add dashboard chart hover effects and styling
- Improve SWOT empty quadrant messages with informative AI-pending notice
- All 2724 tests passing

Agent-Logs-Url: https://github.com/Hack23/euparliamentmonitor/sessions/2ba3bb30-556b-4af8-974b-df5237aeb020

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…rove JSDoc

- Move isPlaceholderText() from 3 strategy files to shared analysis-constants.ts
- Improve isAiMarker() JSDoc with legacy marker format documentation
- Inline AI_PENDING_OPEN constant into aiPendingNotice() function
- All 2724 tests passing, 0 lint errors

Agent-Logs-Url: https://github.com/Hack23/euparliamentmonitor/sessions/2ba3bb30-556b-4af8-974b-df5237aeb020

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…terns

- Use character class [\\s._-] instead of literal dot for matching
  "data unavailable" variants in TypeScript and shell grep patterns
- Update JSDoc to document all matched separator patterns
- All 2724 tests passing

Agent-Logs-Url: https://github.com/Hack23/euparliamentmonitor/sessions/2ba3bb30-556b-4af8-974b-df5237aeb020

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions github-actions bot added documentation Documentation updates infrastructure CI/CD and build infrastructure github_actions GitHub Actions updates ui User interface improvements design Design and styling updates needs-tests Needs test coverage workflows GitHub workflows scripts Scripts and automation labels Apr 3, 2026
Copilot AI requested a review from pethers April 3, 2026 16:34
Replace [AI_ANALYSIS_REQUIRED] placeholder markers with factual, data-driven
content generation across all 5 analysis builders:

- buildVotingAnalysis: why, impact assessment (5 dimensions), outlook now
  generate contextual text from voting patterns, polarization, anomalies
- buildProspectiveAnalysis: why, impact, consequences, mistakes, outlook
  all generate from event/committee/pipeline/bottleneck data
- buildBreakingAnalysis: why, impact, consequences, mistakes, outlook
  generate from feed data (adopted texts, events, procedures, MEPs)
- buildPropositionsAnalysis: why, impact, consequences, outlook, mistakes
  generate from pipeline health score and throughput metrics
- buildCommitteeAnalysis: why, impact, consequences, mistakes, outlook
  generate from committee activity rates, document counts, member data
- buildDefaultStakeholderPerspectives: reasoning now generates per-group
  factual descriptions instead of AI_MARKER (6 stakeholders × all articles)

This eliminates ~52 [AI_ANALYSIS_REQUIRED] placeholders per article run,
producing articles with complete analytical content from the start.

Updated 10 test assertions from AI_MARKER expectations to data-driven
content expectations. All 2724 tests passing.

Agent-Logs-Url: https://github.com/Hack23/euparliamentmonitor/sessions/bcd58788-c318-483d-9cec-161b7b21f8d4

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions github-actions bot added testing Testing improvements test-coverage-impact Impacts test coverage labels Apr 3, 2026
@pethers pethers marked this pull request as ready for review April 3, 2026 17:20
@pethers pethers requested a review from Copilot April 3, 2026 17:21
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 replaces several [AI_ANALYSIS_REQUIRED] placeholders with deterministic, data-driven political analysis text, improves placeholder handling in rendered HTML/CSS, and tightens workflow quality gates to prevent placeholder metadata and silent zero-metrics from shipping.

Changes:

  • Replaced AI marker placeholders in analysis builders and stakeholder perspectives with data-derived narrative text (why/impact/outlook/consequences/mistakes).
  • Added isAiMarker() + AI_PENDING_CLASS rendering path to show “analysis pending” notices instead of raw markers, plus corresponding CSS styling.
  • Filtered placeholder/fallback strings out of SEO keywords and expanded workflow methodology + checklists/quality gates.

Reviewed changes

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

Show a summary per file
File Description
test/unit/deep-analysis.test.js Updates assertions to expect data-driven analysis text instead of AI markers.
styles.css Adds .ai-analysis-pending styling and additional visualization container styles.
src/utils/intelligence-analysis.ts Replaces default stakeholder reasoning markers with deterministic reasoning text.
src/generators/swot-content.ts Replaces empty SWOT fallback “—” with an editorial/AI pending notice.
src/generators/strategies/weekly-review-strategy.ts Filters placeholder titles/types/topics out of generated meta keywords.
src/generators/strategies/motions-strategy.ts Filters placeholder titles/types/topics out of generated meta keywords.
src/generators/strategies/monthly-review-strategy.ts Filters placeholder titles/types/topics out of generated meta keywords.
src/generators/deep-analysis-content.ts Adds AI-marker detection to render “pending” notices instead of raw marker text.
src/generators/analysis-builders.ts Replaces AI markers with computed “why/impact/outlook/consequence/mistake” text across strategies.
src/constants/analysis-constants.ts Adds isAiMarker(), AI_PENDING_CLASS, and isPlaceholderText() helpers.
scripts/utils/intelligence-analysis.js Compiled output reflecting TS stakeholder reasoning changes.
scripts/generators/swot-content.js Compiled output reflecting SWOT empty-state text change.
scripts/generators/strategies/weekly-review-strategy.js Compiled output reflecting keyword placeholder filtering.
scripts/generators/strategies/motions-strategy.js Compiled output reflecting keyword placeholder filtering.
scripts/generators/strategies/monthly-review-strategy.js Compiled output reflecting keyword placeholder filtering.
scripts/generators/deep-analysis-content.js Compiled output reflecting AI-pending rendering changes.
scripts/generators/analysis-builders.js Compiled output reflecting data-driven analysis builder changes.
scripts/constants/analysis-constants.js Compiled output reflecting new marker/placeholder helpers.
analysis/methodologies/ai-driven-analysis-guide.md Updates methodology doc to v4.0, expands quality issues and adds new quality gates.
.github/workflows/news-weekly-review.md Adds checklist items for placeholder keywords and silent zero metrics + viz completeness requirements.
.github/workflows/news-week-ahead.md Adds checklist items for placeholder keywords and silent zero metrics + viz completeness requirements.
.github/workflows/news-propositions.md Adds checklist items for placeholder keywords and silent zero metrics + viz completeness requirements.
.github/workflows/news-motions.md Adds checklist items for placeholder keywords and silent zero metrics + viz completeness requirements.
.github/workflows/news-monthly-review.md Adds checklist items for placeholder keywords and silent zero metrics + viz completeness requirements.
.github/workflows/news-month-ahead.md Adds checklist items for placeholder keywords and silent zero metrics + viz completeness requirements.
.github/workflows/news-committee-reports.md Adds checklist items for placeholder keywords and silent zero metrics + viz completeness requirements.
.github/workflows/news-breaking.md Adds checklist items for placeholder keywords and silent zero metrics + viz completeness requirements.
.github/workflows/news-article-generator.md Adds checklist items for placeholder keywords and silent zero metrics + viz completeness requirements.

Comment on lines +50 to +52
function aiPendingNotice(message: string): string {
return `<em class="${AI_PENDING_CLASS}">${escapeHTML(message)}</em>`;
}
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

aiPendingNotice() returns an that already has AI_PENDING_CLASS, but callers also add AI_PENDING_CLASS to parent

/

/. Because .ai-analysis-pending adds border-left + ::before hourglass, this results in duplicated icons/borders (nested pending markers) and also applies block-style UI chrome to inline inside tables/lists. Consider returning a plain without the pending class (or use a separate inline-only class), and keep AI_PENDING_CLASS only on the outer block-level container that should show the indicator.

Copilot uses AI. Check for mistakes.
Comment on lines 140 to 145
const margin = record.votes.for - record.votes.against;
const marginDesc = margin > 100 ? 'strong majority' : margin > 30 ? 'moderate majority' : 'narrow margin';
consequences.push({
action: `Vote on "${record.title}"`,
consequence: AI_MARKER,
consequence: `${record.result} by ${marginDesc} (${record.votes.for} for, ${record.votes.against} against, ${record.votes.abstain} abstentions). This outcome shapes the legislative trajectory of this policy area.`,
severity: record.votes.for > record.votes.against * 2 ? 'high' : 'medium',
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

deriveConsequencesFromVoting() computes marginDesc from votes.for - votes.against but doesn't handle rejected votes: negative margins will always fall into the “narrow margin” bucket, and the wording always implies a majority in favour. Consider using Math.abs(margin) for the size bucket and include the direction (e.g., majority for vs majority against) so consequences read correctly for both adopted and rejected results.

Copilot uses AI. Check for mistakes.
Comment on lines 100 to 104
outcomes.push({
actor: pattern.group,
outcome: 'winner',
reason: AI_MARKER,
reason: `${pattern.group} demonstrated strong internal cohesion (${(pattern.cohesion * 100).toFixed(0)}%) with high participation (${(pattern.participation * 100).toFixed(0)}%), enabling effective bloc voting.`,
});
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The JSDoc for deriveStakeholderOutcomesFromVoting() still says “Reasoning text is deferred to the AI agent”, but the function now generates concrete reason strings. Please update the comment to reflect the current behavior so future readers don’t assume outcomes contain AI markers.

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

pethers commented Apr 3, 2026

@copilot apply changes based on the comments in this thread and failing checks
Test and Report / Validate Code (pull_request)
Test and Report / Validate Code (pull_request)Failing after 53s

…ss, Prettier

- Fix deriveConsequencesFromVoting(): use Math.abs(margin) for size bucket
  and include direction (majority in favour vs majority against) so
  consequences read correctly for both adopted and rejected votes
- Fix JSDoc for deriveStakeholderOutcomesFromVoting(): update comment to
  reflect that function now generates concrete reason strings
- Fix double AI_PENDING_CLASS: remove redundant class from <p> tags that
  already wrap <em class="ai-analysis-pending"> via aiPendingNotice()
- Fix Prettier formatting in analysis-builders.ts

Agent-Logs-Url: https://github.com/Hack23/euparliamentmonitor/sessions/2367b903-7e00-4047-8365-0095f3c4dc42

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…bash escaping, SWOT a11y

Agent-Logs-Url: https://github.com/Hack23/euparliamentmonitor/sessions/73e967f4-82c8-45a2-8367-cfddf0d20ada

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

Copilot AI commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

All 4 review comments addressed in 045de5f:

  1. Duplicate .dashboard-panel rules — Removed the duplicate block at end of file that was overriding the main rules (removing transform transition and changing hover shadow values).
  2. Bidirectional severityderiveConsequencesFromVoting() now uses Math.abs(votesFor - votesAgainst) > totalVotes / 2 so strong majorities against are also classified as high severity.
  3. Bash escaping — Replaced over-escaped quotes with proper '"'"' shell quoting pattern in the meta-keywords quality gate.
  4. SWOT empty-quadrant a11y — Added aria-label="No items available" to the empty <li> fallback so screen readers announce the empty state meaningfully.

Build ✅, lint ✅ (0 errors), 2724 tests passing ✅, Prettier ✅, CodeQL ✅.

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

Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.

Comment on lines +5198 to +5206
/* RTL overrides for AI pending indicators */
[dir='rtl'] div.ai-analysis-pending,
[dir='rtl'] section.ai-analysis-pending {
border-left: none;
border-right-width: 3px;
border-right-style: solid;
border-right-color: var(--accent-warning, #fd7e14);
padding-left: 0;
padding-right: 0.75rem;
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

In RTL mode the border-right-color here is always set to --accent-warning (light-mode value). Because this rule comes after the dark-mode @media (prefers-color-scheme: dark) override, it will override the intended --accent-warning-dark color and render the pending indicator border with the wrong color in dark+RTL. Consider overriding border-right-color inside the dark-mode media query after this rule (or moving the dark RTL override below), so dark+RTL uses --accent-warning-dark while still reusing the shared width/style properties.

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

pethers commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

Fixed in a511bc1. Added a @media (prefers-color-scheme: dark) block after the RTL rules that overrides border-right-color to var(--accent-warning-dark, #e08c00), so dark+RTL uses the correct dark palette instead of the light-mode value from the preceding RTL rule.

Build ✅, lint ✅ (0 errors), 2724 tests ✅.

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

Copilot reviewed 33 out of 33 changed files in this pull request and generated 2 comments.

Comment on lines +5175 to +5186
/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
div.ai-analysis-pending,
section.ai-analysis-pending {
border-left-color: var(--accent-warning-dark, #e08c00);
}

[dir='rtl'] div.ai-analysis-pending,
[dir='rtl'] section.ai-analysis-pending {
border-left-color: initial;
border-right-color: var(--accent-warning-dark, #e08c00);
}
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

AI pending styles only switch to dark colors inside @media (prefers-color-scheme: dark). When the user explicitly toggles dark theme via html[data-theme='dark'] (with a light OS preference), these rules won’t apply and the pending UI falls back to light-mode colors (e.g. --surface-muted#f8f9fa). Add explicit html[data-theme='dark'] overrides (and RTL equivalents) mirroring the media-query block so manual dark mode renders correctly.

Copilot uses AI. Check for mistakes.
Comment on lines +5241 to +5252
@media (prefers-color-scheme: dark) {
.d3-treemap-wrapper svg,
.d3-network-wrapper svg,
.d3-swot-chart-wrapper svg {
background: var(--surface-muted-dark, #161b22);
}

.d3-swot-chart-wrapper text,
.d3-network-wrapper text {
fill: #c9d1d9 !important;
}
}
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The new D3 visualization background overrides are only applied via @media (prefers-color-scheme: dark). If the site is in explicit dark mode (html[data-theme='dark']) while the OS preference is light, the SVG background will remain the light fallback (#f8f9fa). Add html[data-theme='dark'] overrides for these selectors (and consider RTL if relevant) to keep theme-toggle behavior consistent.

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

pethers commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

Both review comments addressed in 0f57e05:

  1. AI pending styles — Added html[data-theme='dark'] overrides mirroring the @media (prefers-color-scheme: dark) block: border-left-color, text muted color, impact-card background, and RTL equivalents.
  2. D3 visualization backgrounds — Added html[data-theme='dark'] overrides for SVG backgrounds and text fill, so explicit dark-mode toggle works correctly regardless of OS preference.

Build ✅, lint ✅ (0 errors), 2724 tests ✅.

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

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

Comment on lines +129 to +134
if (isAiMarker(why)) {
return `
<div class="analysis-why ${AI_PENDING_CLASS}">
<h3>${escapeHTML(heading)}</h3>
<p${langAttr}>${aiPendingNotice('AI political analysis pending — this section will be completed by the editorial intelligence workflow.')}</p>
</div>`;
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This AI-pending message is hard-coded in English. The rest of this module localizes user-visible strings via getLocalizedString(DEEP_ANALYSIS_STRINGS, lang), so this notice should be moved into the localized strings table (or otherwise localized) to avoid English-only UI in non-English articles.

Copilot uses AI. Check for mistakes.
Comment on lines +198 to +205
.map((s) => {
const reasonText = isAiMarker(s.reason)
? aiPendingNotice('AI stakeholder analysis pending.')
: escapeHTML(s.reason);
return (
`<li class="stakeholder-item ${outcomeClass(s.outcome)}">` +
`<span class="stakeholder-badge">${escapeHTML(outcomeLabel(s.outcome, strings))}</span> ` +
`<span${contentLangAttr}><strong>${escapeHTML(s.actor)}</strong>: ${escapeHTML(s.reason)}</span>` +
`<span${contentLangAttr}><strong>${escapeHTML(s.actor)}</strong>: ${reasonText}</span>` +
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This AI-pending message ("AI stakeholder analysis pending.") is hard-coded in English. Please localize it similarly to other deep-analysis UI strings (getLocalizedString(DEEP_ANALYSIS_STRINGS, lang)) so non-English pages don’t have English-only notices.

Copilot uses AI. Check for mistakes.
Comment on lines +255 to +262
.map((p) => {
if (isAiMarker(p.text)) {
return (
`<div class="impact-card ${p.css} ${AI_PENDING_CLASS}">` +
`<h4>${escapeHTML(p.label)}</h4>` +
`<p${langAttr}>${aiPendingNotice('AI impact analysis pending.')}</p>` +
`</div>`
);
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The impact-card AI-pending notice text is hard-coded in English. Since deep-analysis headings/labels are localized, this pending notice should also be localized (added to DEEP_ANALYSIS_STRINGS) to keep UI language consistent.

Copilot uses AI. Check for mistakes.
Comment on lines +349 to +357
.map((item) => {
const consequenceText = isAiMarker(item.consequence)
? aiPendingNotice('AI consequence analysis pending.')
: escapeHTML(item.consequence);
return (
`<tr class="consequence-row severity-${escapeHTML(item.severity)}">` +
`<td class="action-cell"${langAttr}>${escapeHTML(item.action)}</td>` +
`<td class="arrow-cell">→</td>` +
`<td class="consequence-cell"${langAttr}>${escapeHTML(item.consequence)}</td>` +
`<td class="consequence-cell"${langAttr}>${consequenceText}</td>` +
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This AI-pending consequence notice text is hard-coded in English. Please localize it alongside the other DEEP_ANALYSIS_STRINGS content so non-English articles remain fully localized when placeholders slip through.

Copilot uses AI. Check for mistakes.
Comment on lines +400 to +408
.map((m) => {
const altText = isAiMarker(m.alternative)
? aiPendingNotice('AI alternative analysis pending.')
: escapeHTML(m.alternative);
return (
`<div class="mistake-card">` +
`<p class="mistake-actor"><strong>${escapeHTML(m.actor)}</strong></p>` +
`<p class="mistake-description"${langAttr}>${escapeHTML(m.description)}</p>` +
`<p class="mistake-alternative"><em>${escapeHTML(alternativeLabel)}:</em> <span${langAttr}>${escapeHTML(m.alternative)}</span></p>` +
`<p class="mistake-alternative"><em>${escapeHTML(alternativeLabel)}:</em> <span${langAttr}>${altText}</span></p>` +
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This AI-pending alternative notice text is hard-coded in English. Please localize it using the same pattern as other deep-analysis strings so non-English pages don’t render English-only fallback notices.

Copilot uses AI. Check for mistakes.
Comment on lines +431 to +436
if (isAiMarker(outlook)) {
return `
<div class="analysis-outlook ${AI_PENDING_CLASS}">
<h3>${escapeHTML(heading)}</h3>
<p${langAttr}>${aiPendingNotice('AI strategic outlook pending — this section will be completed by the editorial intelligence workflow.')}</p>
</div>`;
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The outlook AI-pending message is hard-coded in English. This should be localized (e.g., via DEEP_ANALYSIS_STRINGS) to keep the deep-analysis section consistent with the selected UI language.

Copilot uses AI. Check for mistakes.
Comment on lines 891 to 895
`<span class="perspective-impact-badge perspective-impact-${escapeHTML(p.impact)}">${escapeHTML(localizedImpactLabel(p.impact, strings))}</span>` +
`<span class="perspective-severity-badge severity-${escapeHTML(p.severity)}">${escapeHTML(localizedSeverityLabel(p.severity, strings))}</span>` +
`</div>` +
`<p class="perspective-reasoning"${langAttr}>${escapeHTML(p.reasoning)}</p>` +
`<p class="perspective-reasoning"${langAttr}>${isAiMarker(p.reasoning) ? aiPendingNotice('AI stakeholder perspective analysis pending.') : escapeHTML(p.reasoning)}</p>` +
evidenceHtml +
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The stakeholder perspective AI-pending notice is hard-coded in English. Please move this string into the localized deep-analysis strings so non-English pages don’t display English-only fallback messages.

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

pethers commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

…t.ts

Add pendingNotice field to DeepAnalysisStrings interface with translations
for all 14 languages. Replace 7 hard-coded English AI-pending messages in
buildWhySection, buildStakeholderSection, buildImpactSection,
buildConsequencesSection, buildMistakesSection, buildOutlookSection, and
buildStakeholderPerspectivesSection with localized strings from
DEEP_ANALYSIS_STRINGS.

Agent-Logs-Url: https://github.com/Hack23/euparliamentmonitor/sessions/18aad81f-ec92-4225-bbde-e50bedfd975e

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

Copilot AI commented Apr 3, 2026

@copilot apply changes based on the comments in this thread

All 7 review comments addressed in eefad97:

Added pendingNotice field to DeepAnalysisStrings interface with translations for all 14 languages. All 7 hard-coded English AI-pending messages in buildWhySection, buildStakeholderSection, buildImpactSection, buildConsequencesSection, buildMistakesSection, buildOutlookSection, and buildStakeholderPerspectivesSection now use strings.pendingNotice from DEEP_ANALYSIS_STRINGS.

Build ✅, lint ✅ (0 errors), 2724 tests ✅, Prettier ✅, CodeQL ✅.

@pethers pethers merged commit e23ee1d into main Apr 3, 2026
15 checks passed
@pethers pethers deleted the copilot/improve-political-analysis-methods branch April 3, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

design Design and styling updates documentation Documentation updates github_actions GitHub Actions updates infrastructure CI/CD and build infrastructure needs-tests Needs test coverage scripts Scripts and automation test-coverage-impact Impacts test coverage testing Testing improvements ui User interface improvements workflows GitHub workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants