Skip events on identical whitelist and config pushes#597
Open
kayjoosten wants to merge 1 commit into
Open
Conversation
c95a0c3 to
0a423f6
Compare
kayjoosten
commented
Jun 15, 2026
f97b718 to
7291a43
Compare
johanib
reviewed
Jun 16, 2026
|
|
||
| public function replaceAll(InstitutionCollection $institutionCollection): void | ||
| { | ||
| if ($this->whitelist->equals($institutionCollection)) { |
Contributor
There was a problem hiding this comment.
Pipeline fails: Cannot call method equals() on Surfnet\Stepup\Identity\Collection\InstitutionCollection|null.
| */ | ||
| private function deepKsort(array $array): array | ||
| { | ||
| ksort($array); |
Contributor
There was a problem hiding this comment.
It's unclear here what the keys actually are? Are they ints? If so, is the array already sorted.
If the actual data types are known/determined, consider adding proper type hints instead of mixed.
f0e1fd0 to
4b43553
Compare
7291a43 to
9a015ea
Compare
Prior to this change, Whitelist::replaceAll() and Configuration::update() always emitted events regardless of whether the content had changed. With manage pushing configuration hundreds of times per day, this caused unbounded event stream growth on no-op pushes. This change adds idempotency guards to both methods so events are only emitted when content actually changes. Config comparison is normalised with recursive ksort to be key-order-insensitive. A new InstitutionCollection::equals() method handles order-independent institution set comparison. InstitutionConfiguration already had correct equality guards and required no changes. Closes #587
d395cb9 to
cd06292
Compare
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.
Summary
InstitutionCollection::equals()for order-independent comparisonWhitelist::replaceAll()— noWhitelistReplacedEventif content unchangedConfiguration::update()— no events if decoded config unchangedInstitutionConfigurationalready had correct equality guards per-field; no change neededWhy
With manage pushing config hundreds of times per day (per OpenConext/OpenConext-manage#627), all three replace endpoints (
/management/whitelist/replace,/management/configuration,/management/institution-configuration) were adding events on every push regardless of whether anything changed.Test plan
mw_idempotent_push.feature) to verify event stream count does not grow on duplicate pushesCloses #587