IBX-12192: Skip SiteAccessStamp for uninitialized SiteAccess - #27
Conversation
SendMessageSiteAccessSubscriber only skipped stamping when SiteAccessServiceInterface::getCurrent() returned null. When a message is dispatched from a context with no matched SiteAccess (e.g. a console command), getCurrent() instead returns the placeholder SiteAccess with matchingType 'uninitialized', which got stamped and later failed to resolve on the consumer side.
Points CI at the ibexa/core branch that adds SiteAccess::MATCHING_TYPE_UNINITIALIZED, so this PR's tests can run before that PR merges. Must be removed before merging.
|
I'm not sure I understand the description correctly, and just want to clarify: I've always thought that when you don't specify the siteaccess with the command (the From the php bin/console cache:clear --help
#...
--siteaccess[=SITEACCESS] SiteAccess to use for operations. If not provided, default siteaccess will be usedAnd by default siteaccess I mean the I didn't know that by omitting the option the siteaccess is not set at all (that's how I understand "uninitialized"). I mean, can you get different results by running: ? |
|
Thinking about the following case: Given the worker is run with: When a command dispatching a message is invoked with: Result: SiteAccess is uninitialized -> no SiteAccessStamp, message is processed by the worker using the When a command dispatching a message is invoked with: Result: SiteAccessStamp is attached, message is processed by the worker using the |
ibexa/core#796 merged, so ibexa/core's ~4.6.x-dev now resolves the SiteAccess::MATCHING_TYPE_UNINITIALIZED constant on its own.
|
@mnocon I'll need to confirm this - there is some chance that But tbh it is very, very likely that what you are describing might also be bugged and default site access may not be set for the |
Related PRs:
Description:
SendMessageSiteAccessSubscriberonly skipped stamping whenSiteAccessServiceInterface::getCurrent()returnednull. Turns out that's not what happens when a message gets dispatched from a context where no HTTP request ever matched a SiteAccess — e.g. a console command.getCurrent()instead returns the placeholderSiteAccessCoreBundle wires into the container before request matching (namedefault,matchingType = 'uninitialized'), so the subscriber stamped the envelope with that. On the consuming side,SiteAccessMiddlewarethen tried to resolve a SiteAccess literally named'default'and blew up withNotFoundException: Could not find 'SiteAccess' with identifier 'default'.This is what broke
ibexa/data-intelligence-layer's CI, which dispatches messages from console-driven integration tests (failing run).Fix mirrors the existing
nullcheck: skip stamping when$siteAccess->matchingType === SiteAccess::MATCHING_TYPE_UNINITIALIZED.