From 0aa22e250cdf903c45ef6d11755bb84e916ca3e4 Mon Sep 17 00:00:00 2001 From: Christian Thiel Date: Tue, 21 Apr 2026 13:14:00 +0200 Subject: [PATCH 1/2] chore(test): Add test for placeholder presence --- console-rs/src/lib.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/console-rs/src/lib.rs b/console-rs/src/lib.rs index 5bcf2c72..a4cd1862 100644 --- a/console-rs/src/lib.rs +++ b/console-rs/src/lib.rs @@ -218,6 +218,46 @@ mod tests { assert!(!index.data.is_empty()); } + #[test] + fn test_all_placeholders_present_in_embedded_files() { + let placeholders = [ + "VITE_IDP_AUTHORITY_PLACEHOLDER", + "VITE_IDP_CLIENT_ID_PLACEHOLDER", + "VITE_IDP_REDIRECT_PATH_PLACEHOLDER", + "VITE_IDP_SCOPE_PLACEHOLDER", + "VITE_IDP_RESOURCE_PLACEHOLDER", + "VITE_IDP_POST_LOGOUT_REDIRECT_PATH_PLACEHOLDER", + "VITE_ENABLE_AUTHENTICATION_PLACEHOLDER", + "VITE_ENABLE_PERMISSIONS_PLACEHOLDER", + "VITE_IDP_TOKEN_TYPE_PLACEHOLDER", + "VITE_BASE_URL_PREFIX_PLACEHOLDER", + "VITE_APP_ICEBERG_CATALOG_URL_PLACEHOLDER", + ]; + + let files: Vec<_> = LakekeeperConsole::iter().collect(); + let mut found = Vec::new(); + let mut missing = Vec::new(); + + for placeholder in &placeholders { + let is_found = files.iter().any(|file_path| { + LakekeeperConsole::get(file_path).is_some_and(|file| { + std::str::from_utf8(&file.data) + .is_ok_and(|content| content.contains(placeholder)) + }) + }); + if is_found { + found.push(*placeholder); + } else { + missing.push(*placeholder); + } + } + + assert!( + missing.is_empty(), + "Placeholders not found in any embedded console file — frontend build likely no longer emits them, so templating in get_file() is a no-op.\n missing: {missing:#?}\n found: {found:#?}" + ); + } + #[test] fn test_get_all_files() { let config = LakekeeperConsoleConfig { From 6a36dd2fdcf34e5b5ce1303657407024bf52efac Mon Sep 17 00:00:00 2001 From: Christian Thiel Date: Fri, 17 Jul 2026 08:55:03 +0200 Subject: [PATCH 2/2] fix(ui): make the user-surveys toggle work at runtime --- console-rs/src/lib.rs | 10 ++++++++-- index.html | 1 + vite.config.mts | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/console-rs/src/lib.rs b/console-rs/src/lib.rs index a4cd1862..fba71adf 100644 --- a/console-rs/src/lib.rs +++ b/console-rs/src/lib.rs @@ -220,6 +220,7 @@ mod tests { #[test] fn test_all_placeholders_present_in_embedded_files() { + // Must stay in sync with the placeholders replaced in `get_file`. let placeholders = [ "VITE_IDP_AUTHORITY_PLACEHOLDER", "VITE_IDP_CLIENT_ID_PLACEHOLDER", @@ -227,20 +228,25 @@ mod tests { "VITE_IDP_SCOPE_PLACEHOLDER", "VITE_IDP_RESOURCE_PLACEHOLDER", "VITE_IDP_POST_LOGOUT_REDIRECT_PATH_PLACEHOLDER", + "VITE_IDP_POST_LOGOUT_REDIRECT_URL_PLACEHOLDER", + "VITE_IDP_POST_LOGOUT_REDIRECT_DISABLED_PLACEHOLDER", "VITE_ENABLE_AUTHENTICATION_PLACEHOLDER", "VITE_ENABLE_PERMISSIONS_PLACEHOLDER", + "VITE_ENABLE_USER_SURVEYS_PLACEHOLDER", "VITE_IDP_TOKEN_TYPE_PLACEHOLDER", "VITE_BASE_URL_PREFIX_PLACEHOLDER", "VITE_APP_ICEBERG_CATALOG_URL_PLACEHOLDER", ]; - let files: Vec<_> = LakekeeperConsole::iter().collect(); + // Iterate via `embedded_iter`/`embedded` so gzipped entries (>=64 KB) are + // searched by their decompressed contents, not their gzip bytes. + let files: Vec<_> = embedded_iter().collect(); let mut found = Vec::new(); let mut missing = Vec::new(); for placeholder in &placeholders { let is_found = files.iter().any(|file_path| { - LakekeeperConsole::get(file_path).is_some_and(|file| { + embedded(file_path).is_some_and(|file| { std::str::from_utf8(&file.data) .is_ok_and(|content| content.contains(placeholder)) }) diff --git a/index.html b/index.html index 8d3ec6f5..6fb14c8d 100644 --- a/index.html +++ b/index.html @@ -12,6 +12,7 @@ globalThis.__lkauth = 'VITE_ENABLE_AUTHENTICATION_PLACEHOLDER'; globalThis.__lkperm = 'VITE_ENABLE_PERMISSIONS_PLACEHOLDER'; globalThis.__lknologout = 'VITE_IDP_POST_LOGOUT_REDIRECT_DISABLED_PLACEHOLDER'; + globalThis.__lksurveys = 'VITE_ENABLE_USER_SURVEYS_PLACEHOLDER';
diff --git a/vite.config.mts b/vite.config.mts index 138e8f4f..257025f3 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -148,6 +148,7 @@ export default defineConfig(({ mode }) => { 'import.meta.env.VITE_ENABLE_AUTHENTICATION': '(globalThis.__lkauth)', 'import.meta.env.VITE_ENABLE_PERMISSIONS': '(globalThis.__lkperm)', 'import.meta.env.VITE_IDP_POST_LOGOUT_REDIRECT_DISABLED': '(globalThis.__lknologout)', + 'import.meta.env.VITE_ENABLE_USER_SURVEYS': '(globalThis.__lksurveys)', }), }, resolve: {