Skip to content

refactor(db): split settingsRepository god-module into 5 focused repositories#641

Merged
zbigniewsobiecki merged 1 commit intodevfrom
refactor/settings-repository-split
Mar 7, 2026
Merged

refactor(db): split settingsRepository god-module into 5 focused repositories#641
zbigniewsobiecki merged 1 commit intodevfrom
refactor/settings-repository-split

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 7, 2026

Summary

  • Split settingsRepository.ts (441 lines, 25 functions, 6 domains, 24 consumers) into 5 focused single-responsibility modules
  • Converted original file to a barrel re-export for zero-breaking-change backward compatibility
  • Added 5 domain-specific test files mirroring the new module boundaries

What was refactored

New Module Functions Extracted Domain
organizationsRepository.ts getOrganization, updateOrganization, listAllOrganizations Organizations
cascadeDefaultsRepository.ts getCascadeDefaults, upsertCascadeDefaults Cascade Defaults
projectsRepository.ts listProjectsFull, getProjectFull, createProject, updateProject, deleteProject Projects
integrationsRepository.ts 10 functions: all *ProjectIntegration*, getAllProjectIdsWith*Integration, plus *IntegrationCredential* Integrations + Credentials
agentConfigsRepository.ts listAgentConfigs, createAgentConfig, updateAgentConfig, deleteAgentConfig, getMaxConcurrency + maxConcurrencyCache Agent Configs

settingsRepository.ts is now a barrel re-export — all 24 existing consumer files continue to work unchanged.

Test plan

  • npm run typecheck — zero errors
  • npm run lint — zero errors
  • npm test — 239 test files, 3988 tests, all passing
  • 5 new domain-specific test files added: organizationsRepository.test.ts, cascadeDefaultsRepository.test.ts, projectsRepository.test.ts, integrationsRepository.test.ts, agentConfigsRepository.test.ts
  • Original settingsRepository.test.ts still passes unchanged (via barrel re-export)

Card

https://trello.com/c/69abe1d42301a258bc6fa949

🤖 Generated with Claude Code

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

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

Summary

Clean refactoring that splits a 441-line god-module into 5 focused, single-responsibility repository modules with a barrel re-export for full backward compatibility. No issues found.

Verified:

  • Code was extracted verbatim — no logic changes during the split
  • All 25 exported functions have unique names across the 5 modules (no export * collisions)
  • All 24 existing consumer files import from settingsRepository.js and continue to work unchanged via the barrel
  • 5 new domain-specific test files cover the new modules; original settingsRepository.test.ts still passes through the barrel
  • CI: lint, typecheck, unit tests, and integration tests all pass
  • Module boundaries are well-chosen: Organizations, Cascade Defaults, Projects, Integrations+Credentials, Agent Configs

@zbigniewsobiecki zbigniewsobiecki merged commit b4f0ad0 into dev Mar 7, 2026
6 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the refactor/settings-repository-split branch March 16, 2026 16:43
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.

3 participants