Repository navigation
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The incompatible positional cache format requires a coordinated cache reset, and the expanded invalidation paths warrant human validation.
No open issues 🎉
What changed in this PR
Moves reading and exercise accessibility checks into the points cache, addressing #1242 and reducing database work during rendering.
Changes:
- Centralizes opening-time, prerequisite, and reveal-state checks in cached entries.
- Caches prerequisite rules and expands invalidation for related model changes.
- Updates templates and LTI listings to use points entries, with added accessibility and invalidation tests.
| File | Description |
|---|---|
threshold/models.py |
Ensures threshold point labels return strings. |
lti_tool/views.py |
Applies LTI links to points-cache entries. |
lti_tool/templates/lti_tool/lti_course.html |
Renders modules from the points cache. |
exercise/tests_cache.py |
Adds accessibility and prerequisite-cache invalidation coverage. |
exercise/templatetags/exercise.py |
Delegates accessibility checks to cached entries. |
exercise/templates/exercise/_user_results.html |
Uses cached accessibility methods for result links. |
exercise/templates/exercise/_children.html |
Uses the combined entry accessibility check. |
exercise/cache/points.py |
Implements cached accessibility and prerequisite evaluation. |
exercise/cache/invalidate_util.py |
Identifies modules affected by prerequisite changes. |
exercise/cache/basetypes.py |
Prefetches and caches requirement rules; registers invalidation signals. |
course/templates/course/_siblings.html |
Removes reveal checks now handled by accessibility methods. |
Review effort: Balanced
|
Here is an (AI-generated) overall picture for reference of what is cached and when it gets invalidated, both before and after this PR... Cached per-student properties (after PR 1562)Three per-student entry layers, each keyed with the
What invalidates what✅ = pre-existing, 🆕 = added by 1562. "via dependency" = entry regenerates
Review-relevant observations
|
|
I'm running another Copilot review with the new "Max" preview option. |
There was a problem hiding this comment.
🟡 Changes recommended
Critical cache-invalidation races and incompatible cached module formats can leave stale access decisions, produce incorrect module visibility, or crash prerequisite checks.
7 open issues
Invalidate both owners when requirements or points rules move · New Version cache namespaces to support rolling deployments · New Avoid caching oversized prerequisite model graphs · New Keep cached requirement descriptions language-neutral · New Reuse computed accessibility flags for exercise rows · New Reuse accessibility flags when rendering chapter links · New Test cache invalidation across prerequisite relation changes · New
Review effort: Max
|
I started to look into this yesterday by checking if there's some synergy between this and #1539 but turned out that is not much. The "best points" cache table of #1539 could potentially speed up cache generation in this PR, but turns out there are some edge cases where that table does not give 1:1 information to how the general caching works due to different handling of forced and invalidated points at least. So it's possible to use that table, but only after we've made sure they have compatible information. |
Move reading and exercise accessibility checks onto cached points entries, including reveal state and module prerequisites. Cache requirement rules and invalidate affected modules when thresholds, points, or prerequisite relations change. Update course, exercise, and LTI templates to use the cached checks, and add coverage for accessibility and cache invalidation. Fixes apluslms#1242
|
I will run another expensive Copilot Max code review on this pull request next month when we have more AI credits. |
There was a problem hiding this comment.
🟡 Changes recommended
Threshold changes or requirement deletions invalidate only the module cache, allowing standalone exercise fetches to continue returning stale requirement descriptions.
1 open issue
7 resolved since last review
Version cache namespaces to support rolling deployments Invalidate both owners when requirements or points rules move Test cache invalidation across prerequisite relation changes Reuse accessibility flags when rendering chapter links Reuse computed accessibility flags for exercise rows Keep cached requirement descriptions language-neutral Avoid caching oversized prerequisite model graphs
Review effort: Max


Description
What?
Move reading and exercise accessibility checks onto cached points entries, including reveal state and module prerequisites. Cache requirement rules, and invalidate affected modules when thresholds, points, or prerequisite relations change.
Update course, exercise, and LTI templates to use the cached checks, and add coverage for accessibility and cache invalidation.
These changes require a fresh/invalidated cache or things will break, since the positional cache format is changed without changing its keys.
Why?
This trades larger cache payloads and initial prefetch work for less database work during rendering.
How?
Fixes #1242