feat(#229): add configurable EXCLUDED_REPOS server-side filtering to CC APIs#
Problem#
CC API endpoints (tasks, events, jobs, metrics) had no server-side repo filtering. MetricsService had a hardcoded exclusion constant; other endpoints had none at all, leaking agent-core-e2e data to the frontend.
Task / Link#
GitHub Issue #229 — https://github.com/AgentSDE/agent-core/issues/229
Changes#
- Added
EXCLUDED_REPOSenv var to Joi config schema (default:AgentSDE/agent-core-e2e) - Created
ExcludedReposServiceinsrc/config/— parses CSV, exposesgetList()andisExcluded(); exported fromAppConfigModule TasksController:listTasks()andbulkAction()applyNOT INfilter;getTask()returns 404 for excluded reposEventsController:listEvents()joins totasksand appliesNOT INfilter ontask.repoJobsController:listJobs()appliesNOT INfilter;getJob()returns 404 for excluded reposMetricsService: replaced hardcodedEXCLUDED_REPOSconstant with injectedExcludedReposService; all raw SQL queries now use parameterized placeholders
Notes#
listEvents()gains anINNER JOINtotasks(via the existingevent.taskrelation) to accessrepo—taskIdFK is indexed so impact is minimal- Empty
EXCLUDED_REPOSvalue disables all filtering (theNOT INclause is omitted)
Testing#
- New unit tests:
excluded-repos.service.spec.ts(CSV parsing,isExcludededge cases),tasks.controller.spec.ts(list filtering, 404 guard) - Updated
metrics.service.spec.tsto provideExcludedReposServicemock npm run lintpasses (0 errors),npm run testpasses (645 tests)