Repository navigation
refactor(architecture): Processes dispatches its own task terminal event - #10997
Open
rubenvdlinde wants to merge 1 commit into
Open
rubenvdlinde wants to merge 1 commit into
rubenvdlinde wants to merge 1 commit into
Conversation
TaskMapper now dispatches TaskTerminalEvent through IEventDispatcher at the same point (both update() and a winning updateIfOpen()), with the same committed: false, instead of calling EntityEventsInterface::taskTerminal(). The method leaves EntityEventsInterface and EntityEventPublisher (no fleet app names the interface), so Core no longer names a Processes event, and Event/TaskTerminalEvent and Event/AbstractTaskEvent count to Processes. A golden test pins that a terminal update dispatches exactly one TaskTerminalEvent carrying the persisted task and committed: false. Assisted-by: ClaudeCode:claude-opus-5-5
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Package X96 (round 14, kernel.md K5-04, key
K-task-terminal)Processes dispatches its own task terminal event.
What changed and why this is the right dependency
lib/Db/TaskMapper.php(Processes) dispatchesTaskTerminalEventthroughIEventDispatcherat the same point as before (the privateannounceTerminality(), called fromupdate()and from a winningupdateIfOpen()), with the samecommitted: false, instead of callingEntityEventsInterface::taskTerminal(). The optional?EntityEventsInterface $entityEventsconstructor dependency becomes an optional?IEventDispatcher $dispatcher. The mapper is autowired (no registrar builds it), so the container now injects the Nextcloud dispatcher. Without a dispatcher it is still constructible and stays silent.taskTerminal()leaveslib/Kernel/Contracts/EntityEventsInterface.phpandlib/Service/Registers/EntityEventPublisher.php. A GitHub code search across the org finds no fleet app that namesEntityEventsInterfaceor buildsTaskMapper. The publisher no longer importsTaskTerminalEventorTaskInterface.Event/TaskTerminalEvent.phpandEvent/AbstractTaskEvent.phpgo from Kernel to Processes. Processes is the only area that dispatches the event, and the payload is its own task. The class name, namespace and payload stay the same, so the 7 fleet apps that listen are unaffected.sigrid.components.yamlandtools/sig/deptrac/areas.yamlwere regenerated.Behaviour stays the same: the dispatch is synchronous at the same point, a non-terminal task, a lost conditional update and
insert()still dispatch nothing, and the event is the same class with the same payload. No listener was added or removed, so the listener order pins do not move.Re-measured on fresh main (
e158c36a)TaskTerminalEventtakesTaskInterface, and the publisher narrowed toTaskInterface. That means the 4 references against the order the design counted for K5-04 (EntityEventPublisher→Db/Taskand the Kernel task event pairs) were already gone before this PR. They do not appear inmodularity_check.py'sagainst_orderlist on main. What this PR still achieves is the exposure move and the removal of the Core → task event dependency.Exposed lines per area (
measure()['exposed_loc'])TaskMapper, already exposed, gained one import line)Expected from the package file: Kernel −24 (5,984 → 5,960). Measured: Kernel −38, total −37.
AbstractTaskEventandTaskTerminalEventare no longer exposed at all, because every file that names them now counts to Processes.tools/sig/deptrac.sh areas --check: 38 class pairs in violation, the same as on main. The "852 gone" note prints on main too.rate_component_views.pyrequires a--reportinput that this checkout does not have, so it was not run.Baseline (
tools/sig/modularity-baseline.json, re-recorded with--write-baselineas the routine instructs)exposed_files:lib/Event/AbstractTaskEvent.phpandlib/Event/TaskTerminalEvent.phpremoved (no longer named by another area).kernel_files: the same two removed (they now count to Processes).exposed_loc: Kernel 6,027 → 5,989, Processes 27,041 → 27,042.kernel_loc7,631 → 7,593,total_loc462,400 → 462,395.tools/sig/deptrac/areas.baseline.jsonwas not touched.Tests
TaskMapperTerminalityTest::testATerminalUpdateDispatchesExactlyOneTerminalEventWithTheTaskUncommitted: one terminalupdate()dispatches exactly oneTaskTerminalEvent(viadispatchTyped, neverdispatch), carrying the persisted task andcommitted: false.TaskMapperTerminalityTestandMapperEntityEventsTestnow build the mapper with the dispatcher. The recorded event sequence and payload (committed: false, the given task) are unchanged.tests/Unit/Kernel/EntityEventsBindingTest.php(outside the package's file list, changed because this change needs it; no other round-14 package lists it): the two publishertaskTerminaltests were removed with the method. Their refusal of a non-task entity is still covered byTaskMapper::update(), which throwsInvalidArgumentExceptionfor anything that is not aTask.TaskMapper.phpwas also added toDB_NAMING_EVENTS, the list oflib/Dbfiles that name alib/Eventclass. That list was documented as "only shrinks". The design deliberately makesTaskMappername its own area's event, so the docblock now states that exception. Flagged for the reviewer.What ran
php -lon every changed file: clean.vendor/bin/phpcson the three changed lib files: clean.vendor/bin/phpstan analyse --no-progresson all oflib: 38 errors, identical to main (none in a touched file). On the three changed files alone: no errors. phpstan was installed by fetching the locked commit from github.com/phpstan/phpstan into the composer cache, because the proxy blocks the api.github.com zipball.vendor/bin/psalm --no-cacheon the three changed lib files: no errors (46 info issues, the same as on main).python3 tools/sig/modularity_check.py --check: passed.tools/sig/deptrac.sh areas --check: passed.vendor/bin/phpunit -c phpunit.xml --no-coverage tests/Unit/Architecture: OK (2,378 tests).tests/Unit, per directory. Every failure below also fails on main without this change:Db/AreaMapperRegistrarsTest::testEachInterfaceIsBoundOnce(the Translation mapper interfaces are bound twice).Middleware/AnonymousEnvelopeReadPathsTestandMigration/ReservedColumnNamesTest(anObjectsControllerFactoryargument mismatch, then reserved-word lists).Service/Chat/ResponseGenerationGoldenTest.Written with Claude Code (claude-opus-5-5)
Generated by Claude Code