Skip to content

Cleanup: Remove boilerplate JSDoc comments from API client #318

Description

@brianlan

Summary

Remove obvious boilerplate JSDoc comments from frontend/src/api/client.ts that merely restate method names without adding information.

Background / Context

The API client file has ~80 methods, almost all with JSDoc comments that restate the method name in slightly different words. For example:

  • /** Fetches all exams */ before fetchExams()
  • /** Deletes an exam */ before deleteExam(id)
  • /** Generic GET request */ before get<T>(path)
  • /** Login with username and password */ before login(username, password)

These comments add zero information beyond what the method signature already communicates. Meanwhile, the actually complex function handleResponse (which parses error JSON with fallback, extracts nested error.code/error.message, and handles 204 responses) has no JSDoc at all.

Problem

Boilerplate comments create visual noise and train developers to ignore all comments — including ones that might actually matter. They also create a maintenance burden (comments drift out of sync with renamed methods).

Goal / Expected Behavior

Obvious restating-the-name JSDoc comments are removed. Any JSDoc documenting non-trivial behavior (e.g., auth strategy, error shapes, retry logic) is preserved. The code is cleaner and more scannable.

Scope

This issue should cover:

  • Removing JSDoc comments that merely restate the method name
  • Preserving any JSDoc that documents non-obvious behavior

Out of Scope

This issue should not cover:

  • Adding new JSDoc comments (e.g., documenting handleResponse)
  • Changing any method implementations
  • Modifying API types or interfaces
  • Other frontend files

Chosen Implementation Approach

Manual review of each JSDoc comment in client.ts. Remove if the comment adds nothing beyond the method name + types. Keep if it documents non-obvious behavior.

Implementation Plan

The implementor should:

  1. Read through each JSDoc comment in client.ts
  2. For each, ask: "Does this comment tell me something I can't already see from the method name and type signature?"
  3. Remove comments that fail this test (expected: ~15 of ~17 JSDoc blocks)
  4. Preserve comments that document non-trivial behavior, such as:
    • The auth strategy comment on the api object (if it mentions credentials: 'include' or cookie-based auth)
    • getSolutionStatus comment mentioning "canonical solution generation" (adds context beyond the method name)
  5. Run any frontend linting/build to verify no issues

Relevant Files / Areas

  • frontend/src/api/client.ts — the only file to modify

Tests Required

The implementor must add or update automated tests covering:

  • No new tests needed — this is comment removal
  • Existing frontend tests and TypeScript compilation must pass

At minimum, tests should verify:

  • cd frontend && npx tsc --noEmit passes (TypeScript compilation)
  • Any existing frontend test suite passes

Manual Verification / Self-Check

Before claiming this issue is done, the implementor must:

  1. Run: cd frontend && npx tsc --noEmit
  2. Verify the remaining JSDoc comments (if any) document non-trivial behavior
  3. Verify no method implementations were changed
  4. Record the exact commands run and results in the PR description

Reviewer Acceptance Checklist

The reviewer should verify that:

  • Only JSDoc comments were removed — no code changes
  • Removed comments were genuinely obvious/restating-the-name
  • Any preserved comments document non-trivial behavior
  • TypeScript still compiles
  • No methods, types, or logic were modified

Dependencies

None.

Follow-Up Work

  • Consider adding meaningful JSDoc to handleResponse and the ApiError shape to document the actually complex parsing logic. This is additive work and not required for this issue.

Definition of Done

This issue is done when:

  • Boilerplate JSDoc comments are removed from client.ts
  • Any remaining JSDoc adds genuine value
  • TypeScript compilation passes
  • No code logic was changed

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions