test(aws): pin the 168-hour lifetime cap across Rust, TypeScript and HCL

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Opus 5.5 committed 2026-11-16 10:56:27 -08:00
1 parent f3d542ba60
commit 3bc2b41b70
2 files changed
+27 -1

No files matched your search

@@ -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}")));
}
@@ -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)
}