Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not serve stale values from the assets when there is no KV #344

Merged
merged 7 commits into from
Feb 7, 2025

Conversation

dario-piotrowicz
Copy link
Contributor

@dario-piotrowicz dario-piotrowicz commented Feb 5, 2025

This change makes sure that stale cache values from assets are not served when there is no KV binding.

This makes the issue in #328 no longer flaky (it makes the test always fail) since before it was passing because stale cache values were being served from assets (so the fetch cached result would always stay the same, making this check pass). The reason why KV is not being used is still being investigated.

No other tests besides the 328 one is affected as far as I know, since the 328 one was the only flaky we had, regarding all the other tests, the ones that were passing before as still passing after my change, and the ones that were failing before (and we skip) are failing after my change.

Copy link

changeset-bot bot commented Feb 5, 2025

🦋 Changeset detected

Latest commit: fffd2ec

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Feb 5, 2025

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@344

commit: fffd2ec

@dario-piotrowicz dario-piotrowicz force-pushed the dario/kvCache/discard-expired branch from fc72eb5 to 88662bb Compare February 5, 2025 16:49
@dario-piotrowicz dario-piotrowicz marked this pull request as ready for review February 5, 2025 20:01
@dario-piotrowicz dario-piotrowicz force-pushed the dario/kvCache/discard-expired branch from c5c248f to 22c1228 Compare February 5, 2025 20:57
@dario-piotrowicz dario-piotrowicz force-pushed the dario/kvCache/discard-expired branch from 2455b26 to fe96df4 Compare February 5, 2025 21:01
Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment in the file about what the code is doing an why?

no longer flaky (it makes the test always fail)

Is that an improvement?

@dario-piotrowicz
Copy link
Contributor Author

Could you add a comment in the file about what the code is doing an why?

ok

Is that an improvement?

Yes, this is fixing a false positive we currently have, locally things are not working as intended, we are serving state cached data which make the test app-router fetch cache test pass, with this change the state data is no longer served so the underlying broken catching logic gets exposed

@dario-piotrowicz
Copy link
Contributor Author

Is that an improvement?

I thought we discussed this and agreed that not keep always serving the same stale build time cache data was the correct behavior, if you disagree I'm fine closing the PR

@vicb
Copy link
Contributor

vicb commented Feb 6, 2025

not keep always serving the same stale build time cache data was the correct behavior, if you disagree I'm fine closing the PR

I agree with that 100%.

My question was if going from flaky to failing is an improvement.

I think the outcome of that PR should be that the tests are passing?

@dario-piotrowicz
Copy link
Contributor Author

dario-piotrowicz commented Feb 6, 2025

My question was if going from flaky to failing is an improvement.

Well I see it as a temporary improvement, my plan here is to go from flaky-difficult-to-test bug -> consistently failing (easier to work on) bug -> fixed bug

I think the outcome of that PR should be that the tests are passing?

The outcome of this PR is to fix the fact that now we can serve static stale assets forever, as a side effect this makes working on the fetch cache bug easier, that will be addressed in a separate PR (probably #340)

@vicb
Copy link
Contributor

vicb commented Feb 7, 2025

My question was if going from flaky to failing is an improvement.

Well I see it as a temporary improvement, my plan here is to go from flaky-difficult-to-test bug -> consistently failing (easier to work on) bug -> fixed bug

I think the outcome of that PR should be that the tests are passing?

The outcome of this PR is to fix the fact that now we can serve static stale assets forever, as a side effect this makes working on the fetch cache bug easier, that will be addressed in a separate PR (probably #340)

The PR is about not serving stale cache values from assets when there is no KV binding. So I think the title and description of the PR must be updated as well as the changeset.

You could also expand the description of the PR to tell more about why/which of the (skipped) tests always fail after this PR:

  • maybe we don't really understand and it's fine to say that we will investigate
  • if we have some clue, it would be good to update the linked issue

The kind of information that I am looking for is why this PR would make the tests always fail - it is supposed to change the behavior only when there is no kv binding but we have a kv binding in the tests.

I hope this helps.

@dario-piotrowicz dario-piotrowicz changed the title discard expired entries in the kvCache get discard asset expired entries in the kvCache get method Feb 7, 2025
@dario-piotrowicz
Copy link
Contributor Author

The PR is about not serving stale cache values from assets when there is no KV binding. So I think the title and description of the PR must be updated as well as the changeset.

Updated 👍

You could also expand the description of the PR to tell more about why/which of the (skipped) tests always fail after this PR:

  • maybe we don't really understand and it's fine to say that we will investigate
  • if we have some clue, it would be good to update the linked issue

The kind of information that I am looking for is why this PR would make the tests always fail - it is supposed to change the behavior only when there is no kv binding but we have a kv binding in the tests.

I've added the information, I hope it helps

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the updates, super clear 🙏

@vicb vicb changed the title discard asset expired entries in the kvCache get method Do not serve stale values from the assets when there is no KV Feb 7, 2025
@dario-piotrowicz
Copy link
Contributor Author

Thanks for the approval @vicb 👍

We can merge this PR, or if you think it would be safer we can be merged when issue #328 is fully understood, either is totally fine by me

@vicb
Copy link
Contributor

vicb commented Feb 7, 2025

Let's merge it

@dario-piotrowicz dario-piotrowicz merged commit f30a5fe into main Feb 7, 2025
7 checks passed
@dario-piotrowicz dario-piotrowicz deleted the dario/kvCache/discard-expired branch February 7, 2025 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants