Cross Cutting Concerns - cruisinme30/spelunk GitHub Wiki

Concern Rule
Cancellation Every keystroke sends $/cancelRequest for the previous search. Daemon loops check ctx.Done(); the webview drops responses with an older seq
Offsets Every Span, Range and Hit counts UTF-16 code units, like JavaScript and VS Code
Regexes RE2 (Go regexp): linear time, no backreferences or lookaround
Limits Queries up to 1,000 characters; count:all stops at 50,000 and reports truncated
Crashes The host restarts the daemon after a pause that doubles from 200 ms to 30 s, at most 3 times a minute, then offers a Restart button. A daemon that stops answering while requests wait is killed and restarted the same way
Observability SPELUNK_TRACE=<file> records the JSON-RPC transcript; the extension logs to the "Spelunk" output channel
Testing Each contract has its own tests, so a change breaks the cheapest layer first. See Testing

Performance budgets (p95)

Path Budget
Keystroke โ†’ chips and diagnostics 15 ms
Keystroke โ†’ first working-tree results 100 ms after the typing delay
Keystroke โ†’ first history results 250 ms after the typing delay
Select โ†’ preview 50 ms
File saved โ†’ findable 1 s
New commit โ†’ findable by author: 5 s

scripts/checkBudgets.mjs checks benchmark output against these on every release.

โš ๏ธ **GitHub.com Fallback** โš ๏ธ