Skip to content

TypeScript: get_call_graph, get_classes and get_symbol_table never gained Python's scoping keywords #352

Description

@rahlk

Describe the bug

TypeScriptAnalysis carries three accessors that PythonAnalysis gained scoping keywords for and
TypeScript never did. On a large application the unscoped call is the only call available, and it
is the expensive one:

accessor PythonAnalysis TypeScriptAnalysis
get_call_graph (*, roots=None, depth=None) ()
get_classes (*, module=None) ()
get_symbol_table (*, paths=None) ()

docs/agent-api-reference.md records the Python cost of the unscoped forms (12s / 10s / 12s on
odoo; get_call_graph() alone is 364,752 edges) precisely because the scoped form is the one an
agent should reach for. A TypeScript caller has no scoped form.

Expected behavior

The three take the same keyword-only optionals PythonAnalysis takes, with the same names,
defaults and semantics, on both the local and the Neo4j backend. roots=/depth= scope the call
graph; module= scopes the class map to one module key; paths= scopes the symbol table.

Additional context

Leg 2.5b (#343) recorded all five entries of
tests/analysis/typescript/test_typescript_public_surface.py's
KNOWN_ARGUMENT_DIVERGENCES as "a pre-existing 1.x-era gap rather than this leg's". True of
origin, but not of scope: these three are open scope items against the leg's own definition of
done (parity of the shared surface), and adding a keyword-only optional with a default would not
have touched the Iron Rule that no existing signature moves. The ledger comment now names them as
open scope pointing here; the two remaining entries (get_callers / get_callees, which keep
TypeScript's optional method argument) are genuinely benign and stay recorded as such.

CAVEATS

  • Adding an optional keyword is not a break, but the default must stay the unscoped answer
    every existing TypeScript caller passes nothing today.
  • Both backends must gain it together, or the divergence moves from "TypeScript vs Python" to
    "TypeScript-local vs TypeScript-Neo4j", which is worse.
  • get_call_graph's roots=/depth= on TypeScript must decide what a module caller means at
    a root (TS-11 keeps module callers where Python drops them); that is a design question, not a
    mechanical port.

DEFINITION OF DONE

  • The three signatures match PythonAnalysis's exactly, on the facade and both backends.
  • KNOWN_ARGUMENT_DIVERGENCES in tests/analysis/typescript/test_typescript_public_surface.py is
    down to get_callers / get_callees, deleted from rather than muted — the ledger's own
    test_a_recorded_divergence_is_still_a_divergence forces that.
  • A scoped call is measurably cheaper than the unscoped one on the reference graph, with the number
    recorded the way the Python ones are in docs/agent-api-reference.md.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions