Missing API endpoint: GET /api/data/archived-outputs/stats #295

Closed
opened 2026-01-25 16:51:55 +00:00 by jack · 1 comment
Owner

Problem

The API endpoint GET /api/data/archived-outputs/stats returns a 404 error:

{"error":"NotFound","message":"Route not found: GET /api/data/archived-outputs/stats","code":"ROUTE_NOT_FOUND"}

Context

This endpoint is likely expected by the Endless Mode dashboard widget (EndlessModeCard) that was recently added to display compression statistics.

Expected Behavior

The endpoint should return statistics about archived outputs, such as:

interface ArchivedOutputStats {
  totalCount: number;
  pendingCount: number;
  processingCount: number;
  completedCount: number;
  failedCount: number;
  skippedCount: number;
  totalOriginalTokens: number;
  totalCompressedTokens: number;
  compressionRatio: number;
}

Solution

  1. Add the route in packages/backend/src/routes/
  2. Implement the stats aggregation query in the archived outputs repository
  3. Connect the endpoint to the existing ArchivedOutputRepository
  • Issue #109 - Endless Mode
  • Recent commits adding EndlessModeCard to Dashboard
## Problem The API endpoint `GET /api/data/archived-outputs/stats` returns a 404 error: ```json {"error":"NotFound","message":"Route not found: GET /api/data/archived-outputs/stats","code":"ROUTE_NOT_FOUND"} ``` ## Context This endpoint is likely expected by the Endless Mode dashboard widget (`EndlessModeCard`) that was recently added to display compression statistics. ## Expected Behavior The endpoint should return statistics about archived outputs, such as: ```typescript interface ArchivedOutputStats { totalCount: number; pendingCount: number; processingCount: number; completedCount: number; failedCount: number; skippedCount: number; totalOriginalTokens: number; totalCompressedTokens: number; compressionRatio: number; } ``` ## Solution 1. Add the route in `packages/backend/src/routes/` 2. Implement the stats aggregation query in the archived outputs repository 3. Connect the endpoint to the existing `ArchivedOutputRepository` ## Related - Issue #109 - Endless Mode - Recent commits adding `EndlessModeCard` to Dashboard
Author
Owner

This endpoint has already been implemented:

  1. Route registration: packages/backend/src/routes/data.ts:138

    this.router.get('/archived-outputs/stats', this.asyncHandler(this.getArchivedOutputsStats.bind(this)));
    
  2. Handler implementation: packages/backend/src/routes/data.ts:1391-1399

    private async getArchivedOutputsStats(req: Request, res: Response): Promise<void> {
      if (!this.deps.archivedOutputs) {
        res.status(501).json({ error: 'Archived outputs not available (Endless Mode not enabled)' });
        return;
      }
      const stats = await this.deps.archivedOutputs.getStats();
      this.success(res, stats);
    }
    
  3. Repository method: packages/database/src/mikro-orm/repositories/ArchivedOutputRepository.ts:197-222

    • Returns: totalCount, pendingCount, completedCount, failedCount, totalTokensSaved
  4. Wiring: packages/backend/src/server/backend-service.ts:416 passes archivedOutputs to DataRouter

The endpoint should now work. If you're still seeing a 404, please ensure the backend has been rebuilt and restarted with the latest code (pnpm build && pnpm dev:restart).

This endpoint has already been implemented: 1. **Route registration**: `packages/backend/src/routes/data.ts:138` ```typescript this.router.get('/archived-outputs/stats', this.asyncHandler(this.getArchivedOutputsStats.bind(this))); ``` 2. **Handler implementation**: `packages/backend/src/routes/data.ts:1391-1399` ```typescript private async getArchivedOutputsStats(req: Request, res: Response): Promise<void> { if (!this.deps.archivedOutputs) { res.status(501).json({ error: 'Archived outputs not available (Endless Mode not enabled)' }); return; } const stats = await this.deps.archivedOutputs.getStats(); this.success(res, stats); } ``` 3. **Repository method**: `packages/database/src/mikro-orm/repositories/ArchivedOutputRepository.ts:197-222` - Returns: `totalCount`, `pendingCount`, `completedCount`, `failedCount`, `totalTokensSaved` 4. **Wiring**: `packages/backend/src/server/backend-service.ts:416` passes `archivedOutputs` to DataRouter The endpoint should now work. If you're still seeing a 404, please ensure the backend has been rebuilt and restarted with the latest code (`pnpm build && pnpm dev:restart`).
jack closed this issue 2026-01-25 17:02:47 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
customable/claude-mem#295
No description provided.