Skip to content

fix(cron): restore status, list, and manual run after scan contract change #88

Description

@Linxiushen

Bug description

app.service.cron.store.scan_jobs() now returns a tuple of (valid_jobs, invalid_mtimes), but three ManageCron consumers still treat the full return value as List[CronJob]:

  • _status() iterates the tuple and reads job.id
  • _list() filters tuple items by job.enabled
  • _run_now() searches tuple items by job.id

This contract changed in commit f49ac92ac574de7a3c5bb7e2b8daea9d84de42c4, while these tool call sites retained the previous list-only assumption.

Reproduction

  1. Invoke manage_cron with action=status or action=list, including with an empty cron directory.
  2. Invoke manage_cron with action=run and any job_id.

Each path receives ([], {}) or ([CronJob(...)], {}) and attempts to access a CronJob attribute on a list or dict tuple member. The public tool catches the resulting AttributeError and returns an error instead of the requested status, list, or manual run result.

Expected behavior

All three consumers should unpack scan_jobs() and operate only on the valid job list. Invalid-file metadata remains owned by the scheduler scan loop.

Proposed scope

  • unpack the scanner result in the three affected actions
  • add focused regression coverage for status, list filtering, and manual run lookup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions