Skip to content

100% test coverage#170

Open
shay-te wants to merge 16 commits into
masterfrom
100_test_coverage
Open

100% test coverage#170
shay-te wants to merge 16 commits into
masterfrom
100_test_coverage

Conversation

@shay-te

@shay-te shay-te commented May 13, 2026

Copy link
Copy Markdown
Owner

🐛 Hypothesis found 2 real bugs

  1. Production bug fixed: JWTTokenHandler.encode used datetime.utcnow().timestamp() — utcnow() is a naive datetime, but .timestamp() interprets naive datetimes as local time. On any non-UTC system, this produces an epoch offset by the local TZ delta, and PyJWT 2.0+ rejects all such tokens as expired immediately.

Fixed core_lib/session/jwt_token_handler.py:21 to use datetime.now(tz=timezone.utc). Also updated tests/test_user_security.py:119 which relied on the same buggy assumption.

  1. Production quirk documented: RuleValidator skips int→str coercion when the value is 0 (because if value and ... short-circuits on falsy). Surfaced by hypothesis trying value=0. Test now explicitly documents the behavior.

Cache decorator quirk surfaced
If a cache key template contains { from repr()-ed values, UnseenFormatter.format raises ValueError: expected '}' before end of string. Test reworked to use a clean digits-only key template.

Comment thread tests/test_connections_full.py Fixed
Comment thread tests/test_remaining_gaps.py Fixed
Comment thread tests/test_utility_challenge.py Fixed
Comment thread tests/test_utility_challenge.py Fixed
Comment thread tests/test_utility_challenge.py Fixed
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants