Skip to content

analyze: exit code is 0 even when nothing was successfully processed #115

Description

@SkowronskiAndrew

The analyze command returns exit code 0 unconditionally once it runs, regardless of what happened to the input files. Two observed cases:

  • Analyzing a Player build without TypeTrees: every file is skipped (Successfully processed files: 0, Failed files: 0, Files without TypeTrees: 4), a fully-formed but empty database is written, and the exit code is 0. This is a total failure presented as success — a script (or AI agent) that checks the exit code, or checks that the .db file exists, will conclude the analysis worked.
  • A run with Failed files: 8 (mixed input) also exits 0.

The per-file skip reasons do go to stderr, which is good, but detecting "this run produced nothing useful" currently requires parsing the summary sentence on stdout.

Proposal:

  • Return a non-zero exit code when Successfully processed files == 0 (nothing usable was analyzed).
  • Decide what partial failure (Failed files > 0 but some successes) should do — a distinct non-zero code, or keep 0 and rely on the stderr lines. Open for discussion; the zero-successes case is the important one.

For comparison, dump and find-refs already return 1 on their failure cases.

Found during a review of how well AI agents can use the tool unattended; the exit code is the main signal such tools rely on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions