Skip to content

feat(query): expose hidden QueryEngine APIs#12

Merged
tob-scott-a merged 1 commit into
mainfrom
expose-hidden-apis
Apr 23, 2026
Merged

feat(query): expose hidden QueryEngine APIs#12
tob-scott-a merged 1 commit into
mainfrom
expose-hidden-apis

Conversation

@tob-scott-a

Copy link
Copy Markdown
Collaborator

Five methods existed in GraphStore but had no public-facing analogue, forcing skills to reach into private internals (engine._store) or drop into Python to compute answers Trailmark already knew:

  • ancestors_of(name): every function/method that can transitively reach the named node. The dual of callees_of, extended transitively. Upward slicing for audit: "given this sink, who could hit it?"
  • reachable_from(name): transitive closure of callees_of.
  • entrypoint_paths_to(name): call paths from any entrypoint to a sink. Answers the canonical attack-surface question; pairs with the recently-added entrypoint detection.
  • nodes_with_annotation(kind): slice the graph by audit state (e.g. all nodes tagged FINDING).
  • functions_that_raise(exception_name): consumes the parser-populated but previously-unqueried exception_types field on CodeUnit.

12 new tests covering direct/transitive behavior, unknown-node cases, and the module/contains-edge interaction in ancestor queries.

Five methods existed in GraphStore but had no public-facing analogue,
forcing skills to reach into private internals (`engine._store`) or
drop into Python to compute answers Trailmark already knew:

- ancestors_of(name): every function/method that can transitively reach
  the named node. The dual of callees_of, extended transitively.
  Upward slicing for audit: "given this sink, who could hit it?"
- reachable_from(name): transitive closure of callees_of.
- entrypoint_paths_to(name): call paths from any entrypoint to a sink.
  Answers the canonical attack-surface question; pairs with the
  recently-added entrypoint detection.
- nodes_with_annotation(kind): slice the graph by audit state
  (e.g. all nodes tagged FINDING).
- functions_that_raise(exception_name): consumes the parser-populated
  but previously-unqueried `exception_types` field on CodeUnit.

12 new tests covering direct/transitive behavior, unknown-node cases,
and the module/contains-edge interaction in ancestor queries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tob-scott-a
tob-scott-a merged commit 57ade4c into main Apr 23, 2026
13 checks passed
@tob-scott-a
tob-scott-a deleted the expose-hidden-apis branch April 23, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant