Difficulty
Intermediate
Type
refactor, structure, tech-debt
Background
lib/api/mock.ts is at least 2,117 lines long and currently contains enough unrelated mock API behavior that a single structural mistake prevents the entire API layer from compiling. The parser failure in this file also affects consumers such as lib/api/index.ts and components/nav.tsx.
Problem
Keeping a large collection of mock data and mock API implementations in one file makes structural errors difficult to locate and increases the blast radius of small changes.
Expected outcome
Organize the existing mock API implementation into smaller modules with clear responsibilities while preserving the public API consumed through lib/api/index.ts.
Suggested implementation
Identify logical groups within lib/api/mock.ts, such as analytics data, resource access data, navigation-related mocks, and other API domains actually present in the file. Move each cohesive group into an appropriately named module under lib/api/mock/ or the repository's existing API structure. Keep lib/api/index.ts as the stable aggregation point where practical.
Acceptance criteria
- The oversized mock implementation is divided according to actual domains present in
lib/api/mock.ts.
- No mock behavior is removed during the refactor.
- Existing imports through
lib/api/index.ts continue to work.
- No module contains unrelated mock domains merely to reduce line count.
- The root application compiles successfully after the refactor.
Likely affected files/directories
lib/api/mock.ts
lib/api/mock/ (new modules as appropriate)
lib/api/index.ts
Difficulty
Intermediate
Type
refactor, structure, tech-debt
Background
lib/api/mock.tsis at least 2,117 lines long and currently contains enough unrelated mock API behavior that a single structural mistake prevents the entire API layer from compiling. The parser failure in this file also affects consumers such aslib/api/index.tsandcomponents/nav.tsx.Problem
Keeping a large collection of mock data and mock API implementations in one file makes structural errors difficult to locate and increases the blast radius of small changes.
Expected outcome
Organize the existing mock API implementation into smaller modules with clear responsibilities while preserving the public API consumed through
lib/api/index.ts.Suggested implementation
Identify logical groups within
lib/api/mock.ts, such as analytics data, resource access data, navigation-related mocks, and other API domains actually present in the file. Move each cohesive group into an appropriately named module underlib/api/mock/or the repository's existing API structure. Keeplib/api/index.tsas the stable aggregation point where practical.Acceptance criteria
lib/api/mock.ts.lib/api/index.tscontinue to work.Likely affected files/directories
lib/api/mock.tslib/api/mock/(new modules as appropriate)lib/api/index.ts