seer-mcp 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/STRESS_TEST_REPORT.md +219 -0
  2. package/adding-new-languages.md +647 -0
  3. package/dist/cli/index.js +1 -1
  4. package/package.json +3 -2
  5. package/research-papers.md +117 -0
  6. package/.vscode/settings.json +0 -3
  7. package/src/bundle/ci.ts +0 -141
  8. package/src/bundle/contract.ts +0 -387
  9. package/src/bundle/export.ts +0 -175
  10. package/src/bundle/external.ts +0 -285
  11. package/src/bundle/format.ts +0 -92
  12. package/src/bundle/import.ts +0 -157
  13. package/src/cli/index.ts +0 -1249
  14. package/src/cli/init.ts +0 -389
  15. package/src/db/schema.ts +0 -614
  16. package/src/db/store.ts +0 -4306
  17. package/src/graph/pagerank.ts +0 -53
  18. package/src/indexer/architecture.ts +0 -148
  19. package/src/indexer/behavior.ts +0 -466
  20. package/src/indexer/boundaries.ts +0 -374
  21. package/src/indexer/churn.ts +0 -58
  22. package/src/indexer/classify.ts +0 -96
  23. package/src/indexer/context.ts +0 -340
  24. package/src/indexer/continuity.ts +0 -322
  25. package/src/indexer/detectchanges.ts +0 -94
  26. package/src/indexer/discovery.ts +0 -176
  27. package/src/indexer/externaldeps.ts +0 -243
  28. package/src/indexer/freshness.ts +0 -166
  29. package/src/indexer/git.ts +0 -453
  30. package/src/indexer/index.ts +0 -1092
  31. package/src/indexer/modules.ts +0 -358
  32. package/src/indexer/preflight.ts +0 -548
  33. package/src/indexer/protoScanner.ts +0 -147
  34. package/src/indexer/risk.ts +0 -304
  35. package/src/indexer/serviceHostScanner.ts +0 -92
  36. package/src/indexer/serviceLinks.ts +0 -543
  37. package/src/indexer/shapehash.ts +0 -370
  38. package/src/indexer/skeleton.ts +0 -169
  39. package/src/indexer/symbolhistory.ts +0 -172
  40. package/src/indexer/watcher.ts +0 -206
  41. package/src/mcp/server.ts +0 -1659
  42. package/src/parser/index.ts +0 -37
  43. package/src/parser/languages/cpp.ts +0 -361
  44. package/src/parser/languages/csharp.ts +0 -235
  45. package/src/parser/languages/go.ts +0 -259
  46. package/src/parser/languages/java.ts +0 -382
  47. package/src/parser/languages/python.ts +0 -370
  48. package/src/parser/languages/rust.ts +0 -164
  49. package/src/parser/languages/typescript.ts +0 -1435
  50. package/src/parser/parserContext.ts +0 -392
  51. package/src/parser/walker.ts +0 -306
  52. package/src/parser/worker.ts +0 -181
  53. package/src/parser/workerpool.ts +0 -448
  54. package/src/scip/format.ts +0 -83
  55. package/src/scip/import.ts +0 -216
  56. package/src/types.ts +0 -457
  57. package/tests/benchmark-service-links.ts +0 -244
  58. package/tests/bug-regressions.ts +0 -626
  59. package/tests/filters.ts +0 -264
  60. package/tests/fixtures/Counter.tsx +0 -38
  61. package/tests/fixtures/caller.ts +0 -7
  62. package/tests/fixtures/collisions.ts +0 -23
  63. package/tests/fixtures/local_helper.ts +0 -5
  64. package/tests/fixtures/overloads.java +0 -17
  65. package/tests/fixtures/remote_helper.ts +0 -4
  66. package/tests/fixtures/sample.c +0 -15
  67. package/tests/fixtures/sample.cpp +0 -47
  68. package/tests/fixtures/sample.cs +0 -62
  69. package/tests/fixtures/sample.go +0 -68
  70. package/tests/fixtures/sample.h +0 -30
  71. package/tests/fixtures/sample.java +0 -85
  72. package/tests/fixtures/sample.py +0 -46
  73. package/tests/fixtures/sample.rs +0 -78
  74. package/tests/fixtures/sample.ts +0 -76
  75. package/tests/fixtures-service/HttpClients.cs +0 -30
  76. package/tests/fixtures-service/HttpClients.java +0 -24
  77. package/tests/fixtures-service/billing.ts +0 -15
  78. package/tests/fixtures-service/docker-compose.yml +0 -15
  79. package/tests/fixtures-service/gateway.ts +0 -10
  80. package/tests/fixtures-service/get_user.ts +0 -11
  81. package/tests/fixtures-service/graphql_client.ts +0 -63
  82. package/tests/fixtures-service/graphql_server.ts +0 -30
  83. package/tests/fixtures-service/grpc_client.go +0 -30
  84. package/tests/fixtures-service/http_clients.go +0 -23
  85. package/tests/fixtures-service/http_clients.py +0 -38
  86. package/tests/fixtures-service/http_clients.ts +0 -49
  87. package/tests/fixtures-service/k8s/payment-service.yaml +0 -22
  88. package/tests/fixtures-service/k8s_calls.ts +0 -20
  89. package/tests/fixtures-service/messaging.ts +0 -87
  90. package/tests/fixtures-service/trpc_client.ts +0 -39
  91. package/tests/fixtures-service/trpc_server.ts +0 -39
  92. package/tests/fixtures-service/user_service.proto +0 -33
  93. package/tests/fixtures-trackcd/Cargo.toml +0 -11
  94. package/tests/fixtures-trackcd/SpringController.java +0 -36
  95. package/tests/fixtures-trackcd/auth_service.ts +0 -19
  96. package/tests/fixtures-trackcd/complex_module.py +0 -50
  97. package/tests/fixtures-trackcd/express_app.js +0 -30
  98. package/tests/fixtures-trackcd/fastapi_app.py +0 -49
  99. package/tests/fixtures-trackcd/fastify_object_routes.js +0 -32
  100. package/tests/fixtures-trackcd/go.mod +0 -8
  101. package/tests/fixtures-trackcd/package.json +0 -15
  102. package/tests/fixtures-trackcd/requirements.txt +0 -4
  103. package/tests/fixtures-trackcd/tests/auth_service.test.ts +0 -13
  104. package/tests/fixtures-tracke/auth/AuthService.ts +0 -23
  105. package/tests/fixtures-tracke/auth/crypto.ts +0 -7
  106. package/tests/fixtures-tracke/billing/Billing.ts +0 -20
  107. package/tests/fixtures-tracke/billing/Invoice.ts +0 -10
  108. package/tests/fixtures-tracke/billing/server.ts +0 -17
  109. package/tests/fixtures-tracke/package.json +0 -7
  110. package/tests/fixtures-tracke/tests/auth.test.ts +0 -23
  111. package/tests/fixtures-tracke/tests/billing.test.ts +0 -14
  112. package/tests/fixtures-trackf/package.json +0 -5
  113. package/tests/fixtures-trackf/src/auth.ts +0 -26
  114. package/tests/fixtures-trackf/src/handlers.ts +0 -35
  115. package/tests/fixtures-tracki/billing/routes.ts +0 -12
  116. package/tests/fixtures-tracki/gateway/client.ts +0 -13
  117. package/tests/git-features.ts +0 -267
  118. package/tests/init.ts +0 -141
  119. package/tests/mcp-jit.ts +0 -130
  120. package/tests/mcp-smoke.ts +0 -191
  121. package/tests/mcp-trackcd.ts +0 -169
  122. package/tests/mcp-tracke.ts +0 -229
  123. package/tests/mcp-trackf.ts +0 -330
  124. package/tests/mcp-trackg.ts +0 -219
  125. package/tests/mcp-tracki.ts +0 -174
  126. package/tests/mcp-watcher.ts +0 -126
  127. package/tests/optspec.ts +0 -194
  128. package/tests/parallel-index.ts +0 -333
  129. package/tests/parallel-read.ts +0 -125
  130. package/tests/parallel-recovery.ts +0 -241
  131. package/tests/perf-callers.ts +0 -145
  132. package/tests/query-parity.ts +0 -184
  133. package/tests/query-perf.ts +0 -55
  134. package/tests/scale-parallel-parity.ts +0 -225
  135. package/tests/scale-test.ts +0 -523
  136. package/tests/smoke.ts +0 -396
  137. package/tests/trackcd.ts +0 -325
  138. package/tests/tracke-collisions.ts +0 -255
  139. package/tests/tracke.ts +0 -314
  140. package/tests/trackf-bugs.ts +0 -406
  141. package/tests/trackf.ts +0 -390
  142. package/tests/trackg.ts +0 -1372
  143. package/tests/tracki-boundaries.ts +0 -202
  144. package/tests/tracki-continuity.ts +0 -253
  145. package/tests/tracki-contract-diff.ts +0 -249
  146. package/tests/tracki-external-bundles.ts +0 -341
  147. package/tests/tracki-preflight.ts +0 -251
  148. package/tests/verify-roles.ts +0 -51
  149. package/tests/worker-parity.ts +0 -286
  150. package/tests/worker-pool.ts +0 -262
  151. package/tsconfig.json +0 -20
@@ -0,0 +1,219 @@
1
+ # Seer-Core — Pre-Release Stress Test Report
2
+
3
+ **Date:** 2026-05-30
4
+ **Scope:** Release-hardening pass. Simulate realistic (and weird) repositories that
5
+ exercise every Seer-Core feature, drive the MCP tools, find/fix real bugs, and
6
+ re-validate the full suite. No new features were added.
7
+
8
+ All scratch repos and harness scripts live under `.stress/` (gitignored). The
9
+ reusable MCP stdio driver is `.stress/mcpClient.ts`.
10
+
11
+ ---
12
+
13
+ ## 1. Executive Summary
14
+
15
+ - **Baseline:** full `npm test` suite green before changes.
16
+ - **2 real bugs found and fixed**, each with a new regression test in
17
+ `tests/bug-regressions.ts` (bug 9 and bug 10).
18
+ - **8 end-to-end stress scenarios** built from realistic repos, all green
19
+ (128 assertions), plus adversarial parser-robustness and a 245-file scale index.
20
+ - **4 limitations/clarifications** documented (by-design or out-of-scope, not bugs).
21
+ - Full `npm test` re-run green after the fixes.
22
+
23
+ ---
24
+
25
+ ## 2. Bugs Found and Fixed
26
+
27
+ ### Bug 9 — FastAPI route decorators mis-detected as outbound service calls
28
+ - **Symptom:** A FastAPI service indexed its own route decorators
29
+ (`@app.post("/api/payments/charge")`, `@app.get("/api/payments/{payment_id}")`)
30
+ as phantom outbound `http-client` `service_calls`. The service-link resolver
31
+ then **self-linked a route to its own registration site** (e.g. the
32
+ `/api/payments/{payment_id}` route linked to a phantom client call of the same
33
+ path). An agent reading `seer_service_calls` would see a service "calling"
34
+ its own endpoints — misleading data.
35
+ - **Root cause:** The walker's route/service-call de-duplication is *node-level*
36
+ (`src/parser/walker.ts`): it suppresses a service call only when the **same**
37
+ AST node also produced a route. For Express (`app.get("/x", h)`) the route and
38
+ the call are the same `call_expression`, so it works. For FastAPI the route is
39
+ emitted on the parent `decorator` node while `tryExtractServiceCalls` fires on
40
+ the inner `call` node — different nodes — so the guard never fired. (Flask
41
+ `@app.route` slipped past because `route` isn't an HTTP verb.)
42
+ - **How it was found:** `.stress/micro.ts` — a 3-service repo (TS/Express gateway
43
+ → Python/FastAPI payments → Python/Flask notifications). `seer_service_calls`
44
+ returned 5 calls, 2 of which were FastAPI decorators; one route self-linked.
45
+ - **Fix:** `src/parser/languages/python.ts` `tryExtractServiceCalls` returns
46
+ `null` when `node.parent?.type === 'decorator'` — a decorator call is a
47
+ registration, never an outbound client.
48
+ - **Regression:** `tests/bug-regressions.ts` → `bug9_fastapiDecoratorNotServiceCall`.
49
+
50
+ ### Bug 10 — TS template-literal path params dropped, breaking route matching
51
+ - **Symptom:** `axios.get(`http://svc/api/users/${id}`)` normalized to
52
+ `/api/users` — the `${id}` path segment vanished. The call then could not
53
+ match a `/api/users/:id` route (segment-count mismatch), so a real
54
+ cross-service link **silently failed to resolve**.
55
+ - **Root cause:** `readTemplateString` in `src/parser/languages/typescript.ts`
56
+ dropped *every* `${...}` substitution. For a path parameter this collapsed the
57
+ segment count that `routePatternsMatch` relies on.
58
+ - **How it was found:** `.stress/micro.ts` (gateway `getUser()` →
59
+ `/api/users/<id>`) and again in `.stress/external.ts` (shop `getInvoice()` →
60
+ billing `/api/invoices/<invoice_id>`).
61
+ - **Fix:** non-env substitutions now emit a single `:param` placeholder segment
62
+ so the segment count is preserved; env-base substitutions
63
+ (`${process.env.X}/charge`) still drop (preserving `env_base` matching and the
64
+ recovered `envKey`).
65
+ - **Regression:** `tests/bug-regressions.ts` → `bug10_tsTemplatePathParam`
66
+ (asserts both the `:param` preservation and the unchanged env-base path).
67
+
68
+ Both fixes are conservative and node-local; the Track G suite (312 assertions)
69
+ and SeerBench (precision/recall ≥ 0.9) remained green after the change.
70
+
71
+ ---
72
+
73
+ ## 2b. Enhancements Implemented (follow-up pass)
74
+
75
+ Two of the documented limitations were promoted to fixes after review, each with
76
+ a regression in `tests/bug-regressions.ts` (bug 11, bug 12). Full suite + all
77
+ stress scenarios green afterward.
78
+
79
+ ### Rec 2 — C++ out-of-line method definitions now reconstruct the class scope
80
+ - `T Vec<T>::dot(...)` defined at namespace scope used to qualify as `geo.dot`
81
+ (reads like a free function). It now folds the owner scope from the
82
+ `qualified_identifier` declarator → `geo.Vec.dot`. Also fixes a latent
83
+ collision: `Foo::bar` and `Baz::bar` at the same scope stayed distinct
84
+ (`Foo.bar`/`Baz.bar`) instead of collapsing to `bar`/`bar#1`.
85
+ - Mechanism: new optional `SymbolDef.scopePath` (the one sanctioned scope hint;
86
+ extractors still return short names). The walker folds it into the qualified
87
+ name and keys overload disambiguation on `(scope + name)`.
88
+ - Files: `src/types.ts`, `src/parser/walker.ts`, `src/parser/languages/cpp.ts`.
89
+ - Verified on the Unreal fixture too: `APickupItem::OnPickedUp` → `APickupItem.OnPickedUp`.
90
+
91
+ ### Rec 3 — `seer_definition` `file` filter accepts a path-suffix on a boundary
92
+ - The `file` disambiguator was exact-match only; a basename (`svc.ts`) couldn't
93
+ match rel_path `src/svc.ts` and silently returned nothing — a wasted
94
+ round-trip. It now matches an absolute path, the exact rel_path, OR a trailing
95
+ fragment aligned to a `/` boundary (so `auth.ts` never matches `oauth.ts`),
96
+ with LIKE metacharacters escaped (a `_` in a filename can't act as a wildcard).
97
+ Improves `seer_definition`/`seer_context`/`seer_risk`/`seer_continuity` at once.
98
+ - Files: `src/db/store.ts` (`getDefinition`, `escapeLike`), `src/mcp/server.ts`
99
+ (tool description).
100
+
101
+ ## 2c. AI-Agent Optimization Spec — implemented (separate pass)
102
+
103
+ A six-section "AI-agent optimization" proposal was critiqued and the surviving
104
+ items implemented (§6 SCIP auto-download was rejected outright — it violates the
105
+ local-first/zero-native-dep/deterministic contract and was NOT built). All are
106
+ deterministic, local, zero-AI. Covered by `tests/optspec.ts` (35 assertions,
107
+ wired into `test:mcp`).
108
+
109
+ - **§3 `seer_skeleton`** — deterministic source elision. Renders a file with
110
+ every symbol signature kept and bodies collapsed to `{ … N lines … }` fold
111
+ markers (exact line counts). Nesting is reconstructed from line-range
112
+ containment, so it is language-agnostic. `focusSymbol` expands one body
113
+ verbatim. Byte-identical on re-render. New: `src/indexer/skeleton.ts`.
114
+ - **§2 Did-you-mean** — when `seer_definition` / `seer_symbols` / `seer_callers`
115
+ / `seer_risk` / `seer_context` / `seer_behavior` / `seer_symbol_module` /
116
+ `seer_continuity` resolve to nothing, the response carries a `didYouMean`
117
+ array of up to 5 BM25/FTS suggestions. **Suggestion-only** — never
118
+ substituted, never used to compute risk on a guessed symbol.
119
+ - **§1 Token budget** — optional `tokenBudget` on the high-volume list tools
120
+ (`seer_symbols`, `seer_definition`, `seer_callers`, `seer_callees`,
121
+ `seer_complexity`, `seer_service_calls`, `seer_service_links`). Deterministic
122
+ prefix-trim on serialized char length (~4 chars/token), keeps the
123
+ highest-ranked rows, flags `truncated`/`omitted`. Absent budget ⇒ byte-identical
124
+ to prior output. The high-fan-in caller path is **not** re-sorted.
125
+ - **§5a Lazy lifecycle** — derived passes (modules / shape-hash / symbol-history)
126
+ now auto-build on first dependent query (extends the JIT-freshness philosophy).
127
+ The three `*_build` tools are rebranded "(Advanced — usually unnecessary)" but
128
+ kept registered for forced rebuilds.
129
+ - **§5b `seer_trace` umbrella** — one scope-dispatch entry
130
+ (`callers|callees|path|file|module|service|service_path|module_service`) over
131
+ the existing `seer_trace_*` family (which remain for direct/power use).
132
+ Delegate throws are caught and returned as clean advisory errors.
133
+ - **§4 `seer_batch`** — run up to 25 read-only tools in one call; sequential,
134
+ one failure never aborts the rest, cannot nest. Saves agent turns on known
135
+ fan-out.
136
+ - Files: `src/mcp/server.ts` (handler registry + wrapper, helpers, new tools),
137
+ `src/indexer/skeleton.ts`, `tests/optspec.ts`, `package.json` (test wiring).
138
+
139
+ ## 3. Limitations / Clarifications (not bugs)
140
+
141
+ 1. **Server-side HTTP route extraction is framework-limited.** Routes are
142
+ extracted only for Java(Spring), Python(FastAPI/Flask), TS(Express/Fastify/
143
+ tRPC/GraphQL). **Go `net/http`/gin/chi, Rust axum/actix, C# ASP.NET, C++**
144
+ have no HTTP route extraction, so such a backend cannot be a cross-service
145
+ link *target* over HTTP (it can still be a client; Go/Java/C# are gRPC
146
+ clients and gRPC routes come from `.proto`). This matches the master guide's
147
+ documented route list but is worth surfacing for polyglot microservice maps.
148
+
149
+ 2. ~~C++ out-of-line method qualified names drop the class scope.~~ **FIXED —
150
+ see §2b Rec 2.**
151
+
152
+ 3. ~~`seer_definition` `file` filter is exact-match.~~ **FIXED — see §2b Rec 3.**
153
+
154
+ 4. **Continuity is a snapshot shape-matcher, not a historical-shape tracer.** It
155
+ links a rename/move only when both identities coexist in the working tree
156
+ (e.g. a kept alias) — a true cross-commit rename where the old symbol is gone
157
+ yields **no** continuity candidate (correctly; it never invents one).
158
+ Cross-commit lineage is delivered instead by `seer_history` (git `--follow` +
159
+ line-overlap), which was verified to trace across a file move **and** a rename
160
+ back to the pre-rename commit. The headline "trace refactoring across
161
+ renames/moves" is thus fulfilled by history; continuity is advisory snapshot
162
+ evidence. Honest behavior, no false positives.
163
+
164
+ ### Minor test-quality notes (correct but low-power assertions)
165
+ `tests/tracke.ts:248`, `tests/trackf.ts:164`, `tests/trackg.ts:1332`,
166
+ `tests/tracki-boundaries.ts:174`, `tests/tracki-external-bundles.ts:58`, and
167
+ `tests/worker-pool.ts:224` assert `>= 0` on counts or `assert(true)` (i.e.
168
+ "it ran / is a valid number"). Not wrong, but they cannot fail; could be
169
+ strengthened to assert concrete values.
170
+
171
+ ---
172
+
173
+ ## 4. Scenarios Validated (all green)
174
+
175
+ | # | Scenario | Harness | Result |
176
+ |---|----------|---------|--------|
177
+ | 1 | Polyglot weird syntax — 9 languages + edge cases (overloads, generics, decorators, unicode idents, metaclass, records, out-of-line methods, C body-gate, JSX/TSX, broken syntax, BOM/CRLF, empty, comments-only) | `.stress/polyglot.ts` | 35/35 |
178
+ | 2 | Microservices cross-service links (HTTP literal + param across TS/FastAPI/Flask) | `.stress/micro.ts` | 14/14 |
179
+ | 3 | Rename/move continuity over **real git history** (history traces across move+rename; continuity is honest) | `.stress/continuity.ts` | 7/7 |
180
+ | 4 | Monorepo boundaries + cross-boundary crossing flags in risk | `.stress/boundaries.ts` | 11/11 |
181
+ | 5 | Watcher + JIT freshness under 15-edit burst (instant, max 25ms, no stalls/leaks/dups, prune on delete) | `.stress/watcher.ts` | 24/24 |
182
+ | 6 | SCIP compiler-precision overlay merges with AST (no duplicate clutter, idempotent, provenance) | `.stress/scip.ts` | 10/10 |
183
+ | 7 | External bundle layers across **two repos** + idempotent/forced re-import + contract diff | `.stress/external.ts` | 12/12 |
184
+ | 8 | Scale modify/reindex/git cycle on helix-core (45 Rust files: cache reuse, prune, move, delete, add, churn) | `.stress/scale-modify.ts` | 15/15 |
185
+
186
+ **Plus:** adversarial parser robustness (300KB single line, 150-level nesting,
187
+ random-byte `.ts`) — no crash, WASM runtime survived, sibling files still
188
+ indexed; and a full helix-master scale index (245 files / 5,207 symbols /
189
+ 24,057 edges in ~14s) matching the documented scale matrix.
190
+
191
+ ---
192
+
193
+ ## 5. How to Reproduce
194
+
195
+ ```bash
196
+ npm run build
197
+ # individual scenarios:
198
+ npx tsx .stress/polyglot.ts
199
+ npx tsx .stress/micro.ts
200
+ npx tsx .stress/continuity.ts
201
+ npx tsx .stress/boundaries.ts
202
+ npx tsx .stress/watcher.ts
203
+ npx tsx .stress/scip.ts
204
+ npx tsx .stress/external.ts
205
+ npx tsx .stress/scale-modify.ts
206
+ # regressions for the two fixes:
207
+ npx tsx tests/bug-regressions.ts
208
+ # full suite:
209
+ npm test
210
+ ```
211
+
212
+ ---
213
+
214
+ ## 6. Files Changed
215
+
216
+ - `src/parser/languages/python.ts` — bug 9 fix (decorator guard).
217
+ - `src/parser/languages/typescript.ts` — bug 10 fix (template path-param placeholder).
218
+ - `tests/bug-regressions.ts` — new regressions bug 9 + bug 10 (+ header).
219
+ - `.gitignore` — ignore `.stress/` scratch.