fix(benchmarks): use awk -v for variable passing to fix newline parse error#55
Merged
Conversation
Release: merge dev into main (26 commits)
The two auth::resolve() tests both mutate CLAUDE_CONFIG_DIR and ANTHROPIC_API_KEY env vars. When cargo runs them in parallel, one test can clear the vars while the other is still using them, causing a spurious "No Anthropic credentials found" failure. Add a static Mutex so the tests serialize their env-var access. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Add benchmarks/run.sh that measures build time, test pass rate, clippy/fmt compliance, and binary size. Outputs standard benchmark-results.json format. Integrate benchmark job into CI workflow. Closes ANGA-593 Co-Authored-By: Paperclip <noreply@paperclip.ing>
… error The multi-line awk expression for weighted score calculation broke because awk treats newlines as statement terminators — a trailing `+` operator before a newline has no right operand. Switch all awk calls from double-quoted shell expansion to `-v` variable passing with single-quoted programs, which is both more portable and avoids shell injection of malformed values. Closes ANGA-601 Co-Authored-By: Paperclip <noreply@paperclip.ing>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thinking Path
benchmarks/run.shprovides build-quality scoringawk: cmd. line:3: unexpected newline or end of string— the multi-line awk expression breaks+operator before a newline has no right operandawk "BEGIN { ... $VAR ... }"), which is fragile — empty or newline-containing variables also break parsing-vvariable passing with single-quoted programs — portable, safe from shell injection, and avoids the newline issue entirelyWhat Changed
benchmarks/run.sh: Replaced all 5awk "BEGIN { ... $VAR ... }"invocations withawk -v var="$VAR" 'BEGIN { ... var ... }'patternnormalize()fallback awk call (line 38)TEST_PASS_RATEcalculation (line 98)BINARY_MBcalculation (line 163)OVERALLweighted score calculation (line 169) — primary fix for the reported errorPASSthreshold check (line 179)Verification
bash -n benchmarks/run.shpasses syntax check (confirmed locally)bash benchmarks/run.shcompletes without awk errorbenchmark-results.jsonis generated with valid JSONRisks
Low risk — this is a targeted fix to shell quoting in a single file. The awk
-vpattern is POSIX-standard and more portable than double-quoted expansion. No behavioral change to scoring logic.Checklist
Co-Authored-By: Paperclip <noreply@paperclip.ing>in commitCloses ANGA-601