orchestrion icon indicating copy to clipboard operation
orchestrion copied to clipboard

feat(injector): Add return-implements function join point

Open kakkoyun opened this issue 8 months ago • 5 comments

  • feat(injector/join): add 'return-implements' function join point

Adds the return-implements: "" selector to the function join point. This allows matching functions where at least one return value implements the specified interface, respecting Go's structural typing. Includes a test case (testdata/injector/return-implements) covering standard library and custom types.

--

Fixes #538

ref: https://github.com/DataDog/orchestrion/discussions/537 xref: https://github.com/DataDog/dd-trace-go/issues/3168 xref: LANGPLAT-159

kakkoyun avatar Apr 09 '25 11:04 kakkoyun

This stack of pull requests is managed by Graphite. Learn more about stacking.

kakkoyun avatar Apr 09 '25 11:04 kakkoyun

PTAL @korECM

kakkoyun avatar Apr 09 '25 11:04 kakkoyun

Do you mind adding tests for generic interfaces and generic interface implementations ?

What do you exactly mean by generic interfaces? Could you give me an example?

kakkoyun avatar Apr 24 '25 14:04 kakkoyun

@kakkoyun I mean making sure the new join-point interact correctly with concrete types having a generic component and interfaces declared in the join-point being able to be generic.

Concretely simply adding tests in internal/injector/testdata/injector/result-implements-join/config.yml would be enough for me

eliottness avatar Apr 28 '25 07:04 eliottness

@kakkoyun I mean making sure the new join-point interact correctly with concrete types having a generic component and interfaces declared in the join-point being able to be generic.

Concretely simply adding tests in internal/injector/testdata/injector/result-implements-join/config.yml would be enough for me

It was a good call! Handled as part of 9721aaa3e1f43440c643438ee7f493fcfab9879a

kakkoyun avatar May 26 '25 14:05 kakkoyun

Codecov Report

Attention: Patch coverage is 56.72515% with 74 lines in your changes missing coverage. Please review.

Project coverage is 66.32%. Comparing base (983120d) to head (cda266d). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/injector/aspect/join/function.go 57.30% 30 Missing and 8 partials :warning:
internal/injector/typed/typecheck.go 58.82% 19 Missing and 9 partials :warning:
internal/injector/aspect/context/context.go 0.00% 8 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #602      +/-   ##
==========================================
- Coverage   70.14%   66.32%   -3.83%     
==========================================
  Files         109      110       +1     
  Lines        7517     7682     +165     
==========================================
- Hits         5273     5095     -178     
- Misses       1718     2056     +338     
- Partials      526      531       +5     
Components Coverage Δ
Generators 80.24% <ø> (ø)
Instruments ∅ <ø> (∅)
Go Driver 75.81% <ø> (-0.70%) :arrow_down:
Toolexec Driver 67.37% <ø> (-3.46%) :arrow_down:
Aspects 71.76% <54.90%> (-5.16%) :arrow_down:
Injector 72.49% <56.72%> (-3.98%) :arrow_down:
Job Server 65.91% <ø> (-3.32%) :arrow_down:
Other 66.32% <56.72%> (-3.83%) :arrow_down:
Files with missing lines Coverage Δ
internal/injector/aspect/advice/code/dot.go 79.06% <ø> (ø)
...ternal/injector/aspect/advice/code/dot_function.go 56.94% <100.00%> (-6.49%) :arrow_down:
internal/injector/check.go 71.79% <100.00%> (+0.74%) :arrow_up:
internal/injector/aspect/context/context.go 72.79% <0.00%> (-21.74%) :arrow_down:
internal/injector/typed/typecheck.go 58.82% <58.82%> (ø)
internal/injector/aspect/join/function.go 66.66% <57.30%> (-6.87%) :arrow_down:

... and 25 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 05 '25 15:06 codecov[bot]

@kakkoyun Hi! I've confirmed that this has been deployed in v1.5.0.

However, after looking at the orchestrion.yml file, it seems that ResultOfType is still being used. This makes me think that while the join point support has been added, it's not actually capturing errors yet.

Could you please confirm if my understanding is correct?

korECM avatar Jul 18 '25 04:07 korECM

Hey 👋 Yes, we haven't utilizing the new improvements yet.

Feel free to test it out and contribute the changes in your mind.

Otherwise, we are working on a related issue and we will handle it as part of that.

cc @hannahkm

kakkoyun avatar Jul 18 '25 05:07 kakkoyun