Repository navigation
Commit 98d616e
authored
refactor(logging)!: remove dead compat surface and Redis branding from StructuredLogger (LAB-4621) (#316)
`StructuredLogger` kept a compatibility surface that no production code
reached, and a
log-writer thread still named after Redis even though LAB-4617 made the
class
backend-agnostic.
## Removed
Each verified zero-caller in `src/`:
| Symbol | Why it is dead |
| --- | --- |
| `serialization_fallback` | no caller anywhere |
| `create_span`, `SimpleSpan` | `features.create_span(...)` in
`decorators/wrapper.py` binds to `FeatureOrchestrator.create_span`,
which is untouched |
| `redis_operation_failed`, `cache_hit`, `cache_miss`, `cache_stored` |
the whole `# Compatibility methods for tests` block |
The `cache_hit` / `cache_miss` / `cache_stored` that
`cache_handler.get_logger()` calls
belong to `backends.provider.SimpleLogger` — a different class, reached
through the DI
container. Those call sites pass `source` and `ttl` **positionally**,
which
`StructuredLogger`'s `(key, **kwargs)` signature would reject with a
`TypeError`; that
signature mismatch is the proof the binding goes elsewhere.
`SimpleLogger` is unchanged
and keeps its own redaction tests.
Thread name `RedisCache-LogWriter` → `cachekit-LogWriter`, so
`grep -rni redis src/cachekit/logging.py` is now empty.
## The deleted tests lose no coverage
`test_redis_operation_failed_override` pinned a CWE-532 guarantee: an
exception object
passed as `error=` must render key-free. That guarantee is already
pinned — better — by
`TestErrorKwargSanitisedAtSink::test_logging_sink`, which drives
`cache_operation`
through a live `caplog` sink instead of a mocked `Logger.log`, asserts
over the whole
payload instead of one field, and uses an exception whose message embeds
the raw key
instead of an inert literal.
Verified by mutation rather than by reading: replacing the sink's
`redact_error_for_log`
with `str()` makes that test fail on both exception shapes, then
reverted. The surviving
docstring is corrected — it named `redis_operation_failed` as one of
three in-tree
`error=` callers; two remain, and the raw-exception case stays as
defence in depth
because `cache_operation` takes `**kwargs`.
## Breaking
`cachekit.logging.SimpleSpan` was a top-level importable name in v0.18.0
and importing it
now raises `ImportError`; the six removed methods now raise
`AttributeError`. No
deprecation aliases — same removal shape as the PII-masking knobs
(LAB-3797) and
`L1CacheConfig.namespace_index` in v0.18.0. Callers wanting these events
should call
`cache_operation` directly.
## Verification
- `uv run ruff check src/ tests/`, `uv run ruff format --check src/
tests/` — clean
- `uv run pytest tests/unit tests/critical -q -m "not slow"` — 2600
passed, 23 skipped
- `tests/unit/test_log_redaction_architecture.py` still passes
- Docs: no public doc surface named any removed symbol (`docs/`,
`README.md`, `llms.txt`,
`SECURITY.md`, `CONTRIBUTING.md` all grep clean), so no docs change was
needed
Closes LAB-46211 parent 2f7c979 commit 98d616e
3 files changed
Lines changed: 10 additions & 123 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | 417 | | |
451 | 418 | | |
452 | 419 | | |
453 | 420 | | |
454 | 421 | | |
455 | 422 | | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | 423 | | |
482 | 424 | | |
483 | 425 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
289 | 289 | | |
290 | | - | |
291 | | - | |
| 290 | + | |
292 | 291 | | |
293 | 292 | | |
294 | 293 | | |
| |||
409 | 408 | | |
410 | 409 | | |
411 | 410 | | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
417 | 418 | | |
418 | 419 | | |
419 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
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 | 118 | | |
175 | 119 | | |
176 | 120 | | |
| |||
0 commit comments