Skip to content

Merge MIP-237 - #138

Merged
sofyenne merged 3 commits into
developfrom
merge-237
Aug 13, 2026
Merged

sofyenne merged 3 commits into
developfrom
merge-237

Conversation

@sofyenne

Copy link
Copy Markdown
Contributor

No description provided.

@sofyenne
sofyenne marked this pull request as ready for review August 11, 2026 11:24
@sofyenne
sofyenne requested a review from boubaker August 12, 2026 13:41
@boubaker

Copy link
Copy Markdown
Member

Review — MIP-237 (part of the core#138 · portal#1300 · social#5962 · meeds#4273 set)

Reviewed against the spec in Meeds-io/MIPs#237. Findings verified against head commit a9346c2.


🟠 High — updateGroups startup sync NPEs on null label/description and aborts the remaining group entries
OrganizationDatabaseInitializer.java:123-128

} else if (updateGroups) {
  if (!existingGroup.getLabel().equals(data.getLabel()) ||        // NPE when label is null
      !existingGroup.getDescription().equals(data.getDescription())) {  // NPE when description is null
    existingGroup.setLabel(data.getLabel());

Group.getLabel()/getDescription() are nullable (portal's ExtGroup.equals null-guards both, and PicketLink returns null for absent attributes), and OrganizationConfig$Group fields default to null when the XML omits them. portal#1300 ships updateGroups=true in organization-configuration.xml, so this runs on every startup with the entry algorithm: the first existing group with a null label/description throws, BaseOrganizationService.init() swallows it with a LOG.warn, and every group entry after it is silently skipped — including the /organization → "Custom Groups" relabel this change exists to apply. Secondary effect: a config entry without <field name="label"> wipes an admin-set label back to null on each restart.

Fix: use !StringUtils.equals(existingGroup.getLabel(), data.getLabel()) (idem description), and only overwrite when the config value is non-null.


What this PR does well: the new GroupHandler.updateGroup contract is properly documented (javadoc states the enclosing-membership semantics, argument validation and failure modes) and shipped as a default method throwing UnsupportedOperationException, keeping every existing GroupHandler implementation source-compatible.

⚠️ Classification: N1 (socle). This diff extends the organization API and the startup data initializer — it requires a priori human validation by an Archi/Dev, no auto-merge.

🤖 Generated with Claude Code

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 60%)

See analysis details on SonarQube Cloud

@sofyenne

Copy link
Copy Markdown
Contributor Author

Fix applied — updateGroups startup sync

Thanks @boubaker. The 🟠 High finding on OrganizationDatabaseInitializer.java:123-128 is addressed, both parts of the proposed fix.

} else if (updateGroups) {
  // Keep the existing value when the configuration doesn't define one,
  // to avoid wiping an administrator defined label/description on each restart
  String label = data.getLabel() == null ? existingGroup.getLabel() : data.getLabel();
  String description = data.getDescription() == null ? existingGroup.getDescription() : data.getDescription();
  if (!StringUtils.equals(existingGroup.getLabel(), label)
      || !StringUtils.equals(existingGroup.getDescription(), description)) {
    existingGroup.setLabel(label);
    existingGroup.setDescription(description);
    orgService.getGroupHandler().saveGroup(existingGroup, true);
    printInfo(String.format("Update Group: %s", groupId));
  }
}

1. Null-safe comparison — StringUtils.equals(...) replaces existingGroup.getLabel().equals(...). A group carrying a null label or description no longer throws, so BaseOrganizationService.init() has nothing and the entries following it are no longer skipped — the
/organization → "Custom Groups" relabel now actually applies he entry algorithm.

2. Config value overwrites only when non-null — a config enbel">(idem description) keeps the value already stored instead of resetting it to null, so the secondary effect you flagged (an admin-set label wiped on each restart cycle) is gone too. StringUtils` (commons-lang3) was already imported in the class, so the fix adds no dependency.

🤖 Generated with Claude Code

@boubaker

Copy link
Copy Markdown
Member

Re-review — head ed93ae8

Status of the finding from the initial review:

# Finding Status
🟠 updateGroups startup sync NPEs on null label/description and aborts remaining group entries ✅ Fixed — StringUtils.equals for null-safety, plus keep-existing-value when the configuration omits label/description (OrganizationDatabaseInitializer.java:124-131), which also eliminates the secondary label-wipe-on-restart issue.

New items

None — the fix commit is clean and goes beyond the minimal fix in the right way.

🤖 Generated with Claude Code

@sofyenne
sofyenne merged commit 020de7d into develop Aug 13, 2026
6 of 7 checks passed
@sofyenne
sofyenne deleted the merge-237 branch August 13, 2026 15:02
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