22/// This ensures our release gates properly catch real issues and block releases
33use std:: process:: Command ;
44
5+ /// Strip debug info from binary. Returns stripped size, or None if strip unavailable.
6+ fn stripped_binary_size ( path : & str ) -> Option < u64 > {
7+ if Command :: new ( "strip" ) . arg ( "--version" ) . output ( ) . is_ok ( ) {
8+ let _ = Command :: new ( "strip" )
9+ . args ( [ "--strip-debug" , path] )
10+ . output ( ) ;
11+ std:: fs:: metadata ( path) . ok ( ) . map ( |m| m. len ( ) )
12+ } else {
13+ None
14+ }
15+ }
16+
517#[ test]
618fn test_release_gate_system_exists ( ) {
719 // Validate that release.yml contains the mandatory gates
@@ -124,9 +136,10 @@ fn test_gate_3_template_packaging_protection() {
124136
125137#[ test]
126138fn test_gate_4_binary_size_constitutional_limit ( ) {
127- // First ensure we have a binary to test (release build = what users run)
139+ // Build the default feature set (airframe + huggingface = what ships)
140+ // Use dev profile — deps already cached from parent `cargo test`
128141 let build_output = Command :: new ( "cargo" )
129- . args ( [ "build" , "--release" ] )
142+ . args ( [ "build" ] )
130143 . output ( )
131144 . expect ( "Failed to build binary for size test" ) ;
132145
@@ -135,15 +148,15 @@ fn test_gate_4_binary_size_constitutional_limit() {
135148 "Failed to build binary for size test"
136149 ) ;
137150
138- // Test constitutional size limit (release binary = what users run)
139151 let binary_path = if cfg ! ( windows) {
140- "target/release /shimmy.exe"
152+ "target/debug /shimmy.exe"
141153 } else {
142- "target/release /shimmy"
154+ "target/debug /shimmy"
143155 } ;
144156
145157 if let Ok ( metadata) = std:: fs:: metadata ( binary_path) {
146- let size = metadata. len ( ) ;
158+ // Strip DWARF debug info to get realistic code size (debug info can be 25MB+ on Linux)
159+ let size = stripped_binary_size ( binary_path) . unwrap_or_else ( || metadata. len ( ) ) ;
147160 let max_size = 15 * 1024 * 1024 ; // 15MB constitutional limit
148161
149162 assert ! (
0 commit comments