From bda178f02884a3a9330938a0c99ab9e14734dc43 Mon Sep 17 00:00:00 2001 From: oglassdev <23040613+oglassdev@users.noreply.github.com> Date: Sun, 4 Oct 2026 23:53:05 -0400 Subject: [PATCH 1/2] fix: compute latest from stable releases only --- README.md | 11 ++++++++++- index.json | 9 +-------- scripts/registry.py | 12 +++++++++--- scripts/test_registry.py | 24 +++++++++++++++++++++++- 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 39b88b6..6668000 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ plain HTTP from `https://raw.githubusercontent.com/chunkzero/rpp-registry/main/` - `plugins/.json`: one file per plugin, edited by hand. - `index.json`: generated summary (name, description, repository, latest version). Never edit it - directly; run `python3 scripts/registry.py index`. + directly; run `python3 scripts/registry.py index`. `latest` is the newest non-yanked stable + version (no `-` prerelease suffix), so nightlies, alphas, betas and release candidates never + become `latest`. A plugin with no such version is left out of `index.json`. ```json { @@ -47,6 +49,13 @@ Set `"yanked": true` on a version and regenerate `index.json`. Published version immutable: they cannot be edited, reordered, removed, or un-yanked. A plugin whose versions are all yanked disappears from `index.json`. +## Prereleases + +Prerelease versions are published like any other and sort by semver precedence. Nightlies use +`X.Y.Z-nightly.YYYYMMDDHHMMSS.g` (older ones use `X.Y.Z-nightly.YYYYMMDD.g`); the +timestamp is a numeric identifier, so both forms order chronologically. Others use +`X.Y.Z-alpha.N`, `-beta.N` or `-rc.N`. + ## Development ``` diff --git a/index.json b/index.json index 7028d1a..fe51488 100644 --- a/index.json +++ b/index.json @@ -1,8 +1 @@ -[ - { - "name": "window", - "description": "Compiles UIs into resource-pack assets and Kotlin bindings. Source commit: 9872875840f74b8bb88bb354970b827edb1c57cc", - "repository": "https://github.com/chunkzero/window", - "latest": "0.1.0-nightly.20261003.g9872875840f7" - } -] +[] diff --git a/scripts/registry.py b/scripts/registry.py index 44fe8fc..8dd029e 100644 --- a/scripts/registry.py +++ b/scripts/registry.py @@ -126,9 +126,15 @@ def build_index(plugins: dict[str, dict]) -> str: entries = [] for name in sorted(plugins): p = plugins[name] - live = [v["version"] for v in p["versions"] if not v.get("yanked", False)] - if live: - latest = max(live, key=semver_key) + # rpp's index.json schema requires a version for `latest`, so plugins without a + # stable release are left out rather than listed with null or a prerelease. + stable = [ + v["version"] + for v in p["versions"] + if not v.get("yanked", False) and SEMVER_RE.fullmatch(v["version"]).group(4) is None + ] + if stable: + latest = max(stable, key=semver_key) entries.append( { "name": p["name"], diff --git a/scripts/test_registry.py b/scripts/test_registry.py index 6365e18..443231a 100644 --- a/scripts/test_registry.py +++ b/scripts/test_registry.py @@ -99,12 +99,34 @@ def test_index_orders_and_skips_yanked(self): self.assertLess(registry.semver_key("1.1.0-rc.1"), registry.semver_key("1.1.0")) self.assertLess(registry.semver_key("1.2.0"), registry.semver_key("1.10.0")) self.write([version_entry("1.0.0"), version_entry("1.1.0-rc.1"), version_entry("1.1.0"), - version_entry("1.2.0", yanked=True)], "zeta") + version_entry("1.2.0", yanked=True), version_entry("1.3.0-beta.1")], "zeta") self.write([version_entry("1.0.0", yanked=True)], "alpha") self.write([version_entry("0.1.0")], "beta") + self.write([version_entry("0.1.0-alpha.0"), version_entry("0.1.0-nightly.20261003.g9872875840f7")], + "gamma") index = json.loads((self.root / "index.json").read_text()) self.assertEqual([(e["name"], e["latest"]) for e in index], [("beta", "0.1.0"), ("zeta", "1.1.0")]) + def test_nightly_formats_order_and_append(self): + versions = [ + "0.1.0-alpha.0", + "0.1.0-beta.2", + "0.1.0-nightly.20261002.g67305fc8e4c3", + "0.1.0-nightly.20261003.g9872875840f7", + "0.1.0-nightly.20261004093000.g12336a991a34", + "0.1.0-nightly.20261004181500.g0123456789ab", + "0.1.0-rc.1", + "0.1.0", + ] + keys = [registry.semver_key(v) for v in versions] + self.assertEqual(keys, sorted(keys)) + self.write([version_entry(v) for v in versions[2:4]]) + self.commit() + archive = make_archive({"name": "widget", "version": versions[4]}) + self.serve(versions[4], archive) + self.write([version_entry(v) for v in versions[2:4]] + [version_entry(versions[4], archive)]) + self.assertEqual(registry.check(self.root, base="HEAD"), []) + def test_rejects_edited_published_version(self): self.write([version_entry("1.0.0")]) self.commit() From 30f238da237378c8ddc5a1e9fd22f5b7cf8e38c2 Mon Sep 17 00:00:00 2001 From: oglassdev <23040613+oglassdev@users.noreply.github.com> Date: Sun, 4 Oct 2026 23:57:35 -0400 Subject: [PATCH 2/2] fix: accept new versions anywhere in semver order --- README.md | 8 +++++--- scripts/registry.py | 4 ---- scripts/test_registry.py | 5 ++--- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 6668000..ac89ade 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,8 @@ containing `rpp.json` with the same `name` and `version`, and only regular files 1. Build the release archive and its hash with `rpp plugin pack`, and upload the archive to a GitHub release in the plugin repository. -2. Open a PR that appends the version to the `versions` of `plugins/.json` (or adds a new - plugin file) and regenerates the index with `python3 scripts/registry.py index`. +2. Open a PR that adds the version to the `versions` of `plugins/.json` in semver order + (or adds a new plugin file) and regenerates the index with `python3 scripts/registry.py index`. 3. CI runs `python3 scripts/registry.py check --base origin/main`, which downloads each new archive, verifies its hash and contents, and rejects changes to published versions. @@ -53,7 +53,9 @@ all yanked disappears from `index.json`. Prerelease versions are published like any other and sort by semver precedence. Nightlies use `X.Y.Z-nightly.YYYYMMDDHHMMSS.g` (older ones use `X.Y.Z-nightly.YYYYMMDD.g`); the -timestamp is a numeric identifier, so both forms order chronologically. Others use +timestamp is a numeric identifier, so each form orders chronologically and every 14-digit nightly +sorts after every 8-digit one of the same version. A beta or rc registered after nightlies of the +same version sorts below or above them by precedence, wherever that falls. Others use `X.Y.Z-alpha.N`, `-beta.N` or `-rc.N`. ## Development diff --git a/scripts/registry.py b/scripts/registry.py index 8dd029e..dbaa3c4 100644 --- a/scripts/registry.py +++ b/scripts/registry.py @@ -159,7 +159,6 @@ def compare_to_base(head: dict, base: dict) -> list[str]: if head[field] != base.get(field): errors.append(f"{field} must not change") head_by_version = {v["version"]: v for v in head["versions"]} - base_versions = [v["version"] for v in base.get("versions", []) if isinstance(v, dict)] for bv in base["versions"]: hv = head_by_version.get(bv["version"]) if hv is None: @@ -171,9 +170,6 @@ def compare_to_base(head: dict, base: dict) -> list[str]: errors.append(f"published version {bv['version']}: {f} must not change") if bv.get("yanked", False) and not hv.get("yanked", False): errors.append(f"published version {bv['version']}: cannot be un-yanked") - head_versions = [v["version"] for v in head["versions"]] - if head_versions[: len(base_versions)] != base_versions and set(base_versions) <= set(head_versions): - errors.append("new versions must be appended after the published versions") return errors diff --git a/scripts/test_registry.py b/scripts/test_registry.py index 443231a..6f965e7 100644 --- a/scripts/test_registry.py +++ b/scripts/test_registry.py @@ -196,14 +196,13 @@ def test_rejects_too_many_entries(self): errors = registry.validate_archive(archive, "widget", "1.0.0") self.assertTrue(any("more than 1 entries" in e for e in errors), errors) - def test_rejects_inserted_version(self): + def test_accepts_version_inserted_in_semver_order(self): self.write([version_entry("1.0.0"), version_entry("1.2.0")]) self.commit() archive = make_archive({"name": "widget", "version": "1.1.0"}) self.serve("1.1.0", archive) self.write([version_entry("1.0.0"), version_entry("1.1.0", archive), version_entry("1.2.0")]) - problems = registry.check(self.root, base="HEAD") - self.assertTrue(any("must be appended" in p for p in problems), problems) + self.assertEqual(registry.check(self.root, base="HEAD"), []) def test_semver_is_ascii_and_anchored(self): self.assertFalse(registry.is_semver("1.0.0\n"))