Merge pull request #1814 from ludovic111/fix/mod-registry-pr-marker

🤖 Agent: merged after verify passed; mod-registry-land-1's combined check (pr_ready --quick on all seven, launcher tests 125, website 25/25, no harness affected) and live end-to-end on horizon-mods.
This commit is contained in:
Ludovic Marie
2026-10-25 15:54:52 +01:00
committed by GitHub
5 changed files with 59 additions and 11 deletions
+5 -2
View File
@@ -40,5 +40,8 @@ REGISTRY_PUBLIC_URL=http://localhost:4173 REGISTRY_SESSION_KEY=... GITHUB_CLIENT
| `REGISTRY_REPO` | Default `ludovic111/horizon-mods` |
| `PORT` | Default 8080 |
On Railway it is its own service (`railway.json`, built with the `Dockerfile` from the repository root); the website's
Caddy sends `/api/mods/*` to it over Railway's private network.
On Railway it is the service `horizon-mod-registry` of the project `horizon-site`, next to the website: built from
`main` with this `Dockerfile` from the repository root, health check `/healthz`, no public domain and no volume. The
website's Caddy sends `/api/mods/*` to it over Railway's private network (`REGISTRY_UPSTREAM` on the website service:
`http://horizon-mod-registry.railway.internal:8080`). `railway.json` lists the same settings; Railway reads them from
the service, not from the file.
+6 -1
View File
@@ -625,11 +625,16 @@ pub fn publish(
.map(|r| format!("- needs {} {}", r.id, r.version))
.collect();
let body = format!(
"<!-- submitted-by: {login} -->\nSubmitted by @{login} through [the form]({public}/mods/submit).\n\n\
"<!-- submitted-by: {login} -->\n🤖 Submitted through [{site}]({public}/mods/submit) by @{login}. The form opens the pull request with \
the registry's token: neither Ludovic nor a reviewer wrote it.\n\n\
| | |\n|---|---|\n| Project | `{id}` ({kind}, {new}) |\n| Version | {version} for {game} |\n| File | `{file}`, {size} bytes, SHA-256 `{sha256}` |\n| Signed | {signed} |\n| Source | {source} |\n\n{lists}\n\n\
The checks below run the file's own checks again and, for a mod, a trial run in the sandbox. \
Reviewers: read the source and the checks' report before you approve.",
public = config.public_url,
site = config
.public_url
.split_once("://")
.map_or(config.public_url.as_str(), |(_, host)| host),
id = form.id,
kind = kind.name(),
new = if is_new { "new" } else { "update" },
+5 -1
View File
@@ -303,7 +303,11 @@ async fn a_submission_becomes_a_pull_request() {
assert!(message.contains("Co-authored-by: alice <7+alice@users.noreply.github.com>"));
assert_eq!(replaced, &None);
let body = m.pulls[0]["body"].as_str().unwrap();
assert!(body.starts_with("<!-- submitted-by: alice -->"), "{body}");
assert!(
body.starts_with("<!-- submitted-by: alice -->\n🤖 Submitted through "),
"{body}"
);
assert!(body.contains("/mods/submit) by @alice."), "{body}");
assert!(body.contains("may draw text on your screen"), "{body}");
}
// The same version again: its branch is there.
+16 -1
View File
@@ -138,9 +138,24 @@ Unknown keys are refused. Its CI runs `cargo-horizon-mod` (`crates/cargo-horizon
| `cargo horizon-mod check <file> [--json]` | A submission's checks: its kind's (above), its signature with `--key` and `--signature`, and for a mod a trial run in the sandbox (40 ticks, 120 frames, a chat line, each command). |
| `cargo horizon-mod registry check <base> <head> --files <dir>` | `check` on each file `head` lists and `base` doesn't: a pull request's new files. |
| `cargo horizon-mod registry list <checkout>` | `<sha256> <id> <version> <file>` per version: the files to download. |
| `cargo horizon-mod registry build <checkout> --files <dir> --out index.json` | Reads every entry and its file (`<dir>/<sha256>`), lists every problem, and writes the index with URLs `<release>/<id>-<version>/<file>`. |
| `cargo horizon-mod registry build <checkout> --files <dir> --out index.json` | Reads every entry and its file (`<dir>/<sha256>`), lists every problem, and writes the index with URLs `<release><id>-<version>/<file>` (`--release`, ending in `/`, defaults to the repository's releases). |
| `cargo horizon-mod registry review <base> <head> --author <login>` | A pull request's changes: a published file never changes and is never removed (take it down in `revoked.toml`), a kind never changes; changes by a non-owner and to owners or keys are pointed out for the reviewers. |
How the repository runs (its workflows are in `.github/workflows/`):
- **A pull request** (`check.yml`) runs `registry review`, downloads each new file from the `staging` prerelease, runs
`registry check` on it and builds the index it would publish; the report is the run's summary. The tool is
`cargo-horizon-mod` from Horizon at the commit in the repository variable `HORIZON_REV`. The form's pull requests
are opened with the token of the account in the variable `REGISTRY_BOT`; for those, the author is the login in the
body's `<!-- submitted-by: … -->` line.
- **Merging** needs the `check` run and a CODEOWNER's review. `publish.yml` then makes each new version a release
`<id>-<version>` and deploys `index.json` and `icons/` to GitHub Pages:
`https://ludovic111.github.io/horizon-mods/index.json`, served with `Access-Control-Allow-Origin: *`.
- **Weekly**, `cleanup.yml` deletes staged copies of published files after 7 days and of files no open pull request
lists after 30.
- **Taking a file down** is a pull request adding it to `revoked.toml`. Removing an entry outright (a test, a project
nobody installed) fails `registry review` on purpose and needs an administrator's merge.
Kinds open to submissions: `mod`, `modpack`, `resourcepack`. `shader` is in the schema and stays closed until
Horizon's own shader pack format exists (Iris and OptiFine packs are for the Modrinth browser); its check will compile
the pack in a headless Horizon. A new kind gets its own check before it opens.
+27 -6
View File
@@ -378,6 +378,29 @@ none.
"top": "carve", "bottom": "none", "rigid_junctions": true, "inflate": true } }
```
## Publish your mod
Horizon's registry lists mods, modpacks (`.hpack`) and resource packs made for Horizon, each reviewed before it is
published. Players find them at [playhorizon.dev/mods](https://playhorizon.dev/mods) and in the launcher (Mods, then
**Horizon** beside Modrinth), which checks every file before it installs it.
1. Run `cargo horizon-mod check` on the file (above): the registry runs the same checks.
2. Put the source somewhere public, under a licence that lets players run it: reviewers read it, and the file must be
built from it.
3. Open [playhorizon.dev/mods/submit](https://playhorizon.dev/mods/submit), sign in with GitHub (it reads only your
public profile) and fill in the page: the file, its name and summary, licence, source address, and optionally a
minisign public key with the file's `.minisig`.
4. The form checks the file again and opens a pull request in
[ludovic111/horizon-mods](https://github.com/ludovic111/horizon-mods) that adds `mods/<id>.toml`, with you as its
owner. That repository's checks run the file in the sandbox and post their report on the pull request; answer the
reviewers there.
5. A reviewer merges it: within minutes the file is a release of horizon-mods, and the project is on the site and in
the launcher.
An update is the same form with a new version; only the project's `owners` can publish one, signed with its key if it
has one. A published file never changes. Without the form, open the pull request by hand (the repository's README
says how). The formats: [api/mod-index.md](api/mod-index.md).
## Versions and compatibility
- The API is the WIT package `horizon:mods@0.1.0`. New functions and
@@ -420,12 +443,10 @@ none.
format: a `.hmod.minisig` beside it); the index pins each project's public
key, so an update signed by another key is refused. Unsigned local files
stay allowed, with an "unsigned" mark on the Mods page.
- **Where mods come from.** Modrinth is where players already look and it
stores files with hashes, but its loader list is Modrinth's to extend: we ask
Modrinth to add a `horizon` loader. Until then (and as a fallback), the
launcher reads a small index of approved mods: a JSON file in a public Git
repository (id, versions, file URLs as GitHub release assets, SHA-256,
signing key). No server of our own is needed.
- **Where mods come from.** Horizon's registry ([Publish your mod](#publish-your-mod)): reviewed pull requests in
[ludovic111/horizon-mods](https://github.com/ludovic111/horizon-mods), files as its release assets, and an
`index.json` on GitHub Pages that the launcher and the website read. A file the registry takes down
(`revoked.toml`) is refused by the launcher and turned off where installed.
- **The launcher.** A Mods tab per installation: browse and search the index,
install, update, turn on and off (it writes the same `horizon-mods.txt`),
see capabilities before installing. The launcher's CLI and MCP tools gain