Commit 7c6aae7
fix: strip erroneous '#kv#' and '#nv#' prefixes from AHB XML attributes during reading (#255)
* chore: bump test data submodule to 2026-03-27 data
including fun like
```xml
<AWF
Pruefidentifikator="#kv# 55038"
Beschreibung="#kv# Info-Meldung zur Aufhebung einer zuk. Zuordnung"
Kommunikation_von="NB an LF"
>
```
* fix: strip erroneous '#kv# ' prefix from AHB XML attributes during reading
The XML authors introduced random "#kv# " prefixes to several attribute
values in the test data submodule. This commit strips these prefixes at
read time in the AhbReader so they never leak into the data model.
Affected XML files and lines (50 total occurrences across 3 files):
UTILMD_AHB_Strom_2_1_Fehlerkorrektur_20260327.xml (FV2604, 24 occurrences):
- Pruefidentifikator: lines 7791, 8189, 8532
- Beschreibung: lines 7792, 8190, 8533, 9803, 10117, 10993, 11856,
12770, 13678, 16282, 16572, 19584, 20069, 20593, 21154, 21760
- Bedingung text: lines 41302, 41369, 41413, 41705, 41724
UTILMD_AHB_Strom_2_1_Fehlerkorrektur_20260327.xml (FV2510, 24 occurrences):
- Pruefidentifikator: lines 7791, 8189, 8532
- Beschreibung: lines 7792, 8190, 8533, 9803, 10117, 10993, 11856,
12770, 13678, 16282, 16572, 19584, 20069, 20593, 21154, 21760
- Bedingung text: lines 41302, 41369, 41413, 41705, 41724
UTILMD_AHB_Strom_2_1_Fehlerkorrektur_20250623.xml (FV2504, 2 occurrences):
- Bedingung text: lines 131688, 131694
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: apply black formatting and extend kv prefix stripping to ub_bedingungen
Apply remove_kv_prefix defensively to _to_ub_bedingung as well, and
extend the integration test to also check ub_bedingungen for leaking
prefixes. Fix black formatting in test file.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: generalize hashtag prefix stripping to handle #nv# in addition to #kv#
Rename remove_kv_prefix to remove_hashtag_prefix and use a regex
(^#\w+# ) to strip any leading '#xx# ' prefix, not just '#kv# '.
Additional '#nv# ' occurrences found in Beschreibung attributes:
UTILMD_AHB_Gas_1_0a_außerordentliche_20240726.xml (FV2504, 2 occurrences):
- Beschreibung: line 22762: `Beschreibung="#nv# Anfrage an MSB mit Abhängig-keiten "`
- Beschreibung: line 43668: `Beschreibung="#nv# Nicht bila.rel. Änderung vom LF "`
UTILMD_AHB_Gas_1_0a_außerordentliche_20240726.xml (FV2410, 2 occurrences):
- Beschreibung: line 22762: `Beschreibung="#nv# Anfrage an MSB mit Abhängig-keiten "`
- Beschreibung: line 43668: `Beschreibung="#nv# Nicht bila.rel. Änderung vom LF "`
UTILMD_AHB_Gas_1_0a_außerordentliche_20240726.xml (FV2510, 2 occurrences):
- Beschreibung: line 22762: `Beschreibung="#nv# Anfrage an MSB mit Abhängig-keiten "`
- Beschreibung: line 43668: `Beschreibung="#nv# Nicht bila.rel. Änderung vom LF "`
UTILMD_AHB_Gas_1_1_Fehlerkorrektur_20260327.xml (FV2604, 2 occurrences):
- Beschreibung: line 22854: `Beschreibung="#nv# Anfrage an MSB mit Abhängig-keiten "`
- Beschreibung: line 43760: `Beschreibung="#nv# Nicht bila.rel. Änderung vom LF "`
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: clarify that remove_hashtag_prefix does not strip ##alt## markers
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* test: add cases ensuring ##alt## and ##veraltet## markers are not stripped
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Konstantin <konstantin.klein+github@hochfrequenz.de>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 23090ef commit 7c6aae7
5 files changed
Lines changed: 84 additions & 12 deletions
File tree
- src/fundamend
- reader
- unittests
- __snapshots__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
| |||
53 | 59 | | |
54 | 60 | | |
55 | 61 | | |
56 | | - | |
| 62 | + | |
57 | 63 | | |
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
63 | | - | |
| 69 | + | |
64 | 70 | | |
65 | 71 | | |
66 | 72 | | |
| |||
208 | 214 | | |
209 | 215 | | |
210 | 216 | | |
211 | | - | |
| 217 | + | |
| 218 | + | |
212 | 219 | | |
213 | | - | |
214 | | - | |
| 220 | + | |
215 | 221 | | |
216 | 222 | | |
217 | 223 | | |
| |||
251 | 257 | | |
252 | 258 | | |
253 | 259 | | |
254 | | - | |
| 260 | + | |
255 | 261 | | |
256 | | - | |
| 262 | + | |
257 | 263 | | |
258 | 264 | | |
259 | 265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
165 | 178 | | |
166 | 179 | | |
167 | 180 | | |
168 | 181 | | |
169 | 182 | | |
| 183 | + | |
170 | 184 | | |
171 | 185 | | |
172 | 186 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
| |||
274 | 272 | | |
275 | 273 | | |
276 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
277 | 278 | | |
278 | 279 | | |
279 | 280 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
131 | 182 | | |
132 | 183 | | |
133 | 184 | | |
| |||
Submodule xml-migs-and-ahbs updated from 9355743 to ab3f81a
0 commit comments