Skip to content

refactor: move database.enums to shared.django_apps.enums#701

Draft
thomasrockhu-codecov wants to merge 4 commits intomainfrom
refactor/phase-0-enums-bulk
Draft

refactor: move database.enums to shared.django_apps.enums#701
thomasrockhu-codecov wants to merge 4 commits intomainfrom
refactor/phase-0-enums-bulk

Conversation

@thomasrockhu-codecov
Copy link
Contributor

Summary

  • Creates libs/shared/shared/django_apps/enums.py with all plain Python enums previously in apps/worker/database/enums.py
  • Updates ~60 consumer files across worker tasks, services, helpers, and tests to import from the new shared location
  • Keeps database/enums.py as a re-export shim for backward compatibility

Part 1/3 of Phase 0 (SQLAlchemy removal migration).

Test plan

  • All existing tests pass (import-only changes, no behavioral change)
  • ruff check passes

Made with Cursor

@sentry
Copy link

sentry bot commented Feb 8, 2026

Codecov Report

❌ Patch coverage is 67.05882% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.23%. Comparing base (304d215) to head (443fc35).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
libs/shared/shared/django_apps/enums.py 0.00% 53 Missing ⚠️
...ker/services/notification/notifiers/checks/base.py 95.34% 2 Missing ⚠️
apps/worker/database/enums.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #701      +/-   ##
==========================================
- Coverage   92.34%   92.23%   -0.11%     
==========================================
  Files        1302     1303       +1     
  Lines       47805    47831      +26     
  Branches     1619     1619              
==========================================
- Hits        44146    44119      -27     
- Misses       3350     3403      +53     
  Partials      309      309              
Flag Coverage Δ
apiunit 96.36% <ø> (ø)
sharedintegration 36.99% <0.00%> (-0.14%) ⬇️
sharedunit 84.85% <0.00%> (-0.32%) ⬇️
workerintegration 58.44% <56.41%> (-0.16%) ⬇️
workerunit 90.35% <95.72%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link

codecov-notifications bot commented Feb 8, 2026

Codecov Report

❌ Patch coverage is 67.05882% with 56 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
libs/shared/shared/django_apps/enums.py 0.00% 53 Missing ⚠️
...ker/services/notification/notifiers/checks/base.py 95.34% 2 Missing ⚠️
apps/worker/database/enums.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 8, 2026

Merging this PR will not alter performance

✅ 9 untouched benchmarks


Comparing refactor/phase-0-enums-bulk (443fc35) with main (304d215)

Open in CodSpeed

thomasrockhu-codecov and others added 4 commits February 8, 2026 19:15
Extract StatusNotifier.notify() (98 lines) into focused methods
under 50 lines each.

- _check_notify_preconditions(): validates branches/builds requirements
- _build_payload_with_behavior(): builds payload applying flag coverage rules
- _set_payload_url(): sets URL based on PR or commit context

Co-authored-by: Cursor <cursoragent@cursor.com>
Extract ChecksNotifier.notify() (176 lines) into focused methods
under 50 lines each.

- _validate_pull_request(): validates PR exists, is in provider, is open
- _check_preexisting_status(): checks if commit status already exists
- _build_payload_with_behavior(): overrides parent with checks-specific logic
- Removed unused nullcontext and get_commit_url imports

Co-authored-by: Cursor <cursoragent@cursor.com>
…fier

- Fix 'comparison.pull is None or ()' to 'comparison.pull is None' in
  _validate_pull_request — the 'or ()' was a no-op since () is falsy,
  so the expression was equivalent to just 'is None'
- Fix typo "where chnaged" -> "were changed" in get_line_diff docstring

Co-authored-by: Cursor <cursoragent@cursor.com>
Move all plain Python enums from apps/worker/database/enums.py to
libs/shared/shared/django_apps/enums.py, decoupling them from the
SQLAlchemy database package. Update all ~60 consumer files in the
worker to import from the new shared location. The old database/enums.py
is kept as a re-export shim for backward compatibility.

Part of the SQLAlchemy removal migration (Phase 0).

Co-authored-by: Cursor <cursoragent@cursor.com>
@thomasrockhu-codecov thomasrockhu-codecov force-pushed the refactor/phase-0-enums-bulk branch from 7549d0c to 443fc35 Compare February 8, 2026 10:16
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