exercism / exercism/v3-beta

[Page: Editor] Race condition in test results

Open
#20 2 comments 0 reactions 0 assignees View on GitHub
blocking/no type/bug
Dominant language
No language data
Stars
12
Forks
2
PR merge metrics
No merged PRs in 30d

Description

@kntsoriano Conversation between me and @sleeplessbyte:

SleeplessByte:dj_ii: 22:23
I ran the tests. They failed. I made a change and ran the tests.
I saw the new results only for 2 seconds, then the old results were shown again. I couldn't get the new results because "no changes made"

I actually think I know what has had happened
1. I run the tests and there are test results.
2. go away
3. load that page, and it shows from cache the test results. Now while it's still trying to fetch the old ones, I make a change and start a new run
4. new run results come in
5. boom

boom = old ones overwrite it

The solution here is queryClient.cancelQueries(key) and / or use a new key in useQuery.

iHiD 22:25
OK. Another fix would be to add a timestamp to each test run and never replace a newer test run with an older test run

---

@kntsoriano Might be worth adding both guards?

Contributor guide

Open the contributing guide

Research direction

Start at the Page: Editor test-results query and reproduce the sequence described: cached results, a new test run, and older results arriving afterward. Read the existing query handling around queryClient.cancelQueries(key) and useQuery. Done means an older run can no longer overwrite newer test results, with the relevant behavior covered by a test.

Written by the indexing model from the issue text.

Assessment

Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.