Skip to content

fix: cache bust http cache on lockfile integrity mismatch #28087

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

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ deno_config = { workspace = true, features = ["sync", "workspace"] }
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_doc = { version = "=0.164.0", features = ["rust", "comrak"] }
deno_error.workspace = true
deno_graph = { version = "=0.87.2" }
deno_graph = { version = "=0.87.3" }
deno_lib.workspace = true
deno_lint = { version = "0.72.0" }
deno_lockfile.workspace = true
Expand Down
16 changes: 16 additions & 0 deletions tests/specs/lockfile/cache_bust_integrity_failure/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"tempDir": true,
"envs": {
"DENO_DIR": "./deno_dir"
},
"steps": [{
"args": "cache --allow-import main.ts",
"output": "[WILDCARD]"
}, {
"args": "run -A update.ts",
"output": "[WILDCARD]"
}, {
"args": "run --allow-import main.ts",
"output": "main.out"
}]
}
5 changes: 5 additions & 0 deletions tests/specs/lockfile/cache_bust_integrity_failure/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lock": {
"frozen": true
}
}
6 changes: 6 additions & 0 deletions tests/specs/lockfile/cache_bust_integrity_failure/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tests/specs/lockfile/cache_bust_integrity_failure/main.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[# should download because it cache busts]
Download http://localhost:4545/welcome.ts
Welcome to Deno!
1 change: 1 addition & 0 deletions tests/specs/lockfile/cache_bust_integrity_failure/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "http://localhost:4545/welcome.ts";
6 changes: 6 additions & 0 deletions tests/specs/lockfile/cache_bust_integrity_failure/update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// make the path in the deno_dir differ from the remote server
// and what's stored in the lockfile
const filePath =
"./deno_dir/remote/http/localhost_PORT4545/3011c891e5bd4172aa2e157e4c688ab6f31e91da9719704a9a54aa63faa99c88";
const text = Deno.readTextFileSync(filePath);
Deno.writeTextFileSync(filePath, "//\n" + text);
5 changes: 4 additions & 1 deletion tests/util/server/src/assertions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ pub fn assert_wildcard_match_with_logger(
expected: &str,
logger: &mut dyn Write,
) {
if !expected.contains("[WILD") && !expected.contains("[UNORDERED_START]") {
if !expected.contains("[WILD")
&& !expected.contains("[UNORDERED_START]")
&& !expected.contains("[#")
{
pretty_assertions::assert_eq!(actual, expected);
} else {
match crate::wildcard_match_detailed(expected, actual) {
Expand Down
Loading