Skip to content

Backend unused code#1749

Merged
Artuomka merged 4 commits into
mainfrom
backend_unused_code
Apr 30, 2026
Merged

Backend unused code#1749
Artuomka merged 4 commits into
mainfrom
backend_unused_code

Conversation

@Artuomka
Copy link
Copy Markdown
Collaborator

@Artuomka Artuomka commented Apr 30, 2026

Summary by CodeRabbit

  • Refactoring
    • Removed the ability to delete personal table settings via API endpoint
    • Eliminated unused database analysis tools and related utility functions
    • Cleaned up internal helper functions and message-building convenience methods

Copilot AI review requested due to automatic review settings April 30, 2026 12:34
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8b2e2a24-b946-491c-aeb4-f6215940ebf3

📥 Commits

Reviewing files that changed from the base of the PR and between b6a14ea and f4dd4ca.

📒 Files selected for processing (12)
  • backend/src/ai-core/tools/database-tools.ts
  • backend/src/ai-core/tools/prompts.ts
  • backend/src/ai-core/tools/query-validators.ts
  • backend/src/ai-core/utils/message-builder.ts
  • backend/src/common/data-injection.tokens.ts
  • backend/src/entities/table-settings/personal-table-settings/personal-table-settings.controller.ts
  • backend/src/entities/table-settings/personal-table-settings/personal-table-settings.module.ts
  • backend/src/entities/table-settings/personal-table-settings/use-cases/delete-personal-table-settings.use.case.ts
  • backend/src/entities/table-settings/personal-table-settings/use-cases/personal-table-settings.use-cases.interface.ts
  • backend/src/helpers/app/get-requeired-env-variable.ts
  • backend/src/helpers/get-master-password.ts
  • backend/src/helpers/index.ts
💤 Files with no reviewable changes (12)
  • backend/src/common/data-injection.tokens.ts
  • backend/src/helpers/app/get-requeired-env-variable.ts
  • backend/src/helpers/index.ts
  • backend/src/helpers/get-master-password.ts
  • backend/src/ai-core/tools/database-tools.ts
  • backend/src/entities/table-settings/personal-table-settings/personal-table-settings.module.ts
  • backend/src/ai-core/utils/message-builder.ts
  • backend/src/entities/table-settings/personal-table-settings/use-cases/delete-personal-table-settings.use.case.ts
  • backend/src/entities/table-settings/personal-table-settings/personal-table-settings.controller.ts
  • backend/src/entities/table-settings/personal-table-settings/use-cases/personal-table-settings.use-cases.interface.ts
  • backend/src/ai-core/tools/query-validators.ts
  • backend/src/ai-core/tools/prompts.ts

📝 Walkthrough

Walkthrough

This pull request removes eleven exported functions and one enum member across multiple backend modules, including AI core tools, message builders, environment variable helpers, and the personal table settings delete use case along with its supporting interfaces and controller endpoint.

Changes

Cohort / File(s) Summary
AI Core Tools
backend/src/ai-core/tools/database-tools.ts, backend/src/ai-core/tools/prompts.ts, backend/src/ai-core/tools/query-validators.ts
Removes createTableAnalysisTools(), createTableSettingsSystemPrompt(), and sanitizeJsonString() exported functions from AI core modules.
Message Builder Utilities
backend/src/ai-core/utils/message-builder.ts
Removes createSimpleMessages() convenience function while preserving core MessageBuilder class functionality.
Personal Table Settings Use Case
backend/src/entities/table-settings/personal-table-settings/use-cases/delete-personal-table-settings.use.case.ts, backend/src/entities/table-settings/personal-table-settings/use-cases/personal-table-settings.use-cases.interface.ts
Deletes entire DeletePersonalTableSettingsUseCase implementation class and its corresponding IDeletePersonalTableSettings interface contract.
Personal Table Settings Controller & Module
backend/src/entities/table-settings/personal-table-settings/personal-table-settings.controller.ts, backend/src/entities/table-settings/personal-table-settings/personal-table-settings.module.ts
Removes clearTableSettings() controller method and DELETE route (/settings/personal/:connectionId), along with deletion use case registration and associated middleware.
Dependency Injection & Helpers
backend/src/common/data-injection.tokens.ts, backend/src/helpers/app/get-requeired-env-variable.ts, backend/src/helpers/get-master-password.ts, backend/src/helpers/index.ts
Removes DELETE_PERSONAL_TABLE_SETTINGS enum member, getOptionalEnvVariable() and getMasterPwd() helper functions, plus their re-exports.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • lyubov-voloshko

Poem

🐰 With hopping joy, we prune the code,
Unused paths now shed their load,
No more settings to delete or erase,
Clean and tidy, a tidier place! ✨

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Backend unused code' is vague and generic, using non-descriptive language that doesn't clearly convey the scope or nature of the changes beyond mentioning they relate to backend code cleanup. Consider a more specific title that describes the primary change, such as 'Remove unused AI tools, helpers, and table settings deletion functionality' or 'Clean up deprecated database analysis and settings management code'.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed Pull request removes unused code with no remaining references in codebase and no broken imports or security implications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backend_unused_code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

Copy link
Copy Markdown
Contributor

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 removes unused backend helpers, AI utility functions, and a personal table settings DELETE use case/endpoint to reduce dead code and simplify the backend surface area.

Changes:

  • Removed unused helpers (getMasterPwd, getOptionalEnvVariable) and related exports.
  • Removed the personal table settings delete use case, its DI token wiring, and the controller/module DELETE route.
  • Removed unused AI-core utility functions (createSimpleMessages, sanitizeJsonString, createTableSettingsSystemPrompt, createTableAnalysisTools).

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
backend/src/helpers/index.ts Removes unused helper export.
backend/src/helpers/get-master-password.ts Deletes unused helper implementation.
backend/src/helpers/app/get-requeired-env-variable.ts Removes unused optional env var accessor.
backend/src/entities/table-settings/personal-table-settings/use-cases/personal-table-settings.use-cases.interface.ts Removes unused delete use case interface.
backend/src/entities/table-settings/personal-table-settings/use-cases/delete-personal-table-settings.use.case.ts Deletes unused delete use case implementation.
backend/src/entities/table-settings/personal-table-settings/personal-table-settings.module.ts Removes DELETE use case provider and DELETE route middleware binding.
backend/src/entities/table-settings/personal-table-settings/personal-table-settings.controller.ts Removes DELETE endpoint and delete use case injection.
backend/src/common/data-injection.tokens.ts Removes unused DI token for deleted use case.
backend/src/ai-core/utils/message-builder.ts Removes unused message helper function export.
backend/src/ai-core/tools/query-validators.ts Removes unused JSON sanitization helper.
backend/src/ai-core/tools/prompts.ts Removes unused system prompt builder.
backend/src/ai-core/tools/database-tools.ts Removes unused tool definition builder.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 29 to 32
import {
ICreateUpdatePersonalTableSettings,
IDeletePersonalTableSettings,
IFindPersonalTableSettings,
} from './use-cases/personal-table-settings.use-cases.interface.js';
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

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

After removing the DELETE endpoint/use case, the NestJS Delete decorator import at the top of this controller is now unused (no @Delete usage). Please remove it to keep imports accurate and avoid unused-import lint/knip noise.

Copilot uses AI. Check for mistakes.
@Artuomka Artuomka enabled auto-merge April 30, 2026 12:52
@Artuomka Artuomka merged commit 5110e9b into main Apr 30, 2026
18 of 19 checks passed
@Artuomka Artuomka deleted the backend_unused_code branch April 30, 2026 13:02
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.

2 participants