Conversation
🏷️ Automatic Labeling SummaryThis PR has been automatically labeled based on the files changed and PR metadata. Applied Labels: size-xs Label Categories
For more information, see |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…dictionary, workflow update Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/b182ac4a-002b-47f8-9b70-bf0a7c41f4b8 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
| } catch { | ||
| return null; |
There was a problem hiding this comment.
checkFileForAIMustReplaceMarkers() swallows read/parse errors (catch { return null; }), which can silently skip AI_MUST_REPLACE validation if a file is unreadable. This is inconsistent with checkFileForUntranslatedContent() (which surfaces errors) and can let CI pass when it should fail; treat read errors as hard failures and report them in the summary/output.
| } catch { | |
| return null; | |
| } catch (error: unknown) { | |
| const message = error instanceof Error ? error.message : String(error); | |
| throw new Error(`Failed to validate AI_MUST_REPLACE markers in ${filepath}: ${message}`); |
| // AI_MUST_REPLACE marker check — unresolved placeholders in HTML comments | ||
| // are a hard failure: they indicate the AI did not replace template content. | ||
| const aiMarkerRecord = checkFileForAIMustReplaceMarkers(filepath); | ||
| if (aiMarkerRecord) { | ||
| aiMarkerFiles.push(aiMarkerRecord); | ||
| totalAIMarkers += aiMarkerRecord.markerCount; | ||
| const sampleStr = aiMarkerRecord.samples.length > 0 | ||
| ? ` [${aiMarkerRecord.samples.join(', ')}]` | ||
| : ''; | ||
| console.log(`${colors.red}✗ AI_MUST_REPLACE: ${filename} — ${aiMarkerRecord.markerCount} unresolved marker(s)${sampleStr}${colors.reset}`); | ||
| } |
There was a problem hiding this comment.
Files containing AI_MUST_REPLACE markers are still counted as “passed” (totalPassed++) and printed with a green ✓ later in the loop, even though they trigger a hard failure at the end. This makes the per-file status and the “Fully translated” summary inaccurate; consider treating AI marker presence as a per-file failure (or at least excluding these files from totalPassed and reporting them separately).
| 3. **Raw Swedish API text** — Interpellation excerpts, proposition summaries that come from the Riksdag API are often pasted as-is. You MUST translate these to the target language or summarize them. | ||
| 4. **English boilerplate phrases** — Remove or translate phrases like "Read the full proposition", "Live intelligence platform for Swedish Parliament monitoring" | ||
| 5. **Section headings** that were not covered by CONTENT_LABELS (e.g., specific policy domain names used as h3/h4 headings) | ||
| 6. **🚨 AI_MUST_REPLACE HTML comments** — SCAN every HTML comment in the source article. If any contains `AI_MUST_REPLACE`, you MUST generate replacement content in the target language. See critical section below. | ||
|
|
||
| #### 🚨 CRITICAL: AI_MUST_REPLACE Comment Handling | ||
|
|
||
| The content generator embeds placeholder HTML comments in the form: | ||
| ```html | ||
| <!-- AI_MUST_REPLACE: marker_name — DATA: hint text. Write specific analysis here. Output MUST be in the article's language. --> | ||
| ``` | ||
|
|
||
| **These comments MUST be replaced with real content before publication.** Leaving them in the article is a hard CI failure (exit 1). The translation workflow MUST: | ||
|
|
||
| 1. **SCAN every HTML comment** in the translated article for `AI_MUST_REPLACE` | ||
| 2. **For each marker found**, read the `DATA:` hint inside the comment to understand what content to generate | ||
| 3. **Replace the entire `<!-- AI_MUST_REPLACE ... -->` comment** with genuine, specific analysis written in the **target language** (not English) |
There was a problem hiding this comment.
The new checklist item says to scan every HTML comment in the source article for AI_MUST_REPLACE, but the critical section below says to scan the translated article. Please make this consistent (ideally require scanning the translated output, since that’s what CI validates) to avoid operator confusion.
|
@copilot apply changes based on the comments in this thread and Quality Checks / typescript-lint (pull_request) |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…passed count, fix lint, fix prompt consistency Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/ad9025e1-7491-4238-a5bf-98f4704dd8a6 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Applied all review comments and fixed the lint failure in commit 76868ec:
|
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
validate-news-translations.ts— AI_MUST_REPLACE marker detection + CI failure (exit 1)check-banned-patterns.ts— detect AI_MUST_REPLACE markers in HTML comments.github/workflows/news-translate.md— AI_MUST_REPLACE handling instructionsscripts/translation-dictionary.ts— split into 4 domain-specific filescheckFileForAIMustReplaceMarkers()now throws on read errors with{ cause }instead of silently returning nulltotalPassedcount — no longer shown with green ✓outputassignment in testtryblocks (no-useless-assignment)