yams/tests/unit/app/services
trvon ed2bde4f7c
fix(grep): bound the regex fallback instead of backtracking without limit
RE2 rejects backreferences and lookaround, and grep fell back to
std::regex for those patterns. std::regex backtracks with no limit, so
a pattern like (x+x+)+y\1 runs in exponential time (2 s at 24 chars on
grim, 4x per 2 more) and libstdc++ recursion can overflow the stack on
long lines. A daemon grep request could pin a worker indefinitely.

Use Boost.Regex (header-only, already a dependency) for the fallback.
It is non-recursive and abandons a search after
max(N*S^2, min(N^2, cap)) + 1e5 states; the cap is 1e7 here. An
abandoned line counts as no match, and grep reports the count as
searchStats.regex_budget_exceeded. The fallback also gains lookbehind.

findNext now passes the preceding bytes as context to both engines, so
^ and \b no longer match at a resumed offset ("^a" on "aa" counted 2).

Signed-off-by: trvon <me@trevon.dev>
2026-10-26 22:32:47 -06:00
..
document_ingestion_batch_catch2_test.cpp perf+assert(storage): eliminate zero-init, temp-path overhead, add DCHECK invariants (#42) 2026-06-04 22:44:12 -04:00
document_service_test.cpp fix(graph): --scope-cwd clusters, --name lookup, --limit (#280 follow-ups) (#284) 2026-10-09 00:01:24 -06:00
document_service_update_metadata_catch2_test.cpp perf(metadata): profile write-path batching (#49) 2026-06-12 14:11:49 -04:00
download_metadata_entries_test.cpp feat(daemon): shutdown hardening + test helper linkage fixes (#44) 2026-06-08 16:29:44 -04:00
enhanced_search_config_catch2_test.cpp refactor(config): unify flat TOML lookups 2026-08-05 20:53:17 -04:00
graph_context_service_catch2_test.cpp fix: Windows and macOS CI failures on experimental (#370) 2026-10-26 05:53:12 -06:00
graph_query_service_catch2_test.cpp fix(testing): stabilize TSAN coverage, harden daemon shutdown, and speed up KG/storage paths (#53) 2026-06-26 17:57:02 -04:00
grep_regex_test.cpp fix(grep): bound the regex fallback instead of backtracking without limit 2026-10-26 22:32:47 -06:00
grep_service_test.cpp chore(warnings): clean up compiler warnings on GCC, Clang and Apple Clang (#279) 2026-10-08 14:30:28 -06:00
indexing_service_test.cpp chore(warnings): clean up compiler warnings on GCC, Clang and Apple Clang (#279) 2026-10-08 14:30:28 -06:00
literal_extractor_test.cpp perf(grep): speed literal matching 2026-05-21 11:54:19 -04:00
retrieval_schema_validation_test.cpp test improvements and stablizations 2025-12-06 18:27:25 -05:00
retrieval_service_mapping_catch2_test.cpp refactor(daemon): remove unused ClientConfig::acceptCompressed 2026-09-27 20:11:46 -06:00
search_hash_edge_cases_catch2_test.cpp chore(warnings): clean up compiler warnings on GCC, Clang and Apple Clang (#279) 2026-10-08 14:30:28 -06:00
search_service_catch2_test.cpp chore(warnings): clean up compiler warnings on GCC, Clang and Apple Clang (#279) 2026-10-08 14:30:28 -06:00
service_deadline_catch2_test.cpp fix(build): restore clean test and benchmark links 2026-08-06 09:59:07 -04:00
service_utilities_test.cpp test: isolate process environment 2026-08-04 21:31:39 -04:00
simd_memmem_test.cpp fix(app): guard SIMD raw-pointer inputs 2026-05-17 23:50:32 -04:00