Skip to content

Avoid NPE when joining/editing group with deleted owner - #837

Merged
jsharkey13 merged 5 commits into
mainfrom
hotfix/deleted-group-owners
Oct 5, 2026
Merged

jsharkey13 merged 5 commits into
mainfrom
hotfix/deleted-group-owners

Conversation

@axlewin

@axlewin axlewin commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

A group can be in a valid state where its owner's account has been archived or deleted but it is still being used by additional manager(s). Therefore the endpoints to join and edit groups need to be able to cope with group.getOwnerSummary() being null.

The owner summary of a group can validly be null, if the group owner's account has been archived/deleted. As long as the summary is null both before and after the change, this check should pass.
The other instances of this message are already debug-level logs, and since this is a valid state for a group to be in there is no need to log an error here.
@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 12.50000% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.63%. Comparing base (973ebab) to head (606033a).
⚠️ Report is 53 commits behind head on main.

Files with missing lines Patch % Lines
...cl/dtg/isaac/api/services/GroupChangedService.java 0.00% 10 Missing ⚠️
...ac/cam/cl/dtg/segue/api/managers/GroupManager.java 0.00% 2 Missing ⚠️
...k/ac/cam/cl/dtg/segue/api/AuthorisationFacade.java 66.66% 0 Missing and 1 partial ⚠️
.../java/uk/ac/cam/cl/dtg/segue/api/GroupsFacade.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #837      +/-   ##
==========================================
- Coverage   41.69%   41.63%   -0.06%     
==========================================
  Files         550      552       +2     
  Lines       23684    23759      +75     
  Branches     2868     2884      +16     
==========================================
+ Hits         9874     9892      +18     
- Misses      12915    12969      +54     
- Partials      895      898       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

If the group owner has been archived/deleted, getOwnerSummary() returns null.

If a null user is included in this response, the frontend doesn't handle it properly and the group join fails. We might as well just not add the null user at all.
Allow for the case where the group owner is null.
@axlewin axlewin changed the title Avoid NPE when editing group with deleted owner Avoid NPE when joining/editing group with deleted owner Sep 22, 2026
Co-authored-by: James Sharkey <jsharkey13@users.noreply.github.com>
@jsharkey13
jsharkey13 merged commit f8c3efd into main Oct 5, 2026
5 checks passed
@jsharkey13
jsharkey13 deleted the hotfix/deleted-group-owners branch October 5, 2026 10:40
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