mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-26 23:50:17 +00:00
Merge remote-tracking branch 'origin/staging' into refactor/architectural-hardening
# Conflicts: # src/agent/routine.rs
This commit is contained in:
@@ -134,8 +134,19 @@ fi
|
||||
# Excludes test files, test modules, and debug_assert (compiled out in release).
|
||||
# Suppress with "// safety: <reason>".
|
||||
PROD_DIFF="$DIFF_OUTPUT"
|
||||
# Strip hunks from test-only files (tests/ directory, *_test.rs, test_*.rs)
|
||||
PROD_DIFF=$(echo "$PROD_DIFF" | grep -v '^+++ b/tests/' || true)
|
||||
# Strip all hunks from test-only files (tests/ directory, *_test.rs, test_*.rs, benches/)
|
||||
PROD_DIFF=$(echo "$PROD_DIFF" | awk '
|
||||
/^diff --git/ { in_test_file = ($0 ~ /tests\/|_test\.rs|test_.*\.rs|benches\//) }
|
||||
!in_test_file { print }
|
||||
' || true)
|
||||
# Strip hunks whose @@ context line indicates a test module.
|
||||
# git diff includes the enclosing function/module name after @@.
|
||||
# Only match `mod tests` (the conventional #[cfg(test)] module) — do NOT
|
||||
# match `fn test_*` because production code can have functions named test_*.
|
||||
PROD_DIFF=$(echo "$PROD_DIFF" | awk '
|
||||
/^@@ / { in_test = ($0 ~ /mod tests/) }
|
||||
!in_test { print }
|
||||
' || true)
|
||||
if echo "$PROD_DIFF" | grep -nE '^\+' \
|
||||
| grep -E '\.(unwrap|expect)\(|[^_]assert(_eq|_ne)?!' \
|
||||
| grep -vE 'debug_assert|// safety:|#\[cfg\(test\)\]|#\[test\]|mod tests' \
|
||||
|
||||
Reference in New Issue
Block a user