Stabilize entitlement calculations - #83
Merged
Merged
Conversation
Keep one evaluation timestamp for each run, allow callers to set it explicitly, handle empty AND rules, and avoid caching in-progress calculation sentinels. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 10248eee-e35a-46a7-9705-9bebc7b5318b
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused correctness changes are internally consistent and adequately covered by unit tests.
Review effort: Balanced
Findings: None
What changed in this PR
Stabilizes calculated-group entitlement evaluation with consistent expiration timing and safer rule caching.
Changes:
- Adds a configurable, resettable evaluation timestamp.
- Handles empty
andrules as empty sets. - Prevents caching transient
:calculatingsentinels.
| File | Description |
|---|---|
lib/entitlements.rb |
Adds evaluation-time state and reset behavior. |
lib/entitlements/data/groups/calculated/base.rb |
Uses fixed time and handles empty conjunctions. |
lib/entitlements/data/groups/calculated/modifiers/expiration.rb |
Uses fixed time for expiration modifiers. |
lib/entitlements/data/groups/calculated/text.rb |
Fixes sentinel caching and expiration timing. |
lib/entitlements/data/groups/calculated/yaml.rb |
Fixes sentinel caching. |
spec/unit/entitlements_spec.rb |
Tests evaluation-time lifecycle. |
spec/unit/entitlements/data/groups/calculated/base_spec.rb |
Tests empty and behavior. |
spec/unit/entitlements/data/groups/calculated/modifiers/expiration_spec.rb |
Tests configured-time expiration. |
spec/unit/entitlements/data/groups/calculated/text_spec.rb |
Tests text sentinel handling. |
spec/unit/entitlements/data/groups/calculated/yaml_spec.rb |
Tests YAML sentinel handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Prepare the entitlement calculation correctness fixes for publication. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 10248eee-e35a-46a7-9705-9bebc7b5318b
nobe4
approved these changes
Sep 22, 2026
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.
We had several bugfixes identified in #74, which I've extracted into this much smaller PR to get them across the finish line sooner.
Time.now.andrules.:calculatingsentinel in text and YAML groups.