Skip to content

Completion cache holds 9,762 unusable club slugs; scope it to managed clubs #175

Description

@Sootopolis

refreshClubsCache (Dispatcher.scala:82) populates the completion cache from /api/clubs, which is Club.selectAll with no join and no LIMIT (ClubRoutes.scala:34).

Measured on a real dev machine: 9,762 slugs / 197 KB in ~/.cache/ccas/clubs.txt — mostly opponent and scouted clubs ingested by history/recruitment crawls, none of which any command can act on. Tab-completing --club offers thousands of clubs you don't manage.

Knock-on: UseClub.warnIfUnknown (UseClub.scala:30-35) can never fire for any club CCAS has ever seen, so its typo hint is dead weight.

Proposal: point refreshClubsCache at /api/managed-clubs — already tombstone-filtered (ManagedClub.scala:50-56) and carrying slug on ManagedClubResponse — with /api/clubs as a fallback when the managed set is empty. That cuts the file to single digits, makes the 6h TTL nearly irrelevant, and gives warnIfUnknown real signal.

Also invalidate the cache from the ClubsAdd / ClubsRemove handlers so the 6h TTL doesn't delay a set change the user just made.

Note: tombstoned _stale_<id> slugs already never reach completion — /api/clubs filters via Club.isTombstoned (ClubRoutes.scala:32-38), pinned by TestRoutes.scala:957-978. Verified empirically: grep -c '^_stale_' ~/.cache/ccas/clubs.txt -> 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliCLI binary (subcommands, completions, config, packaging)enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions