Skip to content

chore: remove dead and unused modules#809

Open
pavsoss wants to merge 1 commit into
Userunknown84:mainfrom
pavsoss:issue-802-remove-dead-modules
Open

chore: remove dead and unused modules#809
pavsoss wants to merge 1 commit into
Userunknown84:mainfrom
pavsoss:issue-802-remove-dead-modules

Conversation

@pavsoss

@pavsoss pavsoss commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #802

This PR removes dead, duplicated, obsolete, and accidentally committed files from the repository.

Because this change deletes files across multiple parts of the project, each removal was audited against the active application paths, imports, Docker entrypoints, package scripts, workflows, and runtime file resolution before deletion.

No actively mounted route or runtime module is intentionally replaced by this PR. The goal is to remove files that are no longer reachable by the current application or are redundant copies of actively maintained implementations.

Removed Files

backend/app.py

Removed as an obsolete ML API implementation.

The active ML API entrypoint is backend/api.py. Dockerfile.api explicitly starts:

CMD ["python", "api.py"]

A repository-wide reference search found no imports or startup commands using app.py.

The active container and application startup path therefore do not depend on this file.


backend/middleware/fileValidation.js

backend/middleware/filevalidation.js

backend/utils/fileValidation.js

Removed three unused file-validation implementations.

The exported functions from these modules, including validateCSVUpload, sanitizeCSVCell, and scanWithClamAV, were not referenced by any active production route.

The currently mounted bulk prediction route uses:

bulkPredict.js
    ↓
parseUploadedFile.js

The removed ClamAV integration was not part of the active upload path. Existing CSV parsing and formula-injection sanitization in the active upload flow remain unchanged.


backend/tests/fileValidation.test.js

Removed because the test exclusively imported and tested the deleted backend/middleware/fileValidation.js module.

No active production module depended on the tested middleware.

The backend test command was updated only to remove the obsolete test reference/configuration associated with this deleted test.


backend/routes/prediction.route.js

Removed as an unused prediction router.

The backend explicitly imports and mounts predictionRoutes.js from server.js.

prediction.route.js is not imported or registered by the application, making it unreachable from the active Express routing path.


backend/middleware/validation.middleware.js

backend/validators/auth.validator.js

backend/validators/prediction.validator.js

Removed unused validation middleware and validator modules.

Their module paths and exported symbols were searched across the application, route composition, tests, and workflow configuration. No active imports, requires, or dynamic registrations were found.

These validators were not connected to the currently mounted request-handling flow.


domain_checker.py

Removed the obsolete root-level domain checker implementation.

The active implementation is backend/domain_checker.py, which is imported by backend modules including api.py and email_header_analyzer.py.

A function-by-function comparison confirmed that the root implementation contains no unique functionality. It is a strict subset of the backend version:

  • extract_domains is identical.
  • check_blacklist is identical.
  • The backend check_domain_age includes more robust date parsing and timezone handling.
  • The backend version additionally implements check_threat_intelligence.
  • The backend risk score includes threat intelligence results.
  • The backend analyze_domain includes threat intelligence in the final analysis.

No functions or classes exist exclusively in the root version.

Repository-wide searches also found no direct execution of domain_checker.py through scripts, Dockerfiles, workflows, package commands, or documentation.

The root file was therefore an obsolete implementation superseded by the actively used backend version.


Root ML model artifacts

Removed:

label_encoder.pkl
linear_svm_model.pkl
tfidf_vectorizer.pkl

The active ML API resolves model artifacts from the backend directory using its configured base path.

For label_encoder.pkl and linear_svm_model.pkl, the root and backend copies have identical SHA-256 hashes.

The root tfidf_vectorizer.pkl is an empty 0-byte file, while the active backend artifact contains the actual model data.

The root-level copies are not used by the current ML API startup or model-loading path.


frontend/frontend/src/components/Navbar.jsx

Removed an accidental nested frontend duplicate.

The active frontend project root is frontend/, and the Vite application builds from frontend/src/.

The nested frontend/frontend/src/ directory is outside the active frontend source tree and is not referenced by the frontend build configuration.


backend/utils/utils/banner.js

Removed an accidental nested utility duplicate.

The backend explicitly imports:

require('./utils/banner')

which resolves to backend/utils/banner.js.

The nested backend/utils/utils/banner.js file is not imported anywhere.


backend/middleware/rateLimiter.js.bak

Removed an unused backup artifact.

No build script, runtime configuration, package script, or source module references .bak files or this backup path.

The active rate limiter implementation remains at backend/middleware/rateLimiter.js.


Accidental and Garbage Files

Removed:

backend/routes/bool
backend/routes/dict
backend/routes/Tuple[str
tatus

The route files are empty artifacts that appear to have been accidentally created from Python type-hint fragments.

tatus contains accidental Git command output.

None of these files are imported, executed, referenced by package scripts, or included in application manifests.

Validation

The deletion set was audited against upstream/main using:

  • repository-wide import and reference searches,
  • exported symbol searches,
  • active Express route tracing,
  • Docker and ML API entrypoint inspection,
  • Python module resolution analysis,
  • frontend build-root verification,
  • SHA-256 and file-size comparison for ML artifacts,
  • function-level comparison of both domain_checker.py implementations,
  • and baseline-versus-branch test comparison.

The existing backend test command fails on both upstream/main and this branch due to a preexisting syntax error in backend/middleware/rateLimiter.js. The failure is unchanged by this PR.

The frontend build also encounters a preexisting JSX syntax error in ManipulationIndex.jsx, unrelated to the removed nested Navbar.jsx.

No new test or build failure attributable to these deletions was identified.

Scope

This PR intentionally does not fix unrelated preexisting syntax or build errors discovered during validation.

The changes are limited to removing confirmed dead, obsolete, duplicated, or accidentally committed files and updating the backend test command to remove the reference to the deleted obsolete test.

@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

@pavsoss is attempting to deploy a commit to the Aditya Sharma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@pavsoss

pavsoss commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

@Userunknown84 Hey Aditya...this pr removes quite a few dead/duplicate files, so I'd really suggest reviewing the deletion scope carefully before merging

I've audited them against active imports, routes, docker entrypoints and runtime paths...and added the reasoning for each deletion in the pr description

I do think this cleanup is important since multiple similar implementations currently exist even though only one is active...which can easily lead contributors to debug or modify the wrong code

lmk if there's any external/legacy usage i might've missed...I'd be happy to restore anything if needed :)

@Userunknown84

Copy link
Copy Markdown
Owner

@pavsoss i see this later carefully and merge it later .

@Userunknown84

Copy link
Copy Markdown
Owner

@pavsoss I see the code and the files which changes there all code delete not particular lines.

@pavsoss

pavsoss commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@Userunknown84 this was a cleanup and the files jo ismein delte hui hain they were duplicated or dead module... meine harr file ka reason bhi likha hai in the pr description

@Userunknown84 Userunknown84 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

label_encoder.pkl,linear_svm_model.pkl,tfidf_vectorizer.pkl mat remove karo and baki files tally kar raha hu .

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove Dead and Unused Modules

2 participants