Skip to content

♻️ refactor(backend-scripts): clean up scripts and fix entrypoints#23

Merged
mnaimfaizy merged 1 commit into
mainfrom
refactor-backend-scripts-cleanup-issue-7
Dec 23, 2025
Merged

♻️ refactor(backend-scripts): clean up scripts and fix entrypoints#23
mnaimfaizy merged 1 commit into
mainfrom
refactor-backend-scripts-cleanup-issue-7

Conversation

@mnaimfaizy
Copy link
Copy Markdown
Owner

@mnaimfaizy mnaimfaizy commented Dec 23, 2025

This pull request focuses on cleaning up and improving the backend scripts directory, clarifying script usage, and removing redundancy. It also makes minor improvements to test infrastructure and Docker configuration. The most significant changes include deleting unused or redundant scripts, adding documentation and an audit report for backend scripts, clarifying the purpose of scripts for Docker versus local development, and making minor fixes to test runner code and Dockerfile entrypoints.

Backend scripts cleanup and documentation:

  • Added a comprehensive audit report (backend_scripts_audit_report.md) detailing the current state of the backend/scripts directory, identifying redundant/legacy scripts, and providing recommendations for cleanup and documentation.
  • Added a new README.md to the backend/scripts directory to clarify the purpose and organization of scripts, distinguishing between Docker-specific and local/dev helper scripts.

Redundant/unused script removal:

  • Deleted the redundant beat-start-unix.sh script, as its functionality is covered by beat-start.sh.
  • Removed the unused fix-imports.ps1 script, which is now redundant due to other formatting scripts.
  • Deleted the placeholder database/create-dbs.sql.removed file, as it is no longer needed.

Script and file reorganization:

  • Moved the standalone test_csrf_implementation.py script from backend/scripts/ to backend/test/, clarifying its purpose as a test/diagnostic script.

Infrastructure and configuration improvements:

  • Updated the Dockerfile to use the correct production entrypoint script (production-entrypoint.sh) instead of the generic entrypoint.sh.
  • Improved the test runner by importing Sequence for type safety and updating the run_command function to handle command arguments more robustly. [1] [2]
  • Fixed the VSCode integration test task to use the correct path for the test runner and test files.

Closes #7

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the backend/scripts directory by removing redundant and unused scripts, fixing entrypoints, and adding documentation to improve maintainability and clarity.

Key Changes

  • Removed redundant scripts (beat-start-unix.sh, fix-imports.ps1, create-dbs.sql.removed) identified in the audit
  • Improved type safety in test_runner.py with proper use of Sequence[str] type hints
  • Fixed production entrypoint path in Dockerfile to use the correct script location
  • Added comprehensive documentation (audit report and README) for the scripts directory

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
backend/test_runner.py Improved type hints by using Sequence[str] instead of list[str] for better flexibility and converted sequence to list internally for safe mutation
backend/test/test_csrf_implementation.py Cleaned up docstring formatting to be more concise (single-line start)
backend/scripts/fix-imports.ps1 Removed redundant PowerShell import sorting script (functionality covered by format.ps1)
backend/scripts/database/create-dbs.sql.removed Removed placeholder file that was no longer needed
backend/scripts/beat-start-unix.sh Removed redundant Celery beat startup script (duplicate of beat-start.sh)
backend/scripts/backend_scripts_audit_report.md Added comprehensive audit report documenting script redundancies and cleanup recommendations
backend/scripts/README.md Added documentation explaining the purpose and organization of scripts directory
backend/Dockerfile Fixed entrypoint path to use production-entrypoint.sh instead of generic entrypoint.sh
.vscode/tasks.json Corrected test runner path to use full path from project root (backend/test_runner.py)
.gitignore Added memory_test_db_default to ignore local test database artifacts

@mnaimfaizy mnaimfaizy merged commit 0d3e6a0 into main Dec 23, 2025
9 checks passed
@mnaimfaizy mnaimfaizy deleted the refactor-backend-scripts-cleanup-issue-7 branch December 23, 2025 00:51
@mnaimfaizy mnaimfaizy added documentation Improvements or additions to documentation maintenance cleanup labels Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup documentation Improvements or additions to documentation maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor the script files in the backend/scripts directory and remove the un-used scripts

2 participants