Description
fetchGitLabData and fetchCodebergData de-duplicate concurrent requests by queueing a caller onto whatever fetch is already in flight — but they do it without checking whether the in-flight fetch is for the same query. A caller asking for a different username, date range, org or repo filter is handed the other query's data.
if (!isCacheKeyMatch) {
this.cache.data = null; // we know the key differs...
}
if (this.cache.fetching) {
return new Promise((resolve, reject) => {
this.cache.queue.push({ resolve, reject }); // ...but queue anyway
});
}
The line above it nulls the cached data precisely because the key differs, and then the caller is queued onto the unrelated fetch regardless.
Reproduction
With a fetch already in flight for one query, calling for a different one:
queued: 1
received: "DATA-BELONGING-TO-OTHER-QUERY"
The second caller resolves with the first query's result.
Impact
Generate a report, then change the date range (or org, or repo filter) and generate again before the first request finishes — the second report is built from the first query's data. Nothing errors and nothing looks wrong; the report just covers the wrong period. For a tool whose entire output is "what I did between these dates", silently reporting a different range is a bad failure mode.
Both helpers share the structure, so both are affected. githubHelper.js uses a different caching path and is not.
Expected
A caller should only share an in-flight request when it is asking for the same thing. A caller asking for something else should get its own request, not the other one's answer.
I have a fix and unit tests ready and will open a PR.
Description
fetchGitLabDataandfetchCodebergDatade-duplicate concurrent requests by queueing a caller onto whatever fetch is already in flight — but they do it without checking whether the in-flight fetch is for the same query. A caller asking for a different username, date range, org or repo filter is handed the other query's data.The line above it nulls the cached data precisely because the key differs, and then the caller is queued onto the unrelated fetch regardless.
Reproduction
With a fetch already in flight for one query, calling for a different one:
The second caller resolves with the first query's result.
Impact
Generate a report, then change the date range (or org, or repo filter) and generate again before the first request finishes — the second report is built from the first query's data. Nothing errors and nothing looks wrong; the report just covers the wrong period. For a tool whose entire output is "what I did between these dates", silently reporting a different range is a bad failure mode.
Both helpers share the structure, so both are affected.
githubHelper.jsuses a different caching path and is not.Expected
A caller should only share an in-flight request when it is asking for the same thing. A caller asking for something else should get its own request, not the other one's answer.
I have a fix and unit tests ready and will open a PR.