Skip to content

Remove fetch dependency#77

Merged
abnegate merged 1 commit intoutopia-php:mainfrom
ChiragAgg5k:chore/update-fetch-constraint
Apr 29, 2026
Merged

Remove fetch dependency#77
abnegate merged 1 commit intoutopia-php:mainfrom
ChiragAgg5k:chore/update-fetch-constraint

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

@ChiragAgg5k ChiragAgg5k commented Apr 29, 2026

Summary

  • remove the runtime utopia-php/fetch dependency from Queue
  • replace the RabbitMQ management HTTP API queue-size lookup with AMQP queue_declare(..., passive: true)
  • keep missing queues returning 0, matching the previous HTTP 404 behavior

Context

utopia-php/fetch was only used in src/Queue/Broker/AMQP.php to call RabbitMQ's HTTP management API from getQueueSize().

RabbitMQ already returns the queue depth in the AMQP queue.declare-ok response as message_count, so the broker can get queue size through its existing AMQP channel instead of requiring the HTTP management plugin and an extra HTTP client dependency.

A passive declare closes the channel when the queue does not exist, so the implementation catches RabbitMQ's 404 channel exception, clears the cached channel, and returns 0 to preserve the old behavior.

Test Plan

  • php -l src/Queue/Broker/AMQP.php
  • composer validate --no-check-publish
  • vendor/bin/pint --test
  • vendor/bin/phpstan analyse --no-progress --memory-limit=512M

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 29, 2026

Greptile Summary

This PR removes utopia-php/fetch from the runtime dependency and replaces getQueueSize's HTTP management API call with a native AMQP queue_declare(passive: true) approach, which is a cleaner implementation that no longer requires RabbitMQ's management plugin or a separate HTTP port. The lockfile update is consistent with the removal. The core logic change looks correct — 404 channel exceptions are caught, the invalidated channel is nulled, and other errors propagate through withChannel's retry mechanism as expected.

Confidence Score: 5/5

Safe to merge after updating the PR description to reflect the actual change (dependency removal, not a version bump)

No functional bugs found; the AMQP passive-declare approach is correct and the channel-null handling on error is appropriate. The only finding is a P2 PR description inaccuracy.

No files require special attention

Important Files Changed

Filename Overview
composer.json Removes utopia-php/fetch from require entirely (PR description incorrectly says it was updated to ^1.1.0)
composer.lock Lock file updated to remove utopia-php/fetch 0.5.1; no 1.1.x entry added, consistent with the dependency being dropped entirely
src/Queue/Broker/AMQP.php Replaces HTTP management API call with native AMQP queue_declare(passive: true); 404 handling correctly nulls the channel before returning, and non-404 errors re-throw into withChannel's retry path

Reviews (2): Last reviewed commit: "Remove fetch dependency" | Re-trigger Greptile

@ChiragAgg5k ChiragAgg5k force-pushed the chore/update-fetch-constraint branch from d92c83b to 9b4bcc0 Compare April 29, 2026 03:06
@ChiragAgg5k ChiragAgg5k changed the title Update fetch dependency to 1.1 Remove fetch dependency Apr 29, 2026
@abnegate abnegate merged commit 87a5616 into utopia-php:main Apr 29, 2026
8 checks passed
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