From 66fe1b81be50eaf917bc4602f01a62b7771b1c4c Mon Sep 17 00:00:00 2001 From: MickLesk <47820557+MickLesk@users.noreply.github.com> Date: Thu, 12 Nov 2026 17:47:22 +0100 Subject: [PATCH 1/2] Use the designated release for a tag prefix when it carries the prefix With a tag prefix, the lookup skipped the release the maintainer marked as latest and sorted the last 100 releases instead. In a busy monorepo that window is too short: maplibre/martin publishes about ten releases a week across its crates, martin-v1.16.1 already sits at position 44, and the lookup would have found no martin-v release within weeks. The designated release is now used for a prefix too, as long as its tag starts with that prefix. Another product's designated release still falls back to the sorted list. --- lib/forge.func | 10 +++++++--- tests/forge-release-json.sh | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/forge.func b/lib/forge.func index 291567c1..85f64701 100644 --- a/lib/forge.func +++ b/lib/forge.func @@ -1556,9 +1556,13 @@ _forge_release_json() { # The maintainer's own "latest" marking beats anything the tag strings can # tell us: it is what separates a release line from nightlies, betas and a # second product's tags in the same repo, none of which are reliably - # flagged prerelease. Only the unfiltered, stable case can use it. - if [[ -z "$tag_prefix" && "${GH_INCLUDE_PRERELEASE:-0}" != "1" ]] && - _forge_designated_release "$forge" "$base" "$repo_path" "$out"; then + # flagged prerelease. Only the stable case can use it, and with a tag prefix + # only when that release carries the prefix: the list below holds the last + # 100 releases, and in a busy monorepo (martin) the release a prefix asks + # for drops out of that window within weeks. + if [[ "${GH_INCLUDE_PRERELEASE:-0}" != "1" ]] && + _forge_designated_release "$forge" "$base" "$repo_path" "$out" && + [[ -z "$tag_prefix" || "$(jq -r '.tag_name // ""' "$out" 2>/dev/null)" == "$tag_prefix"* ]]; then [[ "$forge" == "github" ]] && _forge_keep_raw "$out" return 0 fi diff --git a/tests/forge-release-json.sh b/tests/forge-release-json.sh index 2cf4cc09..d59b1989 100644 --- a/tests/forge-release-json.sh +++ b/tests/forge-release-json.sh @@ -100,6 +100,21 @@ expect "the designated release still resolves" 0 "$?" expect "the designated release is used" v3.0.0 "$(jq -r .tag_name "$OUT")" expect "only one request was needed" 1 "$(grep -c curl "$CALLS")" +# martin: a prefix used to skip the designated release and sort the last 100, +# where martin-v* drops out within weeks behind betas and other crates. +prefixed() { + : >"$CALLS" + : >"$OUT" + _forge_release_json github maplibre/martin latest "martin-v" "$OUT" +} +MOCK_LATEST_CODE=200 MOCK_LATEST_BODY='{"tag_name":"martin-v1.16.1","draft":false,"prerelease":false}' \ + MOCK_BODY='[{"tag_name":"mbtiles-v0.15.0","draft":false,"prerelease":false}]' prefixed +expect "a prefix takes the designated release when it carries the prefix" martin-v1.16.1 "$(jq -r .tag_name "$OUT")" +expect "without asking for the list" 1 "$(grep -c curl "$CALLS")" +MOCK_LATEST_CODE=200 MOCK_LATEST_BODY='{"tag_name":"mbtiles-v0.15.0","draft":false,"prerelease":false}' \ + MOCK_BODY='[{"tag_name":"martin-v1.16.1","draft":false,"prerelease":false},{"tag_name":"mbtiles-v0.15.0","draft":false,"prerelease":false}]' prefixed +expect "another product's designated release falls back to the list" martin-v1.16.1 "$(jq -r .tag_name "$OUT")" + # databasement: without jq the prefixed lookup read "no tags" and built a URL without a version. ( ensure_dependencies() { From 9f9045d9325ad780bc42a0dc29fc0b55855f1915 Mon Sep 17 00:00:00 2001 From: MickLesk <47820557+MickLesk@users.noreply.github.com> Date: Fri, 13 Nov 2026 15:42:02 +0100 Subject: [PATCH 2/2] Trim the comments to what a reader would get wrong --- lib/forge.func | 5 +---- tests/forge-release-json.sh | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/forge.func b/lib/forge.func index 85f64701..3b339441 100644 --- a/lib/forge.func +++ b/lib/forge.func @@ -1556,10 +1556,7 @@ _forge_release_json() { # The maintainer's own "latest" marking beats anything the tag strings can # tell us: it is what separates a release line from nightlies, betas and a # second product's tags in the same repo, none of which are reliably - # flagged prerelease. Only the stable case can use it, and with a tag prefix - # only when that release carries the prefix: the list below holds the last - # 100 releases, and in a busy monorepo (martin) the release a prefix asks - # for drops out of that window within weeks. + # flagged prerelease. Only the stable case can use it; a tag prefix only when that release carries it. if [[ "${GH_INCLUDE_PRERELEASE:-0}" != "1" ]] && _forge_designated_release "$forge" "$base" "$repo_path" "$out" && [[ -z "$tag_prefix" || "$(jq -r '.tag_name // ""' "$out" 2>/dev/null)" == "$tag_prefix"* ]]; then diff --git a/tests/forge-release-json.sh b/tests/forge-release-json.sh index d59b1989..ecc10822 100644 --- a/tests/forge-release-json.sh +++ b/tests/forge-release-json.sh @@ -100,8 +100,6 @@ expect "the designated release still resolves" 0 "$?" expect "the designated release is used" v3.0.0 "$(jq -r .tag_name "$OUT")" expect "only one request was needed" 1 "$(grep -c curl "$CALLS")" -# martin: a prefix used to skip the designated release and sort the last 100, -# where martin-v* drops out within weeks behind betas and other crates. prefixed() { : >"$CALLS" : >"$OUT"