Skip to content

cast-vote.py's exit-code table lists four causes of rc 2 while the module returns it from five, and its rc 0 row describes a post a dry run does not make #1309

Description

@argszero

Symptom

scripts/cast-vote.py's module docstring carries an Exit codes table, and the tool's own text says
the counter's refusal is the authority and that the caller scripts against these codes. The table
enumerates four causes of rc 2, but the module returns 2 from five sites, and its rc 0
row describes a review that was posted while one of the tool's own rc 0 paths posts nothing.

Measured on master 75095ef6 (grep -n 'return 2' scripts/cast-vote.py → lines 311, 316, 324, 327,
353; the table is at lines 54–64).

Measured

rc 2 site (master) cause in the table?
311 --body-file could not be read (OSError) no
316 preflight refused: no cycle id / more than one / malformed --cycle / --cycle disagrees yes
324 the vote count could not be read (the counter raised) no
327 this cycle already has a counted vote or a veto here yes
353 gh failed yes

The rc 0 row reads "the review is posted and check-vote-count.py counts it", while
--dry-run (documented in Usage, and in --help as "run every check, post nothing") returns 0
without posting anything — assert rc == 0 in tests/test_cast_vote.py::test_dry_run_posts_nothing.

Both gaps are pre-existing: master's table has the same four listed causes and the same dry-run
path, so neither is introduced by the current work on this file (PR #1308 touches the veto and
none rows, which this measured as accurate).

Why it matters

A caller scripting on the exit code reads this table as the contract: 0 is what a wrapper uses to
decide whether a vote went out, and an unlisted 2 reads as "not one of the documented refusals".
This repo's own rule is that a derived claim is not written where it can be measured — here the
table can be measured against the return statements, so the two rows can be kept in step by
naming the two missing causes (and by saying that --dry-run exits 0 having posted nothing).

Expected

  • the rc 2 row names the two remaining causes — an unreadable --body-file, and a vote count that
    could not be read — or states explicitly why they are deliberately out of scope;
  • the rc 0 row no longer implies a post on every 0 (mention the dry run).

Either is a prose change to one docstring; the cheaper check is that the enumerated causes match
grep -n 'return 2', which is what made this measurable in the first place.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions