Repository navigation
Commit 3e1a1a7
fix(plugins): guard the attribute-based fallback the same way
Addresses review feedback on the name-based fix.
PredBatPlugin sets PREDBAT_PLUGIN = True as its own discovery marker, so it
matches strategy 2 in every plugin that does `from plugin_system import
PredBatPlugin`. Guarding only strategy 1 left the identical bug reachable in the
two cases where strategy 1 declines: the plugin class does not end in "Plugin",
or it raised during __init__ and left plugin_instance None. Both end with the
abstract base constructed, the plugin logged as loaded, and no hooks registered.
Same __module__ check, same reason. Also replaces the redundant
hasattr/getattr pair with a single getattr default.
The new test needs three properties together, and getting any of them wrong
hides the bug: the file must end "_plugin.py" or discovery never reads it; the
class must not end in "Plugin" so strategy 1 declines; and the class must sort
AFTER "PredBatPlugin", because inspect.getmembers() is alphabetical and strategy
2 breaks on its first match. A first draft named the class AttributeOnlyWorker,
which sorts before the base and so passed with and without the fix. Verified
failing without the guard ("fallback instantiated PredBatPlugin, expected
ZzAttributeWorker") and passing with it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LVDP1s2fmBMFmbHNAirnUt1 parent 0666c8c commit 3e1a1a7
3 files changed
Lines changed: 61 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
142 | 151 | | |
143 | 152 | | |
144 | | - | |
| 153 | + | |
145 | 154 | | |
146 | 155 | | |
147 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| 402 | + | |
402 | 403 | | |
403 | 404 | | |
404 | 405 | | |
| |||
0 commit comments