Repository navigation
Pin the model end_date boundary in tests - #321
Merged
Merged
Conversation
Freeze the clock at a fixed instant and assert both sides of the end_date boundary in the access gate, ModelConfig.active (Python and SQL) and the model cache snapshot: a model is blocked and hidden from the exact end instant. Fixes #311
Member
Author
|
How to test |
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 changed
Tests only, no production code changes. They pin the exact
end_dateinstant (end_date == utcnow()) in all four places that check a model's end date:_resolve_single_accessinlumen/services/llm.py: blocked atNOW, allowed atNOW + 1µs. There is also an end-to-end check thatget_model_access_status/get_model_accessblock at the exact instant.ModelConfig.activeinlumen/models/model_config.py: covers both the Python property and the SQL expression. It is inactive atNOWand active atNOW + 1s. The test uses 1 s because database sub-second precision varies.ModelSnapshot.activeinlumen/services/model_cache.py:resolve()hides the model atNOWand returns it atNOW - 1µs.Every test patches the module-level
utcnowof the module under test to a fixed naive-UTC2030-01-01 12:00:00, so no test reads the real clock. The PR also adds one CHANGELOG bullet.How I tested it
uv run pytest tests/unit/test_llm_access.py tests/unit/test_model_cache.py: pass.llm.py:172:<=changed to<model_config.py:73:>changed to>=model_config.py:78:>changed to>=model_cache.py:102:>changed to>=uv run pytestpasses locally. The PostgreSQL and Redis tests were skipped locally because no database services were available; CI runs them.Fixes #311