refactor(stdlib): hand-rolled counters → Counter, base64 padding → urlsafe_b64decode (#1132 safe)#1198
Merged
Merged
Conversation
…stdlib #1132 safe subset (axis 2/7 of #1130). Behaviour-preserving swaps to stdlib, each guarded by a characterising equivalence test. Retry/backoff findings are NOT touched (deferred for per-case owner review — #954/#958 traps). - collections.Counter: cli/graph_viz.py (render_ascii), services/error_recovery_service.py (get_error_stats), telegram/collector.py (collect_all_channels — hot path, counter-only change), web/settings/handlers.py (_run_bulk_test_job) - base64.urlsafe_b64decode: web/session.py (manual '=' padding) — HMAC session tokens; round-trip + legacy-token tests added. detect_reinvented baseline 17 → 13: −5 safe replaced; +1 pre-existing retry pool_dialogs.py:1353 (delete_dialogs, introduced in #1171 after the 2026-06-25 baseline) is now recorded in the baseline as a known retry finding, to be addressed in the #1132 retry batch. --fail-on-new green (0 new). Part of #1132 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TShpckA1DoLNezbD3txTL1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
#1132 safe subset (axis 2/7 of the #1130 tech-debt epic). The zero-behaviour-risk findings only — 4 hand-rolled frequency counters →
collections.Counterand 1 manual base64 padding →base64.urlsafe_b64decode. Each swap has a characterising equivalence test.Retry/backoff findings are explicitly NOT touched — they need per-case owner review (#954 aiolimiter sliding-window, #958 SDK retry double-billing) and go in a separate batch.
Changes
Counter:cli/graph_viz.py(render_ascii),services/error_recovery_service.py(get_error_stats),telegram/collector.py(collect_all_channels — hot path, counter-only change),web/settings/handlers.py(_run_bulk_test_job)base64.urlsafe_b64decode:web/session.py— HMAC session tokens; round-trip + legacy-token tests added.Baseline
detect_reinvented17 → 13:pool_dialogs.py:1353(delete_dialogs, introduced in feat(dialogs): полное удаление Telegram-диалога delete_dialogs (parity все слои) #1171 after the 2026-06-25 baseline of 17) now recorded in the baseline as a known retry finding — to be addressed in the tech-debt: самописный код → библиотеки (17 находок реестра #782) #1132 retry batch, not a regression of this PR.--fail-on-newgreen (0 new).Tests
Equivalence tests for each swap + session round-trip/legacy. 354 passed isolated (incl.
test_collector); ruff clean; detector 13/0-new.Part of #1132
🤖 Generated with Claude Code
https://claude.ai/code/session_01TShpckA1DoLNezbD3txTL1