Skip to content

fix(benchmark): reject a malformed annotation instead of ignoring it#885

Merged
Chemaclass merged 1 commit into
mainfrom
fix/validate-bench-annotations
Jul 25, 2026
Merged

fix(benchmark): reject a malformed annotation instead of ignoring it#885
Chemaclass merged 1 commit into
mainfrom
fix/validate-bench-annotations

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #884

Each benchmark marker is extracted with a numeric sed pattern and fell back to the
default when it did not match, so a malformed value was indistinguishable from an absent
annotation — the benchmark ran with different parameters than the ones written, and
reported success:

Annotation Was
@revs=abc ran 1 revolution
@its=abc ran 1 iteration
@max_ms=abc threshold dropped, so it could never fail

Same class as #871/#873/#875/#877/#879, at the annotation layer rather than the CLI.

💡 Changes

  • Treat "marker present but no value extracted" as an error naming the marker; an absent annotation still takes its default
  • Capture the parse into a variable at the call site: read -r ... <<<"$(parse_annotations ...)" discards the command substitution's exit status, so the failure could not propagate
  • Cover both malformed markers and the no-annotation case, verified end to end (@revs=5 @its=2 still applies correctly)

Each marker is extracted with a numeric sed pattern and fell back to the
default when it did not match, so a malformed value was
indistinguishable from an absent annotation:

  @revs=abc     ran 1 revolution
  @its=abc      ran 1 iteration
  @max_ms=abc   dropped the threshold, so it could never fail

all reporting success while measuring something other than what was
written. A marker that is present but yielded no value is now an error;
an absent annotation still takes its default.

The call site captured into `read <<<"$(...)"`, which discards the
command substitution's status, so it now captures into a variable first.

Closes #884
@Chemaclass Chemaclass added the bug Something isn't working label Jul 25, 2026
@Chemaclass Chemaclass self-assigned this Jul 25, 2026
@Chemaclass
Chemaclass merged commit 2a0c255 into main Jul 25, 2026
61 of 62 checks passed
@Chemaclass
Chemaclass deleted the fix/validate-bench-annotations branch July 25, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant