Skip to content

[FIX] Re-bump djangorestframework 3.14.0 → 3.17.1#2105

Open
chandrasekharan-zipstack wants to merge 1 commit into
fix/drf-validators-bucket1from
fix/drf-bump-3.17
Open

[FIX] Re-bump djangorestframework 3.14.0 → 3.17.1#2105
chandrasekharan-zipstack wants to merge 1 commit into
fix/drf-validators-bucket1from
fix/drf-bump-3.17

Conversation

@chandrasekharan-zipstack

Copy link
Copy Markdown
Contributor

Stacked on #2104 (validators=[] prep). Review/merge that first. Draft until build + tests + staging validate the bump — this is the upgrade reverted in #2098 that caused the rc.343 regression.

What

Re-attempts the DRF upgrade, targeting 3.17.1 (not 3.15.2) because it:

  • carries encode/django-rest-framework#9766 (landed 3.17.0) — the auto UniqueTogetherValidator now honors a UniqueConstraint's violation_error_message, giving friendly duplicate messages for create-only serializers (used by the cloud-side stacked PR).
  • includes the CVE-2024-21520 (XSS) fix first shipped in 3.15.2.

Why it's safe to re-bump now

The parent PR (#2104) sets Meta.validators = [] on every serializer whose view already owns uniqueness (upsert / IntegrityError catch), so the 3.15+ auto-validator can't short-circuit those views anymore. The remaining create-only serializers that keep the validator are all cloud-side (pluggable_apps) and get violation_error_message in the unstract-cloud PR.

Django 4.2.30 + Python 3.12 satisfy DRF 3.17's minimum floors.

Validation checklist (before un-drafting)

  • Backend image builds with cloud deps copied
  • drf-yasg==1.21.7 compatible with DRF 3.17 (schema generation doesn't break)
  • drf-standardized-errors error shape unchanged
  • Backend test suite green
  • Staging smoke: create + re-save adapter / connector / profile / table-settings (the original regression surfaces)

Files

pyproject.toml, backend/pyproject.toml, uv.lock, backend/uv.lock — pin + lock 3.14.0 → 3.17.1.

🤖 Generated with Claude Code

Re-attempts the DRF upgrade reverted in #2098. 3.17.1 is chosen because it:
- carries PR encode/django-rest-framework#9766 (3.17.0), so the auto
  UniqueTogetherValidator honors a UniqueConstraint's violation_error_message
  for friendly duplicate messages (used by cloud-side create-only serializers),
- includes the CVE-2024-21520 (XSS) fix first shipped in 3.15.2.

Safe to layer on top of the Meta.validators=[] changes in the parent commit,
which neutralize the 3.15+ auto-validator for every upsert / IntegrityError-catch
serializer. Django 4.2.30 + Python 3.12 satisfy DRF 3.17's floors.

MUST be build + test + staging validated before merge (this bump caused the
rc.343 regression). drf-yasg 1.21.7 / drf-standardized-errors compatibility with
DRF 3.17 to be verified in CI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G8hAHc4HUo42zY1g9LAjKu
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 745423d2-1780-44fc-9d4b-3888d61c1ca7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/drf-bump-3.17

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@chandrasekharan-zipstack chandrasekharan-zipstack marked this pull request as ready for review June 22, 2026 15:27
@greptile-apps

greptile-apps Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Re-bumps djangorestframework from 3.14.0 to 3.17.1 across backend/pyproject.toml, pyproject.toml, and both lock files. The bump also drops pytz as a transitive DRF dependency (removed upstream in 3.15) and targets the CVE-2024-21520 XSS fix plus the UniqueConstraint.violation_error_message feature.

  • backend/pyproject.toml and backend/uv.lock correctly pin DRF 3.17.1 and resolve drf-yasg to 1.21.15 (>=1.21.8 floor).
  • pyproject.toml bumps the DRF pin in the hook-check-django-migrations group but leaves drf-yasg==1.21.7 in place; the root uv.lock therefore locks that CI environment to drf-yasg 1.21.7 + DRF 3.17.1 — a combination where drf-yasg predates any DRF 3.15 support.
  • Even drf-yasg 1.21.15 (latest, used by the backend) officially lists DRF 3.13–3.15 as supported, making DRF 3.17 officially outside its stated matrix; the PR itself flags schema generation as an unvalidated checklist item.

Confidence Score: 3/5

The PR is intentionally drafted pending build, test, and staging validation; the DRF bump itself is straightforward but the drf-yasg version skew in the root hook group needs resolution before this can go to production.

The root pyproject.toml migration-hook group now pairs drf-yasg==1.21.7 (a 2023 release targeting DRF 3.14) with djangorestframework==3.17.1. If the hook environment initialises Django with drf_yasg in INSTALLED_APPS, this mismatch can cause the migration check to fail or be silently skipped. The backend lock resolves to drf-yasg 1.21.15, which is better, but even that version only officially lists DRF 3.15 as its maximum, so schema-generation correctness under DRF 3.17 remains unverified until staging smoke tests pass.

The root pyproject.toml needs its drf-yasg pin in the hook-check-django-migrations group updated from ==1.21.7 to >=1.21.8 to match the backend and remove the version skew. The uv.lock would need to be re-generated after that change.

Important Files Changed

Filename Overview
pyproject.toml Bumps DRF to 3.17.1 in the hook-check-django-migrations group, but leaves drf-yasg pinned at ==1.21.7 — an older version that was only ever tested against DRF 3.14, creating a mis-matched combination in the root lock.
backend/pyproject.toml Bumps djangorestframework from 3.14.0 to 3.17.1; drf-yasg floor is already >=1.21.8 (resolves to 1.21.15), but 1.21.15 officially supports only up to DRF 3.15.
backend/uv.lock Lock updated: djangorestframework 3.14.0→3.17.1; pytz removed as a DRF transitive dep (expected); drf-yasg resolves to 1.21.15.
uv.lock Root lock updated: djangorestframework 3.14.0→3.17.1; drf-yasg stays at 1.21.7 — this version predates DRF 3.15 support and is now paired with DRF 3.17.1 in the migration hook group.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[DRF 3.14.0 → 3.17.1 bump] --> B[backend/pyproject.toml]
    A --> C[pyproject.toml hook-check group]
    B --> D["drf-yasg >= 1.21.8\n→ resolves to 1.21.15\n(DRF 3.13–3.15 supported officially)"]
    B --> E["djangorestframework 3.17.1\n+ pytz dep removed"]
    D --> F{Compatible?}
    E --> F
    F -->|Officially DRF 3.15 max| G[⚠️ Untested — checklist item open]
    F -->|Likely works in practice| H[Staging smoke test needed]
    C --> I["drf-yasg == 1.21.7 (unchanged)\nreleased Jul 2023 — DRF 3.14 era"]
    C --> J["djangorestframework 3.17.1 (bumped)"]
    I --> K{Compatible?}
    J --> K
    K -->|Version predates DRF 3.15 support| L[❌ Migration hook env mismatch]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[DRF 3.14.0 → 3.17.1 bump] --> B[backend/pyproject.toml]
    A --> C[pyproject.toml hook-check group]
    B --> D["drf-yasg >= 1.21.8\n→ resolves to 1.21.15\n(DRF 3.13–3.15 supported officially)"]
    B --> E["djangorestframework 3.17.1\n+ pytz dep removed"]
    D --> F{Compatible?}
    E --> F
    F -->|Officially DRF 3.15 max| G[⚠️ Untested — checklist item open]
    F -->|Likely works in practice| H[Staging smoke test needed]
    C --> I["drf-yasg == 1.21.7 (unchanged)\nreleased Jul 2023 — DRF 3.14 era"]
    C --> J["djangorestframework 3.17.1 (bumped)"]
    I --> K{Compatible?}
    J --> K
    K -->|Version predates DRF 3.15 support| L[❌ Migration hook env mismatch]
Loading

Comments Outside Diff (1)

  1. pyproject.toml, line 54 (link)

    P1 drf-yasg==1.21.7 in root hook group is now coupled with DRF 3.17.1

    The hook-check-django-migrations dependency group pins drf-yasg==1.21.7 (released July 2023, only tested against DRF up to 3.14). After this bump, the root uv.lock resolves that group to drf-yasg 1.21.7 + djangorestframework 3.17.1. If the hook environment runs manage.py with drf_yasg in INSTALLED_APPS, its startup introspection of DRF internals could raise an AttributeError or ImportError, causing the migration check to fail or silently skip.

    The backend's own pyproject.toml already requires >=1.21.8 (resolves to 1.21.15) — bringing the root hook group in line with that floor would remove the discrepancy and match what the real backend runs.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: pyproject.toml
    Line: 54
    
    Comment:
    **`drf-yasg==1.21.7` in root hook group is now coupled with DRF 3.17.1**
    
    The `hook-check-django-migrations` dependency group pins `drf-yasg==1.21.7` (released July 2023, only tested against DRF up to 3.14). After this bump, the root `uv.lock` resolves that group to `drf-yasg 1.21.7 + djangorestframework 3.17.1`. If the hook environment runs `manage.py` with `drf_yasg` in `INSTALLED_APPS`, its startup introspection of DRF internals could raise an `AttributeError` or `ImportError`, causing the migration check to fail or silently skip.
    
    The backend's own `pyproject.toml` already requires `>=1.21.8` (resolves to 1.21.15) — bringing the root hook group in line with that floor would remove the discrepancy and match what the real backend runs.
    
    How can I resolve this? If you propose a fix, please make it concise.

    Fix in Claude Code

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
pyproject.toml:54
**`drf-yasg==1.21.7` in root hook group is now coupled with DRF 3.17.1**

The `hook-check-django-migrations` dependency group pins `drf-yasg==1.21.7` (released July 2023, only tested against DRF up to 3.14). After this bump, the root `uv.lock` resolves that group to `drf-yasg 1.21.7 + djangorestframework 3.17.1`. If the hook environment runs `manage.py` with `drf_yasg` in `INSTALLED_APPS`, its startup introspection of DRF internals could raise an `AttributeError` or `ImportError`, causing the migration check to fail or silently skip.

The backend's own `pyproject.toml` already requires `>=1.21.8` (resolves to 1.21.15) — bringing the root hook group in line with that floor would remove the discrepancy and match what the real backend runs.

### Issue 2 of 2
backend/pyproject.toml:22
**drf-yasg officially supports only up to DRF 3.15**

The drf-yasg PyPI page lists its compatibility matrix as DRF 3.13, 3.14, and 3.15 — even for the latest release (1.21.15, resolved in `backend/uv.lock`). Bumping to DRF 3.17.1 falls outside that matrix. The PR checklist already marks schema generation as unvalidated; flagging here as a reminder that runtime failures (e.g., broken `AutoSchema` introspection used by `drf_yasg` to generate Swagger docs) won't be caught by unit tests and may only surface under full server startup or API docs endpoint hits in staging.

Reviews (1): Last reviewed commit: "[FIX] Re-bump djangorestframework 3.14.0..." | Re-trigger Greptile

Comment thread backend/pyproject.toml
"cryptography>=48.0.1",
"django==4.2.30",
"djangorestframework==3.14.0",
"djangorestframework==3.17.1",

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.

P2 drf-yasg officially supports only up to DRF 3.15

The drf-yasg PyPI page lists its compatibility matrix as DRF 3.13, 3.14, and 3.15 — even for the latest release (1.21.15, resolved in backend/uv.lock). Bumping to DRF 3.17.1 falls outside that matrix. The PR checklist already marks schema generation as unvalidated; flagging here as a reminder that runtime failures (e.g., broken AutoSchema introspection used by drf_yasg to generate Swagger docs) won't be caught by unit tests and may only surface under full server startup or API docs endpoint hits in staging.

Prompt To Fix With AI
This is a comment left during a code review.
Path: backend/pyproject.toml
Line: 22

Comment:
**drf-yasg officially supports only up to DRF 3.15**

The drf-yasg PyPI page lists its compatibility matrix as DRF 3.13, 3.14, and 3.15 — even for the latest release (1.21.15, resolved in `backend/uv.lock`). Bumping to DRF 3.17.1 falls outside that matrix. The PR checklist already marks schema generation as unvalidated; flagging here as a reminder that runtime failures (e.g., broken `AutoSchema` introspection used by `drf_yasg` to generate Swagger docs) won't be caught by unit tests and may only surface under full server startup or API docs endpoint hits in staging.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

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