Skip to content

dashboard-api: /api/watches and /api/watches/history read one DynamoDB page (lagotto#181 fixed in lagotto's store, not here) #1421

Closed

Description

@scttfrdmn

lambda/dashboard-api/watches.go reads only the first Query page in handleListWatches (on user_id-index, no LastEvaluatedKey loop) and in handleWatchHistory (Limit: 100, one page). lagotto fixed this same bug in its own store as lagotto#181 ("ListWatchesByUser reads one Query page, so lagotto list/history can silently drop watches", closed, fixed with queryAll). The dashboard has its own copy of the query, and the fix never reached it.

Evidence (code, origin/main)

  • handleListWatches: one client.Query(...), then result.Items is returned. LastEvaluatedKey is never read.
  • handleWatchHistory: one client.Query(... Limit: 100). That cap may be intended, but the response has no cursor and no truncated flag, so the UI can't tell it is seeing a partial list.

Cost, not inflated

A DynamoDB Query page holds up to 1 MB, and watch items are roughly 1 KB, so /api/watches only starts dropping watches once a single user has around a thousand. This is unlikely today. The consequence when it does happen is that the dashboard shows an incomplete list as if it were complete, which is the #63 failure shape. The history cap of 100 is the more reachable case.

Fix

Paginate like lagotto queryAll. For history, either paginate or return a cursor/truncated flag.

Found while auditing persistence options for lagotto-ts (spore-host/lagotto-ts#4).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcomponent:spawntype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions