The CODECHECK register management bot. Its commands, and who may run each, are on the help page.
If the research paper has code, it must run.
@chekhovbot assists the repeated tasks around a CODECHECK: welcoming
codecheckers, assigning them, validating codecheck.yml early, and opening the
pull request against register.csv. It is controlled by mentions in the checks
issue in codecheckers/register,
following the convention established by the Open Journals bots: the command
goes on the first line of the comment. More commands may follow, each on a
line of its own that begins with @chekhovbot, up to five; they are answered
in order.
@chekhovbot commands
@chekhovbot assign @user as codechecker
@chekhovbot codecheckers suggest
@chekhovbot check codecheck.yml
@chekhovbot check ready
@chekhovbot check start
@chekhovbot status
@chekhovbot remind me in 2 weeksNot every GitHub account. @chekhovbot takes commands from:
- members of the
codecheckersorganisation, on any issue it works on; - whoever opened an issue or is assigned to it, on that issue, member or not - but not on a pull request, which anybody can open;
- on a check, its handling editor, assigned codechecker and authors as its
record has them, and whoever an editor added with
@chekhovbot allowlist add @user; - on the codechecker lists, the person a registration is for, also when the bot opened the registration.
This comes before the roles: a command that needs no role is for anybody in
this list, and the others need their role on top. Somebody else who asks is
told so once on an issue, without being notified, and is only logged after
that (a refusal the bot had to make without being able to look everything up
says so, and does not count as that once); a comment holding a Zenodo share
link is deleted all the same, and explained up to three times per person and
issue (refusals.share_link_replies), after which it gets no further reply.
A link the bot could not delete is warned of apart from that: as many times
again, and at least once.
A link that opens nothing on Zenodo is left alone, see below. The
allowlist belongs to one check, lets somebody ask and gives them no role;
@chekhovbot allowlist shows it and allowlist remove @user takes somebody
off. It is kept, signed, in the record comment on the issue
(docs/record-key.md), like everything else the bot
knows about a check. The codechecker lists have no allowlist.
Anybody who may open an issue becomes its opener and may ask on it. The rule keeps strangers out of other people's checks; it is no defence against abuse in general. Reminders and nudges already recorded are sent whoever asked.
Tracking issue: codecheckers/register#209
Anton Chekhov (1860-1904): a pun on check, and on Chekhov's gun — if the gun
is on the wall in Act I it must fire in Act III; if the paper has code, it must
run. (Star Trek's Chekov has one h.)
The bot answers commands, hello and an unknown command on the testing
register, and validates a codecheck.yml when a comment names the repository
to read it from. Editors can announce a published certificate on Mastodon with
@chekhovbot announce <certificate>, which previews the toot, and
@chekhovbot announce <certificate> confirm, which posts it; in development
the toot is a direct message with every mention defused. @chekhovbot codecheckers says where the codechecker lists are, and an editor can ask
@chekhovbot codecheckers suggest for candidates, named without notifying
them. @chekhovbot certificate says which certificate identifier the check
holds, @chekhovbot certificate next which one comes next, and
@chekhovbot certificate set reserves it for the check. A command names its
subject first and then what to do with it, so the commands about one thing sit
together; the forms written the other way round before 0.22 -
set certificate, suggest codecheckers and the rest - still work.
codecheck works wherever check does, as in @chekhovbot codecheck start.
@chekhovbot check ready says whether a check can start - a README, a
codecheck.yml with a manifest, a licence and a paper - for the author as much
as the editor. @chekhovbot check zenodo audits the certificate's Zenodo
record against the CODECHECK community's curation policy and the
codecheck.yml, and reads a draft through a share link, so that the record can
be fixed before it is published; it deletes the comment that held the link,
which anyone who can read the issue could otherwise use. First it asks Zenodo,
with up to two HEAD requests a link, whether there is anything there: only
when there are at most three links in the comment, and Zenodo shows neither a
record nor a draft to any of them, is the comment left. For a draft this does test
the link: Zenodo hides a draft from a token that does not open it. That does not show that a link is genuine - Zenodo answers
for a published record whatever token comes with it - so in every other case,
and when Zenodo does not answer, the comment is deleted. @chekhovbot check start, @chekhovbot status and
@chekhovbot check finish say where a check stands and move the register's labels with it, running the
checks that already exist rather than repeating them: because those take time,
the reply is posted at once and rewritten in place as each answers. check start
waits for an assigned codechecker, a handling editor and a certificate
identifier, which @chekhovbot certificate set reserves. Once the
certificate is in register.csv, check finish also reads its page in the
register and links it when it says what codecheck.yml says.
On the codechecker lists,
codecheckers/codecheckers,
the bot answers a registration as a codechecker: when the issue is opened, and
again on @chekhovbot include check, it says what the row still needs - the
columns, the ORCID, a way to reach the person besides GitHub, and whether they
are listed already. @chekhovbot include, for editors, then opens the pull
request adding the row to codecheckers.csv and checks the organisation's side:
for somebody it sees no invitation for it is an owner's to run, and asks that
owner to send one; it says when one
is waiting to be accepted, and puts a member in the codecheckers team. The
nightly sweep follows it up from there - and opens a registration by itself for a
codechecker who joins after an assign asked the owners for them, as
@chekhovbot include open @handle does for an editor - and once they are in the team and
their row is merged, posts the welcome and closes the registration. It
answers nothing else there.
On a check, @chekhovbot invite @handle starts that from the register, for an
editor: it opens the registration on the lists even before the person has
joined, and for somebody outside the organisation asks the owners to invite
them, unless an assign asked already or an invitation is out. Somebody
outside is asked only when they have taken part in the issue - commented, or
been mentioned, as assign mentions them - because the registration notifies
them, and a mistyped handle would notify a stranger; include open on the
lists keeps the same rule.
@chekhovbot check register builds the row the check would get in
register.csv - from the issue's Repository line and labels, or what an editor
set with repository set and venue set - and runs the rules on it before
anything is written; @chekhovbot register then opens the pull request adding
it, for an editor to merge, and @chekhovbot check certificate <certificate>
runs the rules on a row already there. It runs
against
codecheckers/testing-dev-register
only; the production register is not configured anywhere. See
docs/deployment.md.
# the bot: /dispatch, /help, /healthz, /nudges
go run ./cmd/chekhov serve
# the same answer, offline; with CHEKHOV_GH_ACCESS_TOKEN set it also asks
# whether --as (default: $USER) is in the organisation, and refuses if not
echo '@chekhovbot commands' | go run ./cmd/chekhov comment -
# an editor's preview
echo '@chekhovbot announce 1970-001' | go run ./cmd/chekhov comment --as nuest --online -
# a registration, as `include check` answers it
go run ./cmd/chekhov include check https://github.com/codecheckers/codecheckers/issues/98
# every row of a list
go run ./cmd/chekhov include check --online codecheckers.csv
# one row
go run ./cmd/chekhov include check --online 'Name,@handle,0000-…,see ORCID page,…'go build ./...
# the report, non-zero on failure
go run ./cmd/chekhov check path/to/codecheck.yml
# also asks OpenAlex, ORCID, Zenodo
go run ./cmd/chekhov check --online path/to/codecheck.yml
# read it from the repository
go run ./cmd/chekhov check github::codecheckers/Piccolo-2020
# the same, platform inferred
go run ./cmd/chekhov check codecheckers/Piccolo-2020
# the certificate, looked up in the register
go run ./cmd/chekhov check 2020-001
# one part of the catalogue
go run ./cmd/chekhov check bundle github::codecheckers/demo
# what the repository is, not a verdict
go run ./cmd/chekhov check repository codecheckers/demo
# which links no longer answer, advice only
go run ./cmd/chekhov check links codecheckers/Piccolo-2020
# the reply the bot posts
go run ./cmd/chekhov check --markdown path/to/codecheck.yml
# the rules, and which are checked
go run ./cmd/chekhov rules
# are they the register's current ones?
go run ./cmd/chekhov rules --checkThe bot reports one version, internal/build.Version, and it is bumped by
hand in the commit that earns it - beside the CHANGELOG.md entry, never saved
up for a release. /healthz, @chekhovbot version and the development footer
all read that constant, so a deployment and a local build answer the same way.
It is semantic versioning applied to what somebody talking to the bot can see. A new command or a new thing a reply reports is a minor bump; a fix, a wording change or a rule refresh is a patch; a command removed or renamed, or a reply whose meaning changes under somebody already relying on it, is major.
Two things hold it together. A test compares the constant with the newest
heading in CHANGELOG.md, checks the headings are newest-first and dated, and
fails when anything is parked under Unreleased. And because that test reads
one tree rather than a diff - so a feature written under the existing heading
would pass - CI additionally fails a pull request that changes non-test Go
without moving the version, unless it carries the no-version-bump label.
The commit the build was made from is a separate question, answered only by the
stamp go build makes from the checkout since Go 1.24 - the one source nothing
can hand over wrongly. A development deployment, and a locally built binary
previewing a reply, name it and say when the tree had uncommitted changes; a
go run names nothing rather than guessing. The version itself is not taken
from git, because the deployment's builder may have no .git, and a version
that is sometimes semantic and sometimes a pseudo-version is worse than one
that is always the same shape.
The rules are maintained in the register, not here, one file per version of the
configuration file specification:
https://github.com/codecheckers/register/blob/master/RULES.md. Chekhov embeds
a copy, refreshed with scripts/update-rules.sh.
The same identifiers are used by the
codecheck R package, so the same
rule is CC-CFG-016 in both implementations, and the two can be compared by
grepping for an identifier. Which rules apply to a file follows from the
specification version it declares, and a rule's severity comes from the rule
file rather than from either codebase.
Everything is exercised against the testing register, never the real one:
https://github.com/codecheckers/testing-dev-register. See
docs/development.md for the full setup.
go test ./... # fast, offline
CHEKHOV_INTEGRATION=1 go test -run Integration ./internal/check/ # external servicesThe fast suite needs no network and covers every rule, including the ones that ask an external service: recorded cassettes replay what OpenAlex, ORCID, Zenodo, GitHub and the register really answered, and stubbed servers cover the answers a published CODECHECK never gives. CI runs it on every push and pull request.
The integration suite asks the live services the same questions, to catch the day one of them changes its answer. It reads only, and CI runs it weekly.
Code MIT (see LICENSE). Graphics in logo/ are CC BY 4.0, matching the rest
of the CODECHECK branding. The Chekhov quotes in
internal/command/data/quotes.yml come from
Wikiquote and are CC BY-SA 4.0;
every reply that uses one links back to the page. The help page's footer,
internal/command/helpfooter.html, is copied from
codecheck.org.uk, which publishes it under CC BY-SA
4.0.