infiniloom_engine/
constants.rs1pub mod budget {
8 pub const DEFAULT_BUDGET: u32 = 100_000;
10
11 pub const OVERHEAD_RESERVE: u32 = 1_000;
13
14 pub const MIN_PARTIAL_FIT_TOKENS: u32 = 100;
16
17 pub const DEFAULT_MAP_BUDGET: u32 = 2_000;
19
20 pub const DEFAULT_CHUNK_SIZE: u32 = 8_000;
22}
23
24pub mod compression {
26 pub const MINIMAL_RATIO: f64 = 0.90;
28
29 pub const BALANCED_RATIO: f64 = 0.70;
31
32 pub const AGGRESSIVE_RATIO: f64 = 0.50;
34
35 pub const EXTREME_RATIO: f64 = 0.30;
37
38 pub const FOCUSED_RATIO: f64 = 0.25;
40
41 pub const SEMANTIC_BUDGET_RATIO: f64 = 0.50;
43}
44
45pub mod timeouts {
47 pub const GIT_OPERATION_SECS: u64 = 30;
49
50 pub const REMOTE_CLONE_SECS: u64 = 300;
52
53 pub const PARSE_TIMEOUT_SECS: u64 = 60;
55}
56
57pub mod files {
59 pub const MAX_FILE_SIZE_BYTES: u64 = 10 * 1024 * 1024;
61
62 pub const BINARY_CHECK_BYTES: usize = 8192;
64
65 pub const DEFAULT_IMPORTANCE: f32 = 0.5;
67
68 pub const MAX_LINE_LENGTH: usize = 2000;
70
71 pub const SIGNATURE_LINES: usize = 3;
73}
74
75pub mod pagerank {
77 pub const DAMPING_FACTOR: f64 = 0.85;
79
80 pub const MAX_ITERATIONS: usize = 100;
82
83 pub const CONVERGENCE_THRESHOLD: f64 = 1e-6;
85}
86
87pub mod security {
89 pub const MIN_ENTROPY_THRESHOLD: f64 = 3.5;
91
92 pub const MAX_SECRET_LENGTH: usize = 500;
94}
95
96pub mod index {
98 pub const DEFAULT_CONTEXT_DEPTH: u8 = 2;
100
101 pub const MAX_CONTEXT_DEPTH: u8 = 3;
103
104 pub const UNKNOWN_SYMBOL_ID: u32 = 0;
106}
107
108pub mod repomap {
110 pub const TOKENS_PER_SYMBOL: u32 = 25;
113
114 pub const TOKENS_PER_FILE: u32 = 10;
117
118 pub const TOKEN_OVERHEAD: u32 = 100;
120
121 pub const BUDGET_SYMBOL_DIVISOR: usize = 20;
124
125 pub const SUMMARY_MAX_LEN: usize = 120;
127
128 pub const MIN_SYMBOLS: usize = 5;
130
131 pub const MAX_SYMBOLS: usize = 500;
133}
134
135pub mod parser {
137 pub const MAX_SYMBOLS_PER_FILE: usize = 10_000;
139
140 pub const MAX_RECURSION_DEPTH: usize = 100;
142
143 pub const MAX_QUERY_MATCHES: usize = 50_000;
145}
146
147#[cfg(test)]
148mod tests {
149 use super::*;
150
151 #[allow(clippy::assertions_on_constants)]
154 #[test]
155 fn test_compression_ratios_are_valid() {
156 assert!(compression::MINIMAL_RATIO > 0.0 && compression::MINIMAL_RATIO <= 1.0);
157 assert!(compression::BALANCED_RATIO > 0.0 && compression::BALANCED_RATIO <= 1.0);
158 assert!(compression::AGGRESSIVE_RATIO > 0.0 && compression::AGGRESSIVE_RATIO <= 1.0);
159 assert!(compression::EXTREME_RATIO > 0.0 && compression::EXTREME_RATIO <= 1.0);
160 assert!(compression::FOCUSED_RATIO > 0.0 && compression::FOCUSED_RATIO <= 1.0);
161 }
162
163 #[allow(clippy::assertions_on_constants)]
164 #[test]
165 fn test_compression_ratios_ordering() {
166 assert!(compression::MINIMAL_RATIO > compression::BALANCED_RATIO);
168 assert!(compression::BALANCED_RATIO > compression::AGGRESSIVE_RATIO);
169 assert!(compression::AGGRESSIVE_RATIO > compression::EXTREME_RATIO);
170 }
171
172 #[allow(clippy::assertions_on_constants)]
173 #[test]
174 fn test_budget_defaults_are_reasonable() {
175 assert!(budget::DEFAULT_BUDGET > budget::OVERHEAD_RESERVE);
176 assert!(budget::DEFAULT_MAP_BUDGET > 0);
177 assert!(budget::DEFAULT_CHUNK_SIZE > 0);
178 }
179
180 #[allow(clippy::assertions_on_constants)]
181 #[test]
182 fn test_pagerank_constants_are_valid() {
183 assert!(pagerank::DAMPING_FACTOR > 0.0 && pagerank::DAMPING_FACTOR < 1.0);
184 assert!(pagerank::MAX_ITERATIONS > 0);
185 assert!(pagerank::CONVERGENCE_THRESHOLD > 0.0);
186 }
187
188 #[allow(clippy::assertions_on_constants)]
189 #[test]
190 fn test_timeouts_are_reasonable() {
191 assert!(timeouts::GIT_OPERATION_SECS > 0);
192 assert!(timeouts::REMOTE_CLONE_SECS > timeouts::GIT_OPERATION_SECS);
193 }
194}