Overview
AbTestingService.getAllExperiments() in src/ab-testing/ab-testing.service.ts runs experimentRepository.find({ relations: ['variants', 'metrics'], order: { createdAt: 'DESC' } }) with no take/skip. It eagerly loads every experiment along with all of their variants and metrics on a single request. As the number of experiments grows this becomes a large, slow query and a memory risk, and the endpoint that exposes it returns an unbounded payload.
Specifications
Features:
- Listing experiments is paginated with a bounded, documented page size.
- The endpoint accepts validated pagination parameters and returns a total count alongside the page.
Tasks:
- Add pagination (
skip/take, plus findAndCount for a total) to getAllExperiments() in src/ab-testing/ab-testing.service.ts, with a sane default and maximum page size.
- Update the corresponding handler in
src/ab-testing/ab-testing.controller.ts to accept and validate pagination query parameters and return the paginated shape.
- Consider whether
variants/metrics need to be eagerly joined for the list view or can be deferred to the detail endpoint.
Impacted Files:
- src/ab-testing/ab-testing.service.ts
- src/ab-testing/ab-testing.controller.ts
Acceptance Criteria
- The list endpoint never returns more than the configured maximum number of experiments per request.
- A default page size applies when no pagination parameters are provided; invalid values are rejected.
- The response includes enough information to page through all experiments (e.g. total count / next page).
Overview
AbTestingService.getAllExperiments()insrc/ab-testing/ab-testing.service.tsrunsexperimentRepository.find({ relations: ['variants', 'metrics'], order: { createdAt: 'DESC' } })with notake/skip. It eagerly loads every experiment along with all of their variants and metrics on a single request. As the number of experiments grows this becomes a large, slow query and a memory risk, and the endpoint that exposes it returns an unbounded payload.Specifications
Features:
Tasks:
skip/take, plusfindAndCountfor a total) togetAllExperiments()insrc/ab-testing/ab-testing.service.ts, with a sane default and maximum page size.src/ab-testing/ab-testing.controller.tsto accept and validate pagination query parameters and return the paginated shape.variants/metricsneed to be eagerly joined for the list view or can be deferred to the detail endpoint.Impacted Files:
Acceptance Criteria