Something went wrong while fetching comments. Please try again.
Created by: eseliger
This PR fixes https://github.com/sourcegraph/sourcegraph/issues/28080.
Before, we would lose cached status on steps when the cache is evicted. Also, when using the noCache option, we would still show step cache results briefly in the UI. This PR also enforces that we have step cache results available for all steps before the most recent cache result (before, we could have a result for step 3, but none for 1 and 2 and those would render incorrectly and have no diff etc).
The downside: This duplicates a lot of data. This might become problematic in the future. This is a really easy and straightforward fix and I don't anticipate anyone before GA running into big trouble here, but if we think this is a big blocker, we can address this now as well. An alternative solution would be to only store the link between step and cache result, as a foreign key. We could add a table workspace_step_cache_entries (workspace_id, cache_entry_id).
Then we would need to adjust our pruning algorithm:
SELECT max(id) .. GROUP BY key
If we decide to proceed with this approach for now, because it fixes the issue at some additional storage cost, I'll put this PR description in a ticket for post beta work. Otherwise, I'll pick this up again and incorporate these suggestions into this PR. I don't have a strong preference but would err on the side of moving fast.