Skip to content

Conversation

lavarou
Copy link
Member

@lavarou lavarou commented Aug 7, 2025

When Composer runtime API is used to get packages information, the
agent should not generate packages information using legacy methods.
This solves the problem of package data detected with the help of
Composer's runtime API not to be sent to the backend in environments
using “once-per-process” setting. The reason for is that the first
request generates package information using Composer's runtime API
but every next request only generates package information using legacy
method. This in conjunction with the fact that daemon is only sending
the last package information received from the daemon leads to a
situation that package information returned by Composer runtime API
is lost and never makes it to the backend.

lavarou added 7 commits August 6, 2025 18:09
When Composer runtime API was used to get packages information in once
per process configuration, don't generate packages information using
legacy methods.
Don't generate packages information using legacy methods if Composer API
was used to get packages information regardless if it's used once per
process or once per request.
Test that legacy package information is not added after Composer API was
successfully used.
There's no need for additional state to call Composer API only once per process
- composer_packages_detected global state can be used for per-process detection
as well as per-request.
When use Composer API once per process is set, prevent calling the API
when calling Composer API fails for whatever reason. This also means that
legacy package information will be used when Composer API call failed.
@lavarou lavarou added this to the next-release milestone Aug 7, 2025
@lavarou lavarou self-assigned this Aug 7, 2025
@newrelic-php-agent-bot
Copy link

newrelic-php-agent-bot commented Aug 7, 2025

Test Suite Status Result
Multiverse 16/16 passing
SOAK 85/85 passing

@codecov-commenter
Copy link

codecov-commenter commented Aug 7, 2025

Codecov Report

❌ Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.12%. Comparing base (c395102) to head (684df0a).

Files with missing lines Patch % Lines
agent/lib_composer.c 72.72% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1107   +/-   ##
=======================================
  Coverage   78.11%   78.12%           
=======================================
  Files         193      193           
  Lines       27979    27989   +10     
=======================================
+ Hits        21857    21866    +9     
- Misses       6122     6123    +1     
Flag Coverage Δ
agent-for-php-7.2 78.37% <85.00%> (+<0.01%) ⬆️
agent-for-php-7.3 78.38% <85.00%> (+<0.01%) ⬆️
agent-for-php-7.4 78.24% <85.00%> (+<0.01%) ⬆️
agent-for-php-8.0 77.45% <85.00%> (+<0.01%) ⬆️
agent-for-php-8.1 77.77% <85.00%> (+<0.01%) ⬆️
agent-for-php-8.2 77.38% <85.00%> (+<0.01%) ⬆️
agent-for-php-8.3 77.38% <85.00%> (+<0.01%) ⬆️
agent-for-php-8.4 77.40% <85.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@lavarou lavarou merged commit b78ac2d into dev Aug 8, 2025
66 checks passed
@lavarou lavarou deleted the fix/agent/legacy-package-detection-issues branch August 8, 2025 19:45
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.

5 participants