Repository navigation
fix(analyzer): stop hangs on large files and ground detection in evidence - #144
Merged
Merged
Conversation
…ect evidence Stability - ts-morph symbol lines come from a LineIndex. getStartLineNumber() recounts newlines from the top of the file on every call, so a 4 MB file with 50k functions never finished; it now takes about 3 s. - The four import/export regexes take their clause from IMPORT_CLAUSE. The old unbounded [^'"]+ rescanned a quote-free file from every `export` (20k exports cost 15 s). - camelCase splitting uses lookarounds: 100k capitals cost 3.4 s, now none. - Scanner: files over 5 MB are listed but not read (reported in warnings, size goes into the fingerprint), so six 400 MB data files no longer exhaust the heap. Symlinks that resolve outside the project are skipped, lines are counted without splitting. - Every text sort goes through compareText (one Intl.Collator). localeCompare follows LANG and changed snapshots under cs_CZ and tr_TR. Grounding - Language is "unknown" for projects without TS/JS files (Django was typescript). - A server framework that is only a devDependency counts when production code imports it (ky was reported as an Express api-service). - .d.ts files are never entry points; test-d/ is non-production source. - workspaceType comes from declared members (workspaces, pnpm-workspace.yaml packages), not from the file existing or a second package.json. - Registry signals keep only the search terms found in the project's evidence. - Duplicate feature names get a folder hint and agent-navigation ids are unique, so no feature map is silently dropped. - Domain inference validates the model answer and the cache with zod, only keeps features that name known entities, and merges on a copy. - The snapshot fingerprint includes the DevMap version. 30 new tests (538 total). 13 of the 18 grounding tests fail on main; the 12 stability tests need the new modules. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AgTNRWDMVo2d462doRNBUc
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Welcome ke DevMap!Terima kasih sudah buat PR. Pastikan checklist ini terpenuhi sebelum review:
CI akan jalan otomatis pada setiap update. Kalau gagal, akan muncul link run di komentar ini. Kalau DevMap membantu, tolong star ya: https://github.com/itsflaid/devmap Terima kasih kontribusinya! 🙏 |
Merged
This branch was successfully deployed
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.
Summary
Audit of the static analyzer for two things: it must not hang or crash on unusual projects, and it must not report anything the project does not support. Run against 12 real repositories (Next, Nuxt, Astro, Remix, SvelteKit, Nest, Fastify, Express, Django, a library, a Turborepo monorepo) and 13 adversarial projects, comparing snapshots before and after each change.
Paths and graph edges were already sound: every path and edge in every snapshot points at a real file. The problems were elsewhere.
Stability
getStartLineNumber()recounts newlines from the top on every callLineIndex(same numbers)import/export ... fromregexes use an unbounded[^'"]+, so a quote-free file is rescanned from everyexportIMPORT_CLAUSEwarnings, and their size feeds the fingerprintsrc/passwd.ts -> /etc/passwdappeared in the maprealpathleaves the rootrelatedEntitiesreturned as a string threw during merge; a bad cache repeated the crash on every runString#localeComparecalls followLANGcs_CZortr_TRcompareTextoverIntl.Collator("en"); 12/12 identical under both localesThe snapshot fingerprint now includes the DevMap version, so a snapshot written by an older release is regenerated once instead of reused.
Grounding
unknownwhen there are no TS/JS files (Django was reported astypescript).devDependenciescounts only when production code imports it (ky was reported as an Expressapi-servicebecause of its test server)..d.tsfiles are never entry points, andtest-d/is non-production source.workspaceTypecomes from declared workspace members (workspaces,packages:inpnpm-workspace.yaml), not from a file existing or a secondpackage.json.Home (homes)) and agent-navigation ids are unique, so a feature map is no longer dropped silently.Verification
analyzer-stability.test.tsandanalyzer-grounding.test.ts; 13 of the 18 grounding tests fail onmain.tsc --noEmit,pnpm build,--version,mcp-smokeandpackage-e2epass locally (Linux, Node 22). The macOS/Windows and Node 24 matrix has not run yet.Not in this PR
confidencemeasures parse quality, not evidence strength:projectMap.tslifts any feature with two files (one parsed by ts-morph) tohigh, so a folder namedsearch/reads the same as an imported vendor package. A cap on path-only signals was tried and removed because that boost overrides it. This needs a design decision, and is noted inCLAUDE.md.getExportedDeclarations(); replacing it with syntax-level export reading would be faster but riskier.snapshotEnrichment.tsparses the AI answer without stripping code fences, so a fenced answer skips enrichment (non-fatal).Review notes
projectMap.ts,featureDetector.tsandtsMorphAnalyzer.ts, so splitting by theme would need partial staging.Generated by Claude Code