[31] Balanced Search Strategy#42
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new nesting-aware “balanced pair” string-anchor search strategy to support matching outer delimiter pairs while respecting nested inner pairs (issue #31), plus documentation and benchmark harness updates to exercise/compare the behavior.
Changes:
- Introduces
BalancedPairSearchStrategy(and extensive unit tests) to match balanced opening/closing delimiter pairs across chunks. - Adds a benchmark-only
BalancedPairRegexCountSearchStrategyvariant and corresponding harnesses for algorithm comparisons. - Updates docs (main README, search-strategies README, changelog) and the benchmark validation tests to support skipping scenarios per-harness.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| test/harnesses/types.ts | Adds optional skipScenario hook to conditionally skip scenarios by harness capabilities. |
| test/harnesses/index.ts | Exports the new balanced-pair harnesses. |
| test/harnesses/balanced-pair.ts | Adds a harness wiring the new BalancedPairSearchStrategy into the sync engine. |
| test/harnesses/balanced-pair-regex-count.ts | Adds a harness for the benchmark-only regex-count balanced-pair variant. |
| test/benchmarks/algorithm/validate-functionality.test.ts | Adds per-harness conditional skipping for scenarios not applicable to balanced matching. |
| src/search-strategies/README.md | Documents the new balanced-pair strategy in the search-strategies overview. |
| src/search-strategies/benchmarking/balanced-pair-regex-count/search-strategy.ts | Implements a benchmark-only balanced-pair variant that counts openings via regex. |
| src/search-strategies/benchmarking/balanced-pair-regex-count/README.md | Documents the benchmark-only regex-count variant and findings. |
| src/search-strategies/balanced-pair/search-strategy.ts | Implements the new public balanced-pair search strategy. |
| src/search-strategies/balanced-pair/search-strategy.test.ts | Adds comprehensive unit tests for balanced matching and stream indices across chunks. |
| src/search-strategies/balanced-pair/README.md | Adds detailed documentation for the balanced-pair strategy behavior and implementation. |
| README.md | Adds usage docs for balanced-pair replacement and a UTF-8 encoding caution note for Node adapters. |
| docs/CHANGELOG.md | Adds changelog entries for the new strategy and README caution update. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fix extensions various typos
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.
Issue
resolves #31
Details
Added a
BalancedPairSearchStrategyfor matching two string anchors, but respecting nesting levels so only matching where "balanced"Scout rule
Added
[!CAUTION]toREADME.mdre:utf8Semantic Version Impact
Checklist
[Unreleased]section inCHANGELOG.md