Skip to content

fix(group): use array-aware validation for participants - #180

Open
netoduwe wants to merge 1 commit into
evolution-foundation:developfrom
netoduwe:fix/group-participant-array-validation-develop
Open

fix(group): use array-aware validation for participants#180
netoduwe wants to merge 1 commit into
evolution-foundation:developfrom
netoduwe:fix/group-participant-array-validation-develop

Conversation

@netoduwe

@netoduwe netoduwe commented Aug 24, 2026

Copy link
Copy Markdown

Description

Fixes the validation used by POST /group/participant.

The participants field is an array, but the route was using ValidateJIDFields, which handles individual string fields. Valid participant requests were therefore rejected before reaching UpdateParticipant.

This change uses the existing array-aware ValidateMultipleNumbers("participants") middleware, matching the behavior already used by /group/create.

Related Issue

Closes #97

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • No breaking changes introduced
  • Manual testing completed
  • Functionality verified in development environment

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have tested my changes thoroughly
  • No dependent changes are required

Additional Notes

Supersedes #100. This PR was created from the current upstream develop branch and contains one focused commit changing one file.

@sourcery-ai

sourcery-ai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the group participant endpoint to validate the participants field as an array of numbers, matching the validation already used by group creation and preventing incorrect validation of array-shaped input.

File-Level Changes

Change Details Files
Apply array-aware participant-number validation to group participant updates.
  • Replace combined single-field/JID validation with multi-number validation for the participants payload.
  • Align the participant update endpoint’s validation behavior with group creation.
pkg/routes/routes.go

Possibly linked issues

  • #unknown: The PR replaces single-value validation with array-aware validation, directly fixing the reported participant rejection.
  • #unknown: The PR replaces incorrect JID field validation with array-aware validation, fixing valid participants being rejected as empty.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. If the new validator accepts or rejects the wrong participant list, the endpoint could add, remove, or otherwise store an incorrect group membership, and reverting would not undo memberships already changed. The affected records are bounded and can be repaired, but this is more than an ordinary transient validation bug.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

1 participant