Unverified Commit 035c4da5 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Durable use cache entries: sort env var list (#99657)

Sort the collected env vars before returning. They were already
deterministic, but this normalizes the return value more (previously
changing the module graph might have changed the order of these lists)
parent e95129b5
...@@ -542,7 +542,7 @@ async fn compute_subtree_content_hash( ...@@ -542,7 +542,7 @@ async fn compute_subtree_content_hash(
} }
let hash = deterministic_hash("", hashes, HashAlgorithm::Xxh3Hash128Hex).into(); let hash = deterministic_hash("", hashes, HashAlgorithm::Xxh3Hash128Hex).into();
let (runtime_read, runtime_existence): (Vec<_>, Vec<_>) = let (mut runtime_read, mut runtime_existence): (Vec<_>, Vec<_>) =
runtime_env_vars.into_iter().partition_map(|(name, mode)| { runtime_env_vars.into_iter().partition_map(|(name, mode)| {
if mode == EnvVarAccessMode::Read { if mode == EnvVarAccessMode::Read {
Either::Left(name) Either::Left(name)
...@@ -551,6 +551,9 @@ async fn compute_subtree_content_hash( ...@@ -551,6 +551,9 @@ async fn compute_subtree_content_hash(
} }
}); });
// Sort for more stable return values (less invalidation)
runtime_read.sort_unstable();
runtime_existence.sort_unstable();
anyhow::Ok( anyhow::Ok(
ModulesInformation { ModulesInformation {
ident_code_hash: hash, ident_code_hash: hash,
......
...@@ -79,63 +79,63 @@ async function getCodeHashes( ...@@ -79,63 +79,63 @@ async function getCodeHashes(
).toMatchInlineSnapshot(` ).toMatchInlineSnapshot(`
{ {
"app/env-dynamic/page": [ "app/env-dynamic/page": [
"NEXT_OTEL_VERBOSE",
"NEXT_OTEL_PERFORMANCE_PREFIX", "NEXT_OTEL_PERFORMANCE_PREFIX",
"NEXT_OTEL_VERBOSE",
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY", "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY",
"exist NEXT_PRIVATE_DEBUG_CACHE", "exist NEXT_PRIVATE_DEBUG_CACHE",
"exist __NEXT_DEV_SERVER",
"exist NEXT_PRIVATE_DEBUG_RUNTIME_DATA", "exist NEXT_PRIVATE_DEBUG_RUNTIME_DATA",
"exist NEXT_PRIVATE_DEBUG_VALIDATION", "exist NEXT_PRIVATE_DEBUG_VALIDATION",
"exist __NEXT_DEV_SERVER",
], ],
"app/env-existence/page": [ "app/env-existence/page": [
"NEXT_OTEL_VERBOSE",
"NEXT_OTEL_PERFORMANCE_PREFIX", "NEXT_OTEL_PERFORMANCE_PREFIX",
"NEXT_OTEL_VERBOSE",
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY", "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY",
"exist FOO",
"exist BAR", "exist BAR",
"exist FOO",
"exist NEXT_PRIVATE_DEBUG_CACHE", "exist NEXT_PRIVATE_DEBUG_CACHE",
"exist __NEXT_DEV_SERVER",
"exist NEXT_PRIVATE_DEBUG_RUNTIME_DATA", "exist NEXT_PRIVATE_DEBUG_RUNTIME_DATA",
"exist NEXT_PRIVATE_DEBUG_VALIDATION", "exist NEXT_PRIVATE_DEBUG_VALIDATION",
"exist __NEXT_DEV_SERVER",
], ],
"app/next-image-props/page": [ "app/next-image-props/page": [
"NEXT_OTEL_VERBOSE", "NEXT_DEPLOYMENT_ID",
"NEXT_OTEL_PERFORMANCE_PREFIX", "NEXT_OTEL_PERFORMANCE_PREFIX",
"NEXT_OTEL_VERBOSE",
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY", "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY",
"NEXT_DEPLOYMENT_ID",
"exist NEXT_PRIVATE_DEBUG_CACHE", "exist NEXT_PRIVATE_DEBUG_CACHE",
"exist __NEXT_DEV_SERVER",
"exist NEXT_PRIVATE_DEBUG_RUNTIME_DATA", "exist NEXT_PRIVATE_DEBUG_RUNTIME_DATA",
"exist NEXT_PRIVATE_DEBUG_VALIDATION", "exist NEXT_PRIVATE_DEBUG_VALIDATION",
"exist __NEXT_DEV_SERVER",
], ],
"app/next-image/page": [ "app/next-image/page": [
"NEXT_OTEL_VERBOSE",
"NEXT_OTEL_PERFORMANCE_PREFIX", "NEXT_OTEL_PERFORMANCE_PREFIX",
"NEXT_OTEL_VERBOSE",
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY", "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY",
"exist NEXT_PRIVATE_DEBUG_CACHE", "exist NEXT_PRIVATE_DEBUG_CACHE",
"exist __NEXT_DEV_SERVER",
"exist NEXT_PRIVATE_DEBUG_RUNTIME_DATA", "exist NEXT_PRIVATE_DEBUG_RUNTIME_DATA",
"exist NEXT_PRIVATE_DEBUG_VALIDATION", "exist NEXT_PRIVATE_DEBUG_VALIDATION",
"exist __NEXT_DEV_SERVER",
], ],
"app/use-cache-client/page": [ "app/use-cache-client/page": [
"NEXT_OTEL_VERBOSE",
"NEXT_OTEL_PERFORMANCE_PREFIX", "NEXT_OTEL_PERFORMANCE_PREFIX",
"NEXT_OTEL_VERBOSE",
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY", "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY",
"exist NEXT_PRIVATE_DEBUG_CACHE", "exist NEXT_PRIVATE_DEBUG_CACHE",
"exist __NEXT_DEV_SERVER",
"exist NEXT_PRIVATE_DEBUG_RUNTIME_DATA", "exist NEXT_PRIVATE_DEBUG_RUNTIME_DATA",
"exist NEXT_PRIVATE_DEBUG_VALIDATION", "exist NEXT_PRIVATE_DEBUG_VALIDATION",
"exist __NEXT_DEV_SERVER",
], ],
"app/use-cache/page": [ "app/use-cache/page": [
"BUNDLED_NON_INLINED_ENVVAR", "BUNDLED_NON_INLINED_ENVVAR",
"NEXT_OTEL_VERBOSE", "EXTERNAL_ENV_VAR",
"NEXT_OTEL_PERFORMANCE_PREFIX", "NEXT_OTEL_PERFORMANCE_PREFIX",
"NEXT_OTEL_VERBOSE",
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY", "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY",
"EXTERNAL_ENV_VAR",
"exist NEXT_PRIVATE_DEBUG_CACHE", "exist NEXT_PRIVATE_DEBUG_CACHE",
"exist __NEXT_DEV_SERVER",
"exist NEXT_PRIVATE_DEBUG_RUNTIME_DATA", "exist NEXT_PRIVATE_DEBUG_RUNTIME_DATA",
"exist NEXT_PRIVATE_DEBUG_VALIDATION", "exist NEXT_PRIVATE_DEBUG_VALIDATION",
"exist __NEXT_DEV_SERVER",
], ],
} }
`) `)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment