From 3bc2b41b70e2dd5c5901bddf8d9407a5ac104f07 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Mon, 16 Nov 2026 10:56:27 -0800 Subject: [PATCH] test(aws): pin the 168-hour lifetime cap across Rust, TypeScript and HCL Co-Authored-By: Claude Opus 5.5 --- app/src-tauri/src/aws/tofu_modules/tests.rs | 25 +++++++++++++++++++ .../src/commands/environment_commands.rs | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/src-tauri/src/aws/tofu_modules/tests.rs b/app/src-tauri/src/aws/tofu_modules/tests.rs index a3ae211..0c7303f 100644 --- a/app/src-tauri/src/aws/tofu_modules/tests.rs +++ b/app/src-tauri/src/aws/tofu_modules/tests.rs @@ -2128,3 +2128,28 @@ fn every_module_write_has_an_admin_check_and_vice_versa() { .collect(); assert!(stale.is_empty(), "APP_ONLY_WRITES is stale: {stale:?}"); } + +#[test] +fn the_lifetime_cap_maximum_is_the_same_in_rust_typescript_and_hcl() { + let max = MAX_WORKSPACE_HOURS.to_string(); + let vars = module_files(ModuleKind::Environment) + .iter() + .find(|(f, _)| *f == "variables.tf") + .unwrap() + .1; + let block = &vars[vars.find("variable \"max_workspace_hours\"").expect("the variable")..]; + let block = &block[..block.find("\n}\n").unwrap()]; + assert!( + block.contains(&format!("var.max_workspace_hours <= {max}")), + "the HCL validation's maximum: {block}" + ); + assert!(block.contains(&format!("from 0 to {max}")), "{block}"); + let ts = include_str!("../../../../src/components/settings/hosts/LifetimeCapField.tsx"); + assert!( + ts.contains(&format!("export const MAX_WORKSPACE_HOURS = {max};")), + "LifetimeCapField.tsx's MAX_WORKSPACE_HOURS" + ); + // And the record parser's message. + let envs = include_str!("../environments.rs"); + assert!(envs.contains(&format!("from 0 to {max}"))); +} diff --git a/app/src-tauri/src/commands/environment_commands.rs b/app/src-tauri/src/commands/environment_commands.rs index f480890..3edc6a5 100644 --- a/app/src-tauri/src/commands/environment_commands.rs +++ b/app/src-tauri/src/commands/environment_commands.rs @@ -178,7 +178,8 @@ pub(crate) fn network_from_record( subnet_ids: info.subnet_ids.clone(), assign_public_ip: info.assign_public_ip, }; - // The same checks as the apply's variables. + // The same checks as the apply's variables. Only the network is + // checked here, so the lifetime cap is a valid placeholder (0). environment_vars(&info.name, "us-east-1", &choice, 0)?; Ok(choice) }