Skip to content

fix: make consumer cachedInfo cache-only - #68

Merged
matkomat merged 2 commits into
mainfrom
fix/jetstream-cached-info-semantics
Mar 30, 2026
Merged

matkomat merged 2 commits into
mainfrom
fix/jetstream-cached-info-semantics

Conversation

@matkomat

Copy link
Copy Markdown
Contributor

Closes #64

Summary

  • make ConsumerInterface::cachedInfo() and PushConsumerInterface::cachedInfo() truly cache-only by returning null for cold handles instead of performing implicit I/O
  • seed consumer caches when ConsumerInfo is already available from create/info API responses so stream and JetStream handle factories still return warm handles
  • document the cache-only contract explicitly and add integration coverage for cold-cache and warm-cache behavior

Verification

  • ./vendor/bin/phpunit tests/Integration/JetStream/ConsumerTest.php tests/Integration/JetStream/PushConsumerTest.php --testdox
  • ./vendor/bin/phpunit tests/Integration/JetStream/StreamTest.php tests/Integration/JetStream/StreamExtendedTest.php --testdox
  • ./vendor/bin/phpunit tests/Unit/JetStream/Consumer/PushConsumerTest.php --testdox
  • ./vendor/bin/phpstan analyse --no-progress
  • ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run --diff src/JetStream/Consumer/Consumer.php src/JetStream/Consumer/PushConsumer.php src/JetStream/Consumer/OrderedConsumer.php src/JetStream/Consumer/ConsumerInterface.php src/JetStream/Consumer/PushConsumerInterface.php src/JetStream/Stream/Stream.php src/JetStream/Stream/StreamInterface.php src/JetStream/JetStreamContext.php tests/Integration/JetStream/ConsumerTest.php tests/Integration/JetStream/PushConsumerTest.php

@matkomat
matkomat force-pushed the fix/jetstream-cached-info-semantics branch from 67b1ceb to 91cb47c Compare March 30, 2026 14:19
Comment thread src/JetStream/Consumer/OrderedConsumer.php

@matkomat-agent-2 matkomat-agent-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I left one inline note about ordered-consumer coverage. I did not find a functional regression in the implementation itself.

Verified locally with:

  • vendor/bin/phpunit tests/Integration/JetStream/ConsumerTest.php
  • vendor/bin/phpunit tests/Integration/JetStream/PushConsumerTest.php
  • vendor/bin/phpunit tests/Integration/JetStream/OrderedConsumerTest.php
  • vendor/bin/phpunit tests/Integration/JetStream
  • vendor/bin/phpstan analyse src --no-progress

@matkomat-agent-2 matkomat-agent-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The new ordered-consumer cachedInfo test in 46e7955 addresses my previous coverage note. Rechecked on the latest head and reran vendor/bin/phpunit tests/Integration/JetStream/OrderedConsumerTest.php plus vendor/bin/phpunit tests/Integration/JetStream; no further issues from me.

@matkomat
matkomat merged commit f82a8f7 into main Mar 30, 2026
1 check passed
@matkomat
matkomat deleted the fix/jetstream-cached-info-semantics branch March 30, 2026 19:06
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.

Align cachedInfo() semantics across JetStream consumer handles

1 participant