Repository navigation
fix(licensing): evaluate expiry in UTC; tz-aware datetimes — closes #502 - #2922
Merged
Merged
Conversation
ruff DTZ005/DTZ007 flagged naive datetimes. These are correctness decisions, not cosmetics, so they're handled deliberately rather than auto-fixed: - licensing.py: license expiry is now evaluated in UTC. The stored YYYYMMDD is parsed as UTC-midnight and compared against `datetime.now(timezone.utc)`. This fixes two latent issues: (a) a naive-vs-aware comparison would raise TypeError if only one side were made aware, and (b) expiry previously landed on the server's LOCAL midnight -- it is now a single global UTC instant, per the UTC-midnight dateline decision. Adds a regression test that freezes now() to a fixed UTC instant and asserts same-UTC-day = EXPIRED, next-day = VALID. - cobol_refractor_controller.py / cobol_jcl_forge.py: the two `datetime.now()` calls that build output-directory name suffixes now use UTC, which also makes the timestamps monotonic across DST rollbacks (avoids collisions). Lint pinned to ruff==0.16.0. tests/ruff_audit_baseline.json regenerated 70 -> 66 (4 DTZ findings resolved); `python tests/ruff_audit.py --ci` passes. tests/core_engine/test_licensing.py: 10 passed. Closes #502 Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01QBL6TAMVXRUY7iQyy9Ysvi
# Conflicts: # tests/ruff_audit_baseline.json
Contributor
# Conflicts: # tests/ruff_audit_baseline.json
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
Resolves the DTZ005/DTZ007 (naive-datetime) findings (#502). These are correctness decisions, not cosmetic auto-fixes, so each is handled deliberately.
Changes
licensing.py— the important one. License expiry is now evaluated in UTC: the storedYYYYMMDDis parsed as UTC-midnight (.replace(tzinfo=timezone.utc)) and compared againstdatetime.now(timezone.utc). This fixes two latent issues:TypeErroron the naive-vs-aware comparison and break the license gate entirely.Adds a regression test that freezes
now()to a fixed UTC instant and asserts same-UTC-day →EXPIRED, next-day →VALID.cobol_refractor_controller.py/cobol_jcl_forge.py: the twodatetime.now()calls that build output-directory name suffixes now use UTC — also making the suffixes monotonic across DST rollbacks (avoids dir collisions).Note on scope
This is intentionally split from the mechanical lint PRs (#2920, #2921) because the licensing change is a real behavior/policy change that warrants its own review + test — flagged during a per-site review of the #469 backlog.
Verification
ruff check --select DTZ005,DTZ007→ clean.python tests/ruff_audit.py --ci→ no new findings beyond the regenerated 66-key baseline (was 70). Pinned ruff==0.16.0.tests/core_engine/test_licensing.py→ 10 passed (incl. the new UTC test).Closes #502
🤖 Generated with Claude Code
https://claude.ai/code/session_01QBL6TAMVXRUY7iQyy9Ysvi