Skip to content

fix: make tool-error paths exit 2 in release doc sync [skip version] - #199

Open
abhicodes-007 wants to merge 1 commit into
TMHSDigital:mainfrom
abhicodes-007:fix/152-arg-error-exit-code
Open

abhicodes-007 wants to merge 1 commit into
TMHSDigital:mainfrom
abhicodes-007:fix/152-arg-error-exit-code

Conversation

@abhicodes-007

Copy link
Copy Markdown

Problem

Bad arguments in release-doc-sync raised a string SystemExit, which exits 1. The composite action treats 1 as "files changed", so invalid input produced a green step with no edits. An undecodable doc raised an uncaught UnicodeDecodeError (also exit 1), and drift_check reported a malformed STANDARDS_VERSION as drift (1) instead of a tool error.

Approach

Both CLIs now print diagnostics to stderr and exit 2. sync.py catches ValueError alongside OSError, and --date is validated as YYYY-MM-DD. action.yml is unchanged because it already treats rc>=2 as failure.

Tests

pytest: 361 passed, 2 skipped. Nine new regression tests cover every validation branch, subprocess exit code, undecodable docs, and malformed STANDARDS_VERSION. Each of the three fix loci was sabotaged separately and the tests failed as expected.

Risk

No VERSION bump is included; [skip version] is in the PR title for the repo's validate workflow. Follow-up docs/ROADMAP alignment remains with maintainers.

Closes #152

Bad arguments raised SystemExit with a string, which exits 1. The
release-doc-sync action treats 1 as "files changed", so bad input produced
a green step with no edits. UnicodeDecodeError escaped the OSError-only
handler, and drift_check re-raised a string SystemExit for a malformed
STANDARDS_VERSION, also exiting 1 ("drift found").

Print diagnostics to stderr and exit 2 in both CLIs, catch ValueError
alongside OSError in sync main, and validate --date as YYYY-MM-DD. The
action already fails on rc>=2, so no action.yml change is needed.

Adds focused regression tests for every validation branch, the subprocess
exit code, undecodable docs, and malformed STANDARDS_VERSION.

Closes TMHSDigital#152

Signed-off-by: Abhishek Deepak <abhicodes-007@users.noreply.github.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

release-doc-sync bad-argument errors exit 1, which the action treats as success

1 participant