Project

General

Profile

Actions

Task #6127

closed

CLI: companies-garbage-collect dispatches to UsersMetricsGatheringCommand

Added by Redmine Admin about 10 hours ago. Updated about 9 hours ago.

Status:
Resolved
Priority:
High
Assignee:
-
Start date:
08/26/2026
Due date:
% Done:

100%

Estimated time:

Description

Found while reviewing the stats daemon (parent epic #6116).

Problem

Application.kt:131-133:

if (args.contains("companies-garbage-collect")) {
    PicocliRunner.run(UsersMetricsGatheringCommand::class.java, )
    return
}

Copy-paste error — this runs the year-long IIKO user-metrics gather instead of the companies garbage collection. CompaniesGarbageCollectionCommand is reachable only via the obsolete-companies alias (line 151), which is what the daemon happens to use, so the bug is latent — but anyone invoking companies-garbage-collect by name triggers a very expensive unrelated job.

Also

UsersMetricsGatheringCommand is annotated @CommandLine.Command(name = "iiko-user-metrics-sync") while Application.kt dispatches on iiko-users-metrics-sync (plural) and scripts/workflow/download_users_stats.sh passes the plural form. The dispatch is a plain args.contains, so it works, but the picocli name and the invoked name should agree.

Fix

  • Dispatch companies-garbage-collect to CompaniesGarbageCollectionCommand.
  • Align the picocli command name with the dispatched string.
  • Consider replacing the chain of args.contains checks with a real picocli subcommand registration, which would have made both mistakes impossible.
Actions

Also available in: Atom PDF