Skip to content

fix: stop mutating auth.User help_text to silence phantom migration warning - #1412

Merged
dkliban merged 1 commit into
pulp:mainfrom
CryptoRodeo:fix/pulp-2263
Aug 20, 2026
Merged

fix: stop mutating auth.User help_text to silence phantom migration warning#1412
dkliban merged 1 commit into
pulp:mainfrom
CryptoRodeo:fix/pulp-2263

Conversation

@CryptoRodeo

@CryptoRodeo CryptoRodeo commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

admin.py set help_text on Django's built-in User.username field at import time. Django tracks help_text in migrations, so every deploy warned that the auth app was out of sync but auth is Django-owned, so it could never be fixed.

Dropped the line. The help text is already set on the admin form, so nothing changes for users. Kept the nearby validators override, it doesn't affect migrations.

Verified in the dev container: migrate now runs clean.

JIRA: PULP-2263

Summary by Sourcery

Bug Fixes:

  • Prevent recurring Django auth migration warnings by removing the import-time mutation of the built-in User username field’s tracked help text.

…arning

admin.py set help_text on Django's built-in User.username field at import time. Django tracks help_text in migrations, so every deploy warned that the auth app was out of sync but auth is Django-owned, so it could never be fixed.

Dropped the line. The help text is already set on the admin form, so nothing changes for users. Kept the nearby validators override, it doesn't affect migrations.

Verified in the dev container: migrate now runs clean.

JIRA: PULP-2263

Signed-off-by: Bryan ramos <bramos@redhat.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Aug 20, 2026

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

Reviewer's Guide

Stops mutating Django’s built‑in auth.User.username help_text at import time to eliminate spurious migration warnings, while retaining the custom username validator override and documenting the migration-tracking behavior in comments.

File-Level Changes

Change Details Files
Stop overriding auth.User.username help_text in admin customization to avoid phantom migration warnings while keeping the custom validator override.
  • Left the RegexValidator-based username validator and assignment to User._meta.get_field('username').validators in place.
  • Removed the assignment that set User._meta.get_field('username').help_text to a custom USERNAME_HELP_TEXT value.
  • Expanded the surrounding comment to explain which field attributes are safe to mutate (validators) and which are tracked by Django’s migration autodetector (help_text), and where the user-facing help text is actually set.
pulp_service/pulp_service/app/admin.py
Document the bugfix in the changelog system for auth migration warnings.
  • Added a changelog entry file describing the fix for the auth migration warning caused by help_text mutation.
CHANGES/+auth-migration-warning.bugfix

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
Contributor

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 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.

@dkliban
dkliban merged commit df53e6b into pulp:main Aug 20, 2026
6 checks passed
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