Skip to content

Add fuzz tests#102

Merged
Vladyslav-Kuksiuk merged 6 commits into
masterfrom
add-fuzz-tests
Jul 7, 2026
Merged

Add fuzz tests#102
Vladyslav-Kuksiuk merged 6 commits into
masterfrom
add-fuzz-tests

Conversation

@Vladyslav-Kuksiuk

Copy link
Copy Markdown
Collaborator

This PR:

  • Adds fuzz tests.
  • Updates skills to run linter for verifications.
  • Hardens pattern matching against gobwas/glob panics so bad matcher inputs report normal pattern-not-found errors instead of crashing.

Resolves this issue.

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk self-assigned this Jul 7, 2026
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk marked this pull request as ready for review July 7, 2026 12:32
Base automatically changed from improve-c++-filtering to master July 7, 2026 13:27
@Oleg-Melnik

Copy link
Copy Markdown
Collaborator

Claude Review

Observation — matchGlob recovers per line × per matcher inside the scan hot path

In embedding/parsing/pattern.go, matches calls matchGlob, which sets up a defer/recover closure on every invocation. Since FindInmatchesAtmatches runs once per (candidate start line × matcher), a large source file scanned per instruction pays a defer + closure setup for every line.

This is a deliberate design choice rather than a bug: recovering per line means a panic on a single line is treated as a local miss, so scanning can still find a match at a later start position. Wrapping the whole FindIn loop in a single recover instead would be cheaper but would abort the entire scan on any panic, losing that precision.

Just flagging the trade-off for visibility — the per-line granularity costs some hot-path overhead on large files in exchange for match precision. No change required if that trade-off is intentional.

@Oleg-Melnik Oleg-Melnik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vladyslav-Kuksiuk LGTM with a comment to address before merging.

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk merged commit c8a70a4 into master Jul 7, 2026
3 checks passed
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk deleted the add-fuzz-tests branch July 7, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add fuzz tests

2 participants