Skip to content

feat(pipeline): emit CALLS edges for decorator applications#208

Open
map588 wants to merge 3 commits intoDeusData:mainfrom
map588:feat/decorator-references
Open

feat(pipeline): emit CALLS edges for decorator applications#208
map588 wants to merge 3 commits intoDeusData:mainfrom
map588:feat/decorator-references

Conversation

@map588
Copy link
Copy Markdown
Contributor

@map588 map588 commented Apr 5, 2026

Decorators previously only created DECORATES edges. References like @login_required were invisible to "find all references" queries which look for CALLS and USAGE edges. Now both sequential (resolve_decorator) and parallel (resolve_def_decorators) paths emit a CALLS edge alongside DECORATES.

Uses "{}" properties to avoid clobbering richer metadata from pass_calls when a function both has @decorator and calls decorator() directly.

Decorators previously only created DECORATES edges. References like
@login_required were invisible to "find all references" queries which
look for CALLS and USAGE edges. Now both sequential (resolve_decorator)
and parallel (resolve_def_decorators) paths emit a CALLS edge alongside
DECORATES.

Uses "{}" properties to avoid clobbering richer metadata from pass_calls
when a function both has @decorator and calls decorator() directly.
Copilot AI review requested due to automatic review settings April 5, 2026 03:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the indexing pipeline so decorator applications (e.g., @login_required) also emit CALLS edges (in addition to DECORATES) to make decorators visible to reference queries that traverse CALLS / USAGE relationships.

Changes:

  • Emit a CALLS edge alongside DECORATES in the sequential semantic pass (resolve_decorator).
  • Emit a CALLS edge alongside DECORATES in the parallel semantic resolver (resolve_def_decorators).
  • Use "{}" edge properties to avoid overwriting richer CALLS metadata produced by pass_calls when an edge already exists.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/pipeline/pass_semantic.c Adds a synthetic CALLS edge for each resolved decorator in the sequential semantic pass.
src/pipeline/pass_parallel.c Adds a synthetic CALLS edge for each resolved decorator in the parallel semantic resolver path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

map588 and others added 2 commits April 5, 2026 15:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@map588
Copy link
Copy Markdown
Contributor Author

map588 commented Apr 5, 2026

I noticed CBM was marking python functions as dead, because it had no callers, however the decorators were not taken into account. This marks them as "USAGE", so functions do not get falsely flagged as dead. @DeusData

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.

2 participants