Skip to content

Commit fed497f

Browse files
Copilotpethers
andauthored
fix: address review 4139493870 — remove XXX placeholders + support custom elements in leakage scanner
- cross-reference-map.md: drop "Stage 1: Government Proposition" subgraph containing `Prop 2025/26:XXX` placeholders (real IDs are not reliably linked in the betänkande payloads). Added an explanatory note; pipeline now starts at the committee-report stage. PR description's "0 AI_MUST_REPLACE markers" claim is now accurate. - scripts/detect-swedish-leakage.ts: `parseTagAt` tag-name regex now accepts `-` and `:` so custom/hyphenated elements such as `<my-component lang="sv">` are correctly recognised and depth-tracked by `stripLangTaggedBlocks`. - Added regression test for custom-element suppression. 39/39 leakage tests pass, 35/35 analysis-quality tests pass. Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/5f3e3f35-8c48-4e67-9f48-2b63c5ef592d Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
1 parent b5d9646 commit fed497f

3 files changed

Lines changed: 19 additions & 22 deletions

File tree

analysis/daily/2026-04-20/committeeReports/cross-reference-map.md

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,45 +100,29 @@ mindmap
100100
```mermaid
101101
graph TB
102102
subgraph "📋 Legislative Pipeline — Committee Reports 2026-04-20"
103-
subgraph "Stage 1: Government Proposition"
104-
P1["Prop 2025/26:XXX<br/>(KU33 underlying prop)"]
105-
P2["Prop 2025/26:XXX<br/>(KU32 underlying prop)"]
106-
P3["Prop 2025/26:XXX<br/>(CU27 underlying prop)"]
107-
P4["Prop 2025/26:XXX<br/>(CU28 underlying prop)"]
108-
P5["Prop 2025/26:XXX<br/>(CU22 underlying prop)"]
109-
P6["Riksrevisionen report<br/>(CU42 source)"]
110-
end
111-
112-
subgraph "Stage 2: Committee Report (Current)"
103+
subgraph "Stage 1: Committee Report (Current)"
113104
B1["HD01KU33 Betänkande<br/>Vilande first reading ✅"]
114105
B2["HD01KU32 Betänkande<br/>Vilande first reading ✅"]
115106
B3["HD01CU27 Betänkande<br/>Adopted ✅"]
116107
B4["HD01CU28 Betänkande<br/>Adopted ✅"]
117108
B5["HD01CU22 Betänkande<br/>Adopted ✅"]
118109
B6["HD01CU42 Betänkande<br/>SOU referral ✅"]
119110
end
120-
121-
subgraph "Stage 3: Chamber Decision"
111+
112+
subgraph "Stage 2: Chamber Decision"
122113
V1{{"🗳️ 2026 Election<br/>Sept 14"}}
123114
V2["Second reading<br/>(if Tidö wins)"]
124115
E1["Effective July 1, 2026"]
125116
E2["Registry 2029-2030"]
126117
E3["Authority Q1-Q2 2027"]
127118
S1["SOU investigation"]
128119
end
129-
130-
P1 --> B1
131-
P2 --> B2
132-
P3 --> B3
133-
P4 --> B4
134-
P5 --> B5
135-
P6 --> B6
136-
120+
137121
B1 --> V1
138122
B2 --> V1
139123
V1 -->|"Coalition wins"| V2
140124
V1 -->|"S-bloc wins"| X["❌ Blocked"]
141-
125+
142126
B3 --> E1
143127
B4 --> E2
144128
B5 --> E3
@@ -154,6 +138,8 @@ graph TB
154138
style S1 fill:#9E9E9E,color:#FFFFFF
155139
```
156140

141+
> **Note on proposition-stage nodes:** The underlying government propositions that preceded these betänkanden are not included as separate nodes because the specific proposition IDs (`Prop 2025/26:NN`) are not reliably linked from the betänkande payloads retrieved via `get_dokument_innehall`. Upstream proposition provenance is captured in each per-document analysis where the source was identified, and in the `data-download-manifest.md` MCP call trail.
142+
157143
---
158144

159145
## 🗳️ Political Alignment Matrix

scripts/detect-swedish-leakage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ function parseTagAt(html: string, startIndex: number): ParsedTag | null {
255255

256256
const isClosing = inner.startsWith('/');
257257
const nameSource = isClosing ? inner.slice(1).trimStart() : inner;
258-
const nameMatch = /^([a-zA-Z][a-zA-Z0-9]*)/.exec(nameSource);
258+
const nameMatch = /^([a-zA-Z][a-zA-Z0-9:-]*)/.exec(nameSource);
259259
const tagName = nameMatch ? nameMatch[1].toLowerCase() : null;
260260
const isSelfClosing = !isClosing && /\/\s*>$/.test(rawTag);
261261

tests/detect-swedish-leakage.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,5 +337,16 @@ describe('Swedish Leakage Detector', () => {
337337
expect(terms).toContain('utskottet');
338338
expect(terms).toContain('propositionen');
339339
});
340+
341+
it('should strip custom-element (hyphenated) tags with lang="sv"', () => {
342+
// Custom elements have hyphenated tag names (e.g. <my-quote>).
343+
const html =
344+
'<p>Article intro.</p>' +
345+
'<my-quote lang="sv">riksdagen antog propositionen och utskottet</my-quote>' +
346+
'<p>Article continues.</p>';
347+
const report = detectSwedishLeakage(html, 'en');
348+
expect(report.leakedTerms).toEqual([]);
349+
expect(report.score).toBe(0);
350+
});
340351
});
341352
});

0 commit comments

Comments
 (0)