Begin adding typescript frontend for CLDK#158
Closed
rahlk wants to merge 6 commits into
Closed
Conversation
Signed-off-by: Rahul Krishna <rkrsn@ibm.com>
…analyzer-ts graph) Add TSNeo4jBackend, a drop-in alternative to the in-memory TSCodeanalyzer that answers the exact same get_* query surface (call graph, callers/callees, class hierarchy, call sites, decorators, symbol/method/field lookups, imports/exports/ variables, ...) by running Cypher over a live Neo4j graph instead of walking the pydantic / NetworkX structures. The graph is the one codeanalyzer-typescript emits with `--emit neo4j` (schema schema.neo4j.json). The backend can populate the database for you over Bolt (running the analyzer with --emit neo4j --neo4j-uri), or query a DB that is already loaded (build_db=False). Results are re-hydrated into the same cldk.models.typescript pydantic objects the in-memory backend returns; lossy fields inherent to the projection (collapsed comments/type-params, aggregated import edges, the three round-tripped CALLS tag keys) are reconstructed best-effort and documented inline. - cldk/analysis/typescript/neo4j/: backend, model reconstruction, Neo4jConnectionConfig. - TypeScriptAnalysis / CLDK.analysis: optional neo4j_config selects the backend; default behavior unchanged. - pyproject: optional `neo4j` extra for the driver. - tests: live-DB integration tests (skipped when no Neo4j reachable) mirroring the in-memory backend's sample-app expectations, plus no-DB backend-selection unit tests.
Extract TSAnalysisBackend (cldk/analysis/typescript/backend.py), an abstract base declaring the full 40-method query surface the TypeScriptAnalysis facade delegates to. Both backends now implement it: - TSCodeanalyzer (in-memory pydantic / NetworkX) - TSNeo4jBackend (Cypher over Neo4j) The facade<->backend relationship is now enforced by the type system and at instantiation time, instead of matching only by convention. Facade `backend` is typed against the ABC. Added a contract test asserting both backends subclass it, fully implement it, and preserve every method signature.
Mirror the TypeScript TSAnalysisBackend pattern for Java and Python, in
anticipation of Neo4j/Cypher backends for those languages too:
- cldk/analysis/java/backend.py: JavaAnalysisBackend (36-method surface);
JCodeanalyzer now subclasses it.
- cldk/analysis/python/backend.py: PythonAnalysisBackend (21-method surface);
PyCodeanalyzer now subclasses it.
Both facades type their `backend` attribute against the ABC, so a future
alternative backend can be selected without touching the facade. Added contract
tests for each (subclass, abstract/not-instantiable, fully-implemented, and that
the ABC covers every method the facade delegates to).
use_ray is already lifted all the way up (CLDK.analysis → PythonAnalysis → PyCodeanalyzer → AnalysisOptions.using_ray), but unlike use_codeql and cache_dir it had no regression test. Add test_use_ray_forwarded_through_facade mirroring the existing use_codeql guard, so the facade can't silently drop the flag.
f0188ad to
0a4f6da
Compare
Collaborator
Author
|
Closing in favor of #159, which tracks the same changes from the Generated by Claude Code |
rahlk
added a commit
that referenced
this pull request
Jun 23, 2026
… fixes the emitter gaps
- reconstruct: a field with no initializers rehydrates to {} (not None), matching
the analyzer's analysis.json representation.
- Verified codeanalyzer-java 2.4.1 fixes the three projection gaps (#156/#157/#158):
rebuilt the 2.4.1 jar and re-ran the daytrader parity — fields no longer collapse
(642 JField nodes), imports link to :JType (1449), and J_CALLS went 287 -> 1702
(97% parity; the residual is external-target gating + run-to-run WALA variance
between the separate --emit json and --emit neo4j invocations). Docstring/CHANGELOG
updated; the SDK still pins 2.4.0 until 2.4.1 is released.
rahlk
added a commit
that referenced
this pull request
Jun 23, 2026
…r at 2.4.1 The Java analyzer jar is no longer a pip dependency — the SDK release workflow downloads the latest codeanalyzer-java jar (now v2.4.1) into the bundled jar/ dir. The earlier codeanalyzer-java==2.4.0 entry in [project.dependencies] was broken (2.4.x is not on PyPI; PyPI tops out at 2.3.7), so remove it and bump the [tool.backend-versions] marker to 2.4.1. v2.4.1 is now the latest release and fixes the field/import/call-graph projection gaps (#156/#157/#158), so a graph emitted by the bundled analyzer is a complete projection.
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.
Signed-off-by: Rahul Krishna rkrsn@ibm.com