Skip to content

refactor(constants): create error_constants.py — centralize repeated error strings (#3530)#3539

Merged
mrveiss merged 2 commits intoDev_new_guifrom
issue-3530
Apr 5, 2026
Merged

refactor(constants): create error_constants.py — centralize repeated error strings (#3530)#3539
mrveiss merged 2 commits intoDev_new_guifrom
issue-3530

Conversation

@mrveiss
Copy link
Copy Markdown
Owner

@mrveiss mrveiss commented Apr 5, 2026

Summary

Creates autobot-backend/constants/error_constants.py and replaces the highest-density repeated error message strings across 6 API files.

New file: constants/error_constants.py

Defines named constants for the four main error families: ERR_*_NOT_FOUND, ERR_INVALID_CREDENTIALS, ERR_INVALID_TOKEN, ERR_FAILED_TO.

Files updated

File Occurrences replaced
api/security_assessment.py 11 × "Assessment not found"ERR_ASSESSMENT_NOT_FOUND
api/terminal.py 8 × "Session not found"ERR_SESSION_NOT_FOUND
api/files.py 9 × file/directory not-found variants → ERR_FILE_NOT_FOUND, ERR_DIRECTORY_NOT_FOUND, etc.
api/knowledge_connectors.py 6 × "Connector not found"ERR_CONNECTOR_NOT_FOUND
api/workflow.py 5 × "Workflow not found"ERR_WORKFLOW_NOT_FOUND
api/auth.py "Invalid username or password" + "Invalid token" → named constants
constants/__init__.py Exports all new constants

Skipped (per issue guidance)

  • api/memory.py — all "Failed to X" are f-strings with unique operation names; no identical repeats qualify
  • api/batch_jobs.py — "Job/Template {id} not found" are f-strings with dynamic IDs

Closes #3530

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

@mrveiss mrveiss merged commit 5816c93 into Dev_new_gui Apr 5, 2026
3 of 4 checks passed
@mrveiss mrveiss deleted the issue-3530 branch April 5, 2026 21:53
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