Skip to content

fix(hook-decorator): upgrade django-lifecycle and remove type: ignore[misc] comments#7890

Open
afsuyadi wants to merge 2 commits into
Flagsmith:mainfrom
afsuyadi:fix/mypy-type-error
Open

fix(hook-decorator): upgrade django-lifecycle and remove type: ignore[misc] comments#7890
afsuyadi wants to merge 2 commits into
Flagsmith:mainfrom
afsuyadi:fix/mypy-type-error

Conversation

@afsuyadi

Copy link
Copy Markdown
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • [✔] I have read the Contributing Guide.
  • [ ] I have added information to docs/ if required so people know about the feature.
  • [✔] I have filled in the "Changes" section below.
  • [✔] I have filled in the "How did you test this code" section below.

Changes

Contributes to #5240

  1. Upgraded django-lifecycle from 1.2.4 to 1.2.5 in pyproject.toml (both the version constraint and the pinned dev dependency)
  2. Removed 24 # type: ignore[misc] comments from @hook-decorated methods across 10 files

How did you test this code?

  1. Run make typecheck; pass with no [misc] errors
  2. Ran make test locally for those 10 files; 2041 tests passed, 0 failures.

Cli:
DJANGO_SETTINGS_MODULE=app.settings.test ./flagsmith/api/.venv/bin/pytest tests/unit/audit/ tests/unit/environments/ tests/unit/features/ tests/unit/projects/ tests/unit/users/ tests/unit/integrations/

Screenshot from 2026-06-26 19-36-24

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

@afsuyadi is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@afsuyadi afsuyadi requested a review from a team as a code owner June 26, 2026 12:51
@afsuyadi afsuyadi requested review from emyller and removed request for a team June 26, 2026 12:51
@github-actions github-actions Bot added the api Issue related to the REST API label Jun 26, 2026
@emyller

emyller commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Hi @afsuyadi thanks for this contribution! I've unblocked uv lock (7ee256e) to solve this error, but we've now uncovered a few typing errors. 😬

How do you think we should proceed?

@afsuyadi afsuyadi force-pushed the fix/mypy-type-error branch from 7ee256e to 9a1f573 Compare July 2, 2026 01:48
@afsuyadi afsuyadi force-pushed the fix/mypy-type-error branch from 9a1f573 to bf2ae79 Compare July 3, 2026 01:11
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This pull request bumps the pinned django-lifecycle dependency version from 1.2.4 to 1.2.5 in api/pyproject.toml, and removes now-unneeded # type: ignore[misc] comments from @hook(...) decorators across numerous Django model files (audit, environments, experimentation, features, feature external resources, release pipelines, workflows, github integrations, projects, and users). One hook call's keyword-argument formatting was also reformatted. No runtime logic or public API signatures were changed.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Changes

Cohort / File(s) Change Summary
Dependency bump api/pyproject.toml Bumped django-lifecycle version constraint and uv override from 1.2.4 to 1.2.5
Hook decorator cleanup api/audit/models.py, api/environments/models.py, api/experimentation/models.py, api/features/feature_external_resources/models.py, api/features/models.py, api/features/release_pipelines/core/models.py, api/features/workflows/core/models.py, api/integrations/github/models.py, api/projects/models.py, api/users/models.py Removed obsolete # type: ignore[misc] comments from @hook(...) decorators; minor kwargs formatting change in one Celery task call

Sequence Diagram(s)

Not applicable — this change consists solely of comment removals and a dependency version bump with no observable behavioural or flow changes.

Related issues: None referenced in the provided changes.

Related PRs: None referenced in the provided changes.

Suggested labels: dependencies, chore, type-check

Suggested reviewers: None specifically indicated by the diff content.

Poem:
A rabbit hopped through model files bright,
Snipping stale ignores left and right,
No logic bent, no tests to fright,
Just tidier hooks and a version's slight height,
django-lifecycle now shines 1.2.5 tonight. 🐇


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

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9a90c458-5cd3-4344-a6ab-fce04c9e3b68

📥 Commits

Reviewing files that changed from the base of the PR and between e77c851 and bf2ae79.

📒 Files selected for processing (11)
  • api/audit/models.py
  • api/environments/models.py
  • api/experimentation/models.py
  • api/features/feature_external_resources/models.py
  • api/features/models.py
  • api/features/release_pipelines/core/models.py
  • api/features/workflows/core/models.py
  • api/integrations/github/models.py
  • api/projects/models.py
  • api/pyproject.toml
  • api/users/models.py

Comment thread api/pyproject.toml
"sentry-sdk>=2.24.1,<3",
"environs>=14.1.1,<15.0.0",
"django-lifecycle>=1.2.4,<1.3.0",
"django-lifecycle>=1.2.5,<1.3.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
cd api
uv lock --check
rg -n '"django-lifecycle"' pyproject.toml uv.lock

Repository: Flagsmith/flagsmith

Length of output: 426


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n-- pyproject.toml (around the dependency) --\n'
sed -n '35,50p' api/pyproject.toml | cat -n

printf '\n-- uv.lock (matching entries) --\n'
sed -n '45,60p' api/uv.lock | cat -n
printf '\n'
sed -n '1524,1538p' api/uv.lock | cat -n

Repository: Flagsmith/flagsmith

Length of output: 3188


Refresh the lockfile for the dependency bump api/uv.lock still pins django-lifecycle==1.2.4, so it no longer matches the >=1.2.5,<1.3.0 constraint in api/pyproject.toml. Regenerate and commit the lockfile so locked installs pick up the updated version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants