1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# renacer.toml - Build-time trace assertions (Sprint 44)
#
# This file defines performance assertions that are evaluated at build time
# during `cargo test`. If any assertion with `fail_on_violation = true` fails,
# the test suite will fail, preventing performance regressions from reaching
# production.
#
# Toyota Way Principle: Andon (Visual Control)
# Build-time assertions catch regressions early and stop the line.
# ============================================================================
# Critical Path Assertions
# ============================================================================
[[]]
= "api_max_latency"
= "critical_path"
= 100
= "api_.*"
= true
= true
[[]]
= "db_query_max_latency"
= "critical_path"
= 50
= "db_query_.*"
= true
= true
[[]]
= "file_io_max_latency"
= "critical_path"
= 200
= "file_.*"
= true
= true
# ============================================================================
# Anti-Pattern Detection
# ============================================================================
[[]]
= "no_god_process"
= "anti_pattern"
= "GodProcess"
= 0.8
= ".*"
= true
= true
[[]]
= "no_tight_loop"
= "anti_pattern"
= "TightLoop"
= 0.9
= true
= true
[[]]
= "no_pcie_bottleneck"
= "anti_pattern"
= "PcieBottleneck"
= 0.85
= true
= true
# ============================================================================
# Resource Constraints
# ============================================================================
[[]]
= "max_syscalls_per_request"
= "span_count"
= 10000
= ".*"
= true
= true
[[]]
= "max_file_opens"
= "span_count"
= 100
= "open.*"
= false # Warning only
= true
[[]]
= "max_memory_allocations"
= "memory_usage"
= 100000000 # 100MB
= "allocations"
= true
= true
[[]]
= "max_rss"
= "memory_usage"
= 500000000 # 500MB
= "rss"
= false # Warning only
= true
# ============================================================================
# Custom Assertions (Advanced)
# ============================================================================
# Note: Custom assertions require Rust expression evaluation (not yet implemented)
# [[assertion]]
# name = "custom_validation"
# type = "custom"
# expression = "trace.spans.iter().all(|s| s.duration_ms < 50)"
# fail_on_violation = true
# enabled = false
# ============================================================================
# Example: Disabled Assertion (for debugging)
# ============================================================================
[[]]
= "experimental_check"
= "critical_path"
= 10 # Very strict
= true
= false # Disabled for now
# ============================================================================
# Usage
# ============================================================================
#
# 1. Place this file in your project root or tests directory
# 2. Run: cargo test
# 3. Assertions are evaluated against generated traces
# 4. If any fail_on_violation assertion fails, cargo test fails
#
# Example output:
# running 1 test
# test trace_assertions ... FAILED
#
# failures:
#
# ---- trace_assertions stdout ----
# thread 'trace_assertions' panicked at 'Assertion "api_max_latency" failed:
# Critical path duration 150ms exceeds maximum 100ms'
#
# failures:
# trace_assertions
#
# test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out