Skip to content

fix(injector): preserve negated may matches - #857

Merged
kakkoyun merged 1 commit into
mainfrom
eliottness/fix-negated-may-filter
Jul 24, 2026
Merged

kakkoyun merged 1 commit into
mainfrom
eliottness/fix-negated-may-filter

Conversation

@eliottness

Copy link
Copy Markdown
Contributor

Summary

  • make MatchType.Not conservative for existential may-match results
  • prevent negated receiver constraints from filtering an aspect before AST matching
  • add an injector regression fixture for crypto/sha1.Sum versus (*digest).Sum

Root cause

may.Match means that at least one node may match. Negating that result as NeverMatch was unsound: a package can contain both a matching receiver method and another function that satisfies the complete join point. The early package filter therefore discarded the aspect before node-level matching could distinguish them.

Testing

  • go test -count=1 -run 'Test/function-body-negated-receiver$' -v ./internal/injector\n- GOPROXY=https://proxy.golang.org,direct go test -race -shuffle=on -count=1 ./internal/injector/...\n- golangci-lint run ./internal/injector/aspect/may/... ./internal/injector/aspect/join/... ./internal/injector/parse/...\n- GOPROXY=https://proxy.golang.org,direct go build ./...

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 73.82%

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 34c800c | Docs | Datadog PR Page | Give us feedback!

@eliottness
eliottness force-pushed the eliottness/fix-negated-may-filter branch from 9a0e645 to 34c800c Compare July 24, 2026 10:25
@eliottness
eliottness marked this pull request as ready for review July 24, 2026 11:20
@eliottness
eliottness requested a review from a team as a code owner July 24, 2026 11:20
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.11%. Comparing base (e061d12) to head (34c800c).
⚠️ Report is 99 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #857      +/-   ##
==========================================
+ Coverage   65.72%   75.11%   +9.39%     
==========================================
  Files         113      118       +5     
  Lines        7926     7036     -890     
==========================================
+ Hits         5209     5285      +76     
+ Misses       2192     1556     -636     
+ Partials      525      195     -330     
Components Coverage Δ
Generators 83.23% <ø> (+2.98%) ⬆️
Instruments ∅ <ø> (∅)
Go Driver 78.46% <70.06%> (+2.65%) ⬆️
Toolexec Driver 82.80% <100.00%> (+15.27%) ⬆️
Aspects 82.27% <80.30%> (+10.35%) ⬆️
Injector 82.99% <81.14%> (+10.19%) ⬆️
Job Server 75.60% <60.00%> (+9.68%) ⬆️
Other 75.11% <70.59%> (+9.39%) ⬆️
Files with missing lines Coverage Δ
internal/injector/aspect/may/match.go 90.90% <100.00%> (+6.29%) ⬆️

... and 106 files with indirect coverage changes

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

@RomainMuller
RomainMuller added this pull request to the merge queue Jul 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 24, 2026
@kakkoyun
kakkoyun added this pull request to the merge queue Jul 24, 2026
Merged via the queue into main with commit 610657f Jul 24, 2026
82 checks passed
@kakkoyun
kakkoyun deleted the eliottness/fix-negated-may-filter branch July 24, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants