Repository navigation
Commit e75e928
committed
fix: suffixes_prefixes_titles always reflects current set state
The `suffixes_prefixes_titles` property on `Constants` cached its result
in `_pst` after the first access. Any subsequent `add()` or `remove()`
call on `titles`, `prefixes`, `suffix_acronyms`, or `suffix_not_acronyms`
was silently ignored by the cache, so `is_rootname()` kept returning the
stale result.
Concretely, a word added to `C.titles` after the property was first
accessed would still be treated as a rootname (first/middle/last) by
`join_on_conjunctions`, even though `is_title()` correctly returned
`True` for it. This contradicts the documented behaviour of per-instance
config customisation described in AGENTS.md.
Fix: drop the `_pst` cache entirely and compute the union fresh on every
access. The four-set union is cheap and the simplest correct approach.
Add five tests that assert the property and `is_rootname` stay consistent
with the live sets after `add()`/`remove()` calls.1 parent 1f46568 commit e75e928
2 files changed
Lines changed: 33 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
183 | 182 | | |
184 | 183 | | |
185 | 184 | | |
| |||
262 | 261 | | |
263 | 262 | | |
264 | 263 | | |
265 | | - | |
266 | 264 | | |
267 | 265 | | |
268 | 266 | | |
269 | | - | |
270 | | - | |
271 | | - | |
| 267 | + | |
272 | 268 | | |
273 | 269 | | |
274 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
0 commit comments