Skip to content

Add parser-safe validation for mock API module structure #386

Description

@Lakes41

Difficulty

Intermediate

Type

tech-debt, structure, error-handling

Background

A syntax error in lib/api/mock.ts currently prevents the entire Next.js application from compiling. Because the file is a large mock API module, structural mistakes can have a wide application-level impact.

Problem

The current mock API structure provides little local isolation when a syntax or module-boundary error is introduced. A single malformed section causes consumers such as lib/api/index.ts and components/nav.tsx to fail.

Expected outcome

Reduce the scope and detectability of structural failures by organizing the mock API into independently understandable modules and adding focused validation where appropriate.

Suggested implementation

After identifying the actual mock API domains in lib/api/mock.ts, introduce small modules with clear exports and keep the aggregation layer minimal. Add focused tests or executable module-level checks for the exported mock API functions where the repository's existing test conventions support them. Do not introduce CI configuration as part of this issue.

Acceptance criteria

  • Mock API domains have clearly defined module boundaries.
  • A syntax error in one unrelated mock domain does not require editing a monolithic 2,000+ line module.
  • Public mock API exports remain stable for existing consumers.
  • At least the affected mock API behavior has a focused automated verification path using the repository's existing testing conventions.
  • No GitHub Actions or CI/CD changes are introduced.

Likely affected files/directories

  • lib/api/mock.ts
  • lib/api/
  • Existing test directories covering API behavior, if present

Metadata

Metadata

Assignees

Labels

Third CampaignOfficial FWC26 campaign issue — eligible for campaign scoring and rewardsintermediateIntermediate difficulty tasks requiring solid experience and some contextstructureCode structural organization, architecture changes, and module boundary improvementstech-debtTechnical debt reduction, maintenance improvements, and deferred cleanup work

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions