Skip to content

Code simplification: deduplicate functions, break up app.py (v2.5.63)#35

Merged
ttlequals0 merged 1 commit intomainfrom
feature/code-simplification
Feb 19, 2026
Merged

Code simplification: deduplicate functions, break up app.py (v2.5.63)#35
ttlequals0 merged 1 commit intomainfrom
feature/code-simplification

Conversation

@ttlequals0
Copy link
Owner

@ttlequals0 ttlequals0 commented Feb 18, 2026

Summary

  • Deduplicate 8+ copy-pasted functions into shared utilities (convert_to_tz, rate_limit, exempt_from_rate_limit, _extract_bearer_token, check_celery_available, ContextTask, get_configured_scan_paths)
  • Break up app.py from 1137 to 541 lines by extracting migrations, scheduler lock, and startup cleanup into focused modules
  • Replace deprecated datetime.utcnow() with datetime.now(timezone.utc) across models and security
  • Unify file extension lists and terminal scan phase constants to use single canonical definitions
  • Remove dead code: no-op truncate_scan_output(), unnecessary getattr(), stale comments
  • Net result: -268 lines (958 added, 1226 removed) across 26 files

Test plan

  • Full test suite passes: 206 passed, 0 failed, 8 skipped
  • 4 previously-skipped migration lock tests now pass (module extraction removed Celery import side effects)
  • Docker image ttlequals0/pixelprobe:2.5.63 built and pushed to Docker Hub
  • Deploy to staging and verify app starts correctly
  • Verify scheduled scans still trigger properly
  • Verify rate limiting still works on API endpoints

Eliminate ~860 lines of duplicated code across the codebase:
- Extract convert_to_tz(), rate_limit(), Bearer token parsing, check_celery_available(), ContextTask into shared utilities
- Unify file extension lists and terminal scan phase constants
- Extract get_configured_scan_paths() to replace 6+ inline DB-fallback patterns
- Break app.py from 1137 to 541 lines by extracting migrations, scheduler lock, and startup cleanup into focused modules
- Replace deprecated datetime.utcnow() with datetime.now(timezone.utc)
- Remove dead truncate_scan_output() and unnecessary getattr() calls
@ttlequals0 ttlequals0 merged commit 8a05311 into main Feb 19, 2026
6 checks passed
@ttlequals0 ttlequals0 deleted the feature/code-simplification branch February 19, 2026 22:23
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