Commit 2fa6e1f
authored
fix: escape LIKE wildcards in NodeQuery.fileFilter and nameLike (#446)
* feat: add Repository abstraction with InMemoryRepository for testing pyramid (3.13)
Introduce a Repository base class, InMemoryRepository (Maps-backed, no
SQLite), and SqliteRepository (delegates to existing fn(db,...) functions).
Includes fluent TestRepoBuilder fixture factory and 105 new tests
(51 unit + 54 parity) verifying behavioral equivalence between both
implementations. Existing code and tests remain unchanged.
Impact: 139 functions changed, 6 affected
* fix: address PR review feedback from Greptile
- Add kind/role validation to InMemoryRepository.findNodesForTriage
matching SqliteRepository behavior (throws ConfigError)
- Optimize findIntraFileCallEdges sort with pre-built lookup map
instead of spreading nodes Map per comparison
- Remove dead #nameIndex field from TestRepoBuilder
- Add validation parity tests for invalid kind/role
Impact: 5 functions changed, 0 affected
* fix: throw on duplicate node names in TestRepoBuilder.build()
Impact: 2 functions changed, 0 affected
* style: format duplicate-name error for biome line length
Impact: 2 functions changed, 0 affected
* fix: check for duplicate names before adding node to repo
Move the duplicate-name guard before repo.addNode() so the repo
is not mutated when a duplicate is detected.
Impact: 2 functions changed, 0 affected
* fix: escape LIKE special chars in InMemoryRepository file filters
findNodesByScope, findNodeByQualifiedName, findNodesWithFanIn,
listFunctionNodes, and findNodesForTriage all passed user-provided
strings directly into likeToRegex without escaping % and _ chars.
This caused divergence from SQLite which uses escapeLike + ESCAPE '\'.
Also adds parity tests for findNodesByScope, findNodeByQualifiedName,
findNodesWithFanIn, findFileNodes, findNodeChildren, import queries,
getCallableNodes, getFileNodesAll, getImportEdges, and hasCfgTables.
Impact: 7 functions changed, 5 affected
* style: format repository-parity test file
* fix: align InMemoryRepository noTests filter with SQLite excludeTests
The in-memory noTests filter only checked .test. and .spec. patterns,
missing __test__, __tests__, and .stories. that the SQLite query-builder
excludes. Add the missing patterns to both findNodesForTriage and
iterateFunctionNodes. Extend parity test fixtures with __tests__ and
.stories. nodes so the divergence is caught automatically.
Impact: 5 functions changed, 0 affected
* fix: escape LIKE wildcards in NodeQuery.fileFilter and nameLike
fileFilter() and nameLike() in query-builder.js passed user input
directly into LIKE patterns without escaping, so _ and % acted as
wildcards instead of literals. This caused a parity gap where the
SQLite findNodesWithFanIn treated _ as a wildcard but the in-memory
version (which already called escapeLike) treated it as literal.
Fix: add escapeLike() to query-builder.js (exported), use it in
fileFilter() and nameLike() with ESCAPE '\', and deduplicate the
copy in nodes.js by importing from query-builder.js.
* fix: import escapeLike from query-builder instead of duplicating it
* fix(deps): pin native binaries to 3.1.4 in optionalDependencies
Closes #454
* docs: add dogfood report for v3.1.41 parent f7ef51b commit 2fa6e1f
6 files changed
Lines changed: 441 additions & 23 deletions
File tree
- generated/dogfood
- src/db
- repository
- tests/unit
0 commit comments