Skip to content

Conversation

@rpcross
Copy link
Collaborator

@rpcross rpcross commented Nov 1, 2025

No description provided.

@codecov
Copy link

codecov bot commented Nov 1, 2025

Codecov Report

❌ Patch coverage is 90.27778% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.54%. Comparing base (cbb0e2e) to head (4212526).
⚠️ Report is 72 commits behind head on main.

Files with missing lines Patch % Lines
ietf/person/views.py 90.90% 4 Missing ⚠️
ietf/utils/fields.py 76.92% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #9850    +/-   ##
========================================
  Coverage   88.54%   88.54%            
========================================
  Files         316      317     +1     
  Lines       42265    42449   +184     
========================================
+ Hits        37423    37586   +163     
- Misses       4842     4863    +21     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Member

@jennifer-richards jennifer-richards left a comment

Choose a reason for hiding this comment

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

I have a few comments inline, but the merge persons view needs a refactoring. It's currently dangerous enough that IMO it needs to be part of this PR.

The workflow currently looks like:

  1. GET the /person/merge/ page
  2. fill in the from/to fields with person IDs
  3. Submit with a GET, returning a page with the preview of the persons.
  4. Review and submit with a POST

However, in step 3, the from/to fields are still present and editable. Editing them does not update the preview, and submitting will merge persons based on the edited values without much warning. Obviously "don't do that," but it's an opportunity for a serious error that would be difficult to roll back.

This should instead be two views, one that is only selecting the persons to merge and another that is only previewing and submitting. It can have the current "swap" button and the new "send email" button in addition to the "Merge" button, but shouldn't allow editing the IDs to be affected. Probably it should add a "go back" type button to return to the original view.

LMK if that doesn't make sense


def clean_to(self):
addresses = self.cleaned_data['to']
return addresses.split(',')
Copy link
Member

Choose a reason for hiding this comment

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

Not ideal to be "cleaning" a CharField into a list in the clean_* method. That sort of transformation needs to be in a to_python() method of a custom field class. We have ietf.utils.fields.MultiEmailField that might be close to what you need, though it is probably in need of some clean up.

If that's not doing the right things, it'd be worth making your own field class here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks like this would work, except for the fact that validate_email doesn't handle emails in the form "IETF Secretariat ietf-secretariat-reply@ietf.org" which is the settings default from address. I could just use "ietf-secretariat-reply@ietf.org". What clean up are you referring to?

Copy link
Member

Choose a reason for hiding this comment

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

Didn't look hard at cleanup, but it's written in old style / dialect that caught my eye (specifically, not using super().validate(...)). Not asking you to refactor it, just a comment.

I agree it doesn't do what you need. The main reason to point at it was just the structure it has. I.e., rather than doing data conversion in a clean() method, it'd be preferable to do something like

class MutliNameAddrField(forms.Field):
    def to_python(self, value):
        """Split on commas into a list of maybe-valid name-addr strings, or raise ValidationError if it can't do that"""
        # ...
    def validate(self, value):
        """Do more detailed validation on the value that came out of to_python"""
        # ...

Copy link
Member

Choose a reason for hiding this comment

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

https://docs.djangoproject.com/en/5.2/ref/forms/validation/#form-and-field-validation is a useful reference that it always takes me too long to find

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok. I mixed this up. For the send_mail_text() "to" and "reply-to", which expect lists, the existing MultiEmailField works fine. For the From address, which gets a name-addr style email address from settings.DEFAULT_FROM_EMAIL, I created a custom field NameAddrEmailField.

See commit 4212526

@rjsparks rjsparks merged commit a28594e into ietf-tools:main Jan 21, 2026
10 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants