Skip to content

test: run the push round-trip against a throwaway MediaWiki in CI - #10

Merged
CameronBrooks11 merged 6 commits into
mainfrom
test/docker-mediawiki
Oct 22, 2026
Merged

CameronBrooks11 merged 6 commits into
mainfrom
test/docker-mediawiki

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

What

Adds the middle testing layer: the push round-trip test runs against a
throwaway MediaWiki 1.45 in Docker on every PR. It needs no secrets and never
touches a real wiki.

  • scripts/test-wiki.sh up|down starts mediawiki:1.45.6 (Appropedia runs
    1.45.x), installs it on SQLite with a random admin password, creates a bot
    password and a fixture page, waits until api.php answers, and prints the env
    exports. CI and contributors use the same script.
  • just test-integration runs it, then the round-trip test, then tears the
    container down. New CI job Integration (MediaWiki), required through ok.
  • The round-trip test is the stricter version: after each step the manifest
    revision, baseline, working file and status must match what the wiki stored.
    It also covers a second push (no-op), a whitespace-only change (null edit, no
    new revision), and an out-of-band edit (push must refuse in preview and with
    --apply), then restores the fixture byte-for-byte.
  • The real-wiki run is now just test-live. Both recipes set
    WIKISYNC_REQUIRE_INTEGRATION, so missing config fails instead of skipping.
    Checked locally: just test-live with no env exits 1.
  • mw.NewClientForAPI(apiURL, ua) for a full api.php URL; the test wiki is
    plain http on localhost.
  • README/AGENTS describe the three layers. Recipe docs use [doc()] so just --list shows the right line.

Verification

Locally: go vet under both tag sets, bash -n and shellcheck on the script,
just --list output, and the fail-not-skip behaviour. Docker is not reachable
from the session that wrote this
, so this PR's CI run is the first execution of
the script. The maintenance-script options (install --scriptpath=,
createBotPassword 32-character password and --grants, edit) were checked
against the REL1_45 sources.

After each step, assert that the manifest revision, the baseline and the
working file all match what the wiki actually stores, and that status
reports unchanged. Add a second push (must be a no-op), a whitespace-only
change (the wiki makes no new revision), and an out-of-band edit (push
must refuse, in preview and with --apply). Restore the fixture with a
direct API edit so it works after the conflict step.
scripts/test-wiki.sh starts mediawiki:1.45.6 in Docker, installs it on
SQLite with a random admin password, and creates a bot password and a
fixture page. just test-integration runs the round-trip test against it,
and a new CI job runs that on every PR, gated by ok. No secrets are
stored and no real wiki is touched.

The live-wiki run moves to just test-live. Both recipes set
WIKISYNC_REQUIRE_INTEGRATION, so missing config fails the run instead of
skipping it. mw gains NewClientForAPI for a full api.php URL (the test
wiki is plain http on localhost).
extractions/setup-just lists casey/just's releases through the GitHub API
on every run, and the version input only filters that list. When the
call returns nothing the step fails with 'no release for just matching
version specifier'. That happened on two of eight installs on
2026-10-22, before any of our code ran.

A local composite action now downloads just 1.40.0 directly and checks
it against the SHA-256 from upstream's SHA256SUMS. All three jobs use it.
FetchPage, RevisionText and the token request decoded the response without
checking MediaWiki's {"error":{"code","info"}} envelope, so an API error
surfaced as a misleading 'no page in response' or 'no token'. They now
return the API's code and message.
createBotPassword prints the new password on success, and that output went
to the job log. The credential only works on a container reachable from
inside the job and deleted after it, but secrets don't belong in logs.
Its stdout is now discarded; errors still go to stderr.
createBotPassword grants exactly what --grants lists, unlike
Special:BotPasswords, which always adds 'basic' (it carries 'read'). With
only 'editpage', the logged-in test bot got readapidenied on its first
read after login, which CI showed once API errors were reported.

Readiness now also requires the fixture page to be readable anonymously,
not just siteinfo, and dumps the response and LocalSettings permission
lines if it never is.
@CameronBrooks11
CameronBrooks11 merged commit a0fc75e into main Oct 22, 2026
6 checks passed
@CameronBrooks11
CameronBrooks11 deleted the test/docker-mediawiki branch October 22, 2026 15:33
CameronBrooks11 added a commit that referenced this pull request Oct 22, 2026
* docs: say push --apply is CI-tested against MediaWiki, pending Appropedia

The experimental note said push --apply was unverified against any live
wiki. Since #10 it runs against a real MediaWiki 1.45 on every change; it
is still not run against Appropedia itself (#12), so it stays
experimental.

* chore: bump version to 0.1.1
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.

1 participant