Repository navigation
fix(cli)!: exit with the heibench codes for usage and environment - #69
Merged
Merged
Conversation
Following the ruling on #66, wikisync exits on the org table: - usage errors exit 64, not 2 - an unreachable or failing wiki, missing credentials, a failed login, and a working tree or local file that can't be read or written exit 4, not 1 or 2 - refusals stay 1: conflicts, skipped pages, an untracked title, a pull that wrote nothing, --max exceeded push now tells the wiki declining an edit (mw.Refused: an API error such as protectedpage or editconflict, or an edit result other than Success) from the wiki or the connection failing (a server error, a read-only or lagged wiki, a rate limit, a lost session, a transport or HTTP-status failure). The first is a new `refused` line and exit 1; the second stays an `error` line and exits 4. A run with both exits 4, since it didn't finish deciding. An edit that lands but whose saved text can't be read back keeps exit 0 with its warning, and a pull that matched nothing keeps 1. The core test fake now answers a stale baserevid with the editconflict API error the real wiki sends, so that case is refused. BREAKING CHANGE: scripts branching on exit 2 for usage or on 1 for an unreachable wiki, missing credentials or a failed login need updating. Closes #66
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applies the ruling on #66: wikisync exits on the heibench table. This breaks scripts, so it ships as 0.7.0 in a release PR after this one.
--host, bad--depth, a different wiki,push --applywithout--summarypull --watchlist/push --applywithout credentialsstatus,diff,push,pull)push: the wiki declines an edit (protectedpage, editconflict, abuse filter, edit result not Success)errorlinerefusedlinepush: the wiki or the connection fails on a page (server error, readonly, maxlag, ratelimited, lost session, transport, HTTP status)errorlinepushwith both in one run--maxexceededmw.Refusedclassifies the error. It lives beside the client because it reads MediaWiki's error codes.apiErroris exported asAPIErrorso the core tests can build one, and an edit result other than Success wraps the newmw.ErrEditFailed; its message is unchanged.core.Pushmarks a declined requestPushRefused.The core test fake answered a stale
baserevidwith a plain error. It now answers with theeditconflictAPI error the real wiki sends, so that test expectsrefused. The integration test's success check also rules outrefused.Tests: the expected codes in
TestRun,TestLoginNeedsCredentialsandTestPullWatchlistLogsInFirstmove to the new values. New tests:mw:Refusedover 8 responses through the real request pathcore: a declined edit is refused and leaves the baselineBreaking each mapping fails a test:
just check(gofmt, golangci-lint 0 issues, vet) andjust test(go test -race ./...) pass.go vet -tags integration ./...passes; the Docker round trip runs in CI.docs/commands.mdand the CHANGELOG (Unreleased) carry the new codes.Closes #66