Summary
The CACHE_GUARD and BATCH_GUARD regexes in src/scanner/local-waste-detector.ts and src/ast/waste/{cache,batch}-detector.ts match the bare words cache and batch within an ±8-line source window. Any fixture (or real-world file) with those words in a docstring, comment, or unrelated identifier silently suppresses findings.
Evidence
What to do
Tighten both guards from bare-word matches to call-shape or assignment matches:
CACHE_GUARD: require cache.get(, cache.set(, cacheKey:, useCache(, @cache, @cached, etc. — actual cache-API usage rather than the word.
BATCH_GUARD: require batch.create(, .batches., bulk(, chunk(, messageBatches., flushQueue(, enqueue( — actual batching-API usage.
Add explicit positive/negative tests:
- Negative (must NOT suppress): docstring with the word "cache" or "batch", variable named
batchSize, comment mentioning "this is a batch".
- Positive (must suppress):
cache.get(key), await batch.create({...}).
Acceptance criteria
Depends on
None (cleanup PR).
Related
Summary
The
CACHE_GUARDandBATCH_GUARDregexes insrc/scanner/local-waste-detector.tsandsrc/ast/waste/{cache,batch}-detector.tsmatch the bare wordscacheandbatchwithin an ±8-line source window. Any fixture (or real-world file) with those words in a docstring, comment, or unrelated identifier silently suppresses findings.Evidence
backoff/jitter/exponential/sleep(in all PR-4 fixtures.What to do
Tighten both guards from bare-word matches to call-shape or assignment matches:
CACHE_GUARD: requirecache.get(,cache.set(,cacheKey:,useCache(,@cache,@cached, etc. — actual cache-API usage rather than the word.BATCH_GUARD: requirebatch.create(,.batches.,bulk(,chunk(,messageBatches.,flushQueue(,enqueue(— actual batching-API usage.Add explicit positive/negative tests:
batchSize, comment mentioning "this is a batch".cache.get(key),await batch.create({...}).Acceptance criteria
CACHE_GUARDandBATCH_GUARDno longer match bare words; only call-shape / API-usage patterns.src/test/c1-guard-tightening.test.tscovering both axes.benchmark/baseline.json.Depends on
None (cleanup PR).
Related