Don't cache NULL error returns from Jolpica#302
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
Agent-Logs-Url: https://github.com/SCasanova/f1dataR/sessions/fcc1bd1a-d464-42b5-b994-cdd4ff497528 Co-authored-by: pbulsink <5419974+pbulsink@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix caching of NULL when Jolpica is down
Don't cache NULL error returns from Jolpica
Apr 24, 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.
When Jolpica is unreachable,
load_*functions returnNULL.memoisetreatsNULLas a valid return value and caches it — so retrying the same call returns the cached failure instead of hitting the network again.Approach
memoisestores results viawithVisible(), so aNULLreturn is stored aslist(value = NULL, visible = ...). A thin cache wrapper intercepts$set()and silently drops writes wherevalue$valueisNULL, causingmemoiseto see a cache miss on the next call and re-execute the function.Changes
R/zzz.R— Addednull_filtering_cache()wrapper; applied to bothcache_diskandcache_memin.onLoad. All 14 memoised functions benefit automatically. The functions remain propermemoised-class objects, sohas_cache(),forget(), andclear_f1_cache()are unaffected.tests/testthat/test-utils.R— Unit tests fornull_filtering_cache()covering NULL suppression and delegation of other cache methods.tests/testthat/test-load_laps.R— Assertshas_cache(load_laps)(2021, 1)returnsFALSEafter a failed (no-network) call..github/workflows/copilot-setup-steps.yml— R + Python environment setup for the Copilot agent.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/r-lib/memoise/contents/R/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(http block)If you need me to access, download, or install something from one of these locations, you can either: