release: externalize and locally test releases index generation#102
Conversation
ReviewGood refactoring. Externalizing the jq logic makes it genuinely easier to test locally, and the edge-case coverage is solid. Minor issuesArg-parsing silently accepts a missing flag value (build_releases_index.sh) The argument loop uses a default-to-empty pattern so passing a flag as the last argument without a value silently sets the variable to empty string. The script then fails with the generic Missing required arguments message. A non-empty check before assigning each value would make CI failures easier to diagnose. No test for omitting --existing entirely --existing is documented as optional, but every test case passes the flag. A case that omits it altogether would confirm the optional path works independently of the file-existence check. dedupe_first_by_version is O(n^2) Fine at max=100, but worth a short comment so a future reader does not replace it with unique_by (which would change dedup semantics). Nits
What is working well
Overall a net improvement - the logic is easier to reason about and validate. |
|
Supplementing the existing review with two minor points not covered: Workflow: releases_fetch_err="/tmp/releases-fetch.err"
if ! aws s3 cp ... 2>"${releases_fetch_err}"; then
if grep -qiE '404|NoSuchKey|Not Found|HeadObject operation' "${releases_fetch_err}"; then
rm -f /tmp/releases-existing.json
else
cat "${releases_fetch_err}" >&2
exit 1 # ← releases_fetch_err not cleaned up here
fi
fi
rm -f "${releases_fetch_err}" # only reached on success or 404 branchOn the Workflow: grep -qiE '404|NoSuchKey|Not Found|HeadObject operation'
|
|
Correction to first review: The first review states there is no test for omitting Date validation gap for existing entries: |
|
Following up on the previous reviews after the latest commits: What was addressed:
Still open — temp file cleanup on The pattern now appears in two places without cleanup on failure: immutability_check_err="/tmp/immutability-check.err"
# ...
exit 1 # immutability_check_err not removedreleases_fetch_err="/tmp/releases-fetch.err"
# ...
exit 1 # releases_fetch_err not removedInconsequential on ephemeral runners, but inconsistent with the script's own |
|
One remaining nit in The EXIT trap is updated to drop jq -e '.releases | type == array' "$tmp_output" >/dev/null
trap 'rm -f "$tmp_existing"' EXIT # ← resets trap before mv
mv "$tmp_output" "$output_path" # ← if this fails, tmp_output leaksIf jq -e '.releases | type == array' "$tmp_output" >/dev/null
mv "$tmp_output" "$output_path"
trap 'rm -f "$tmp_existing"' EXIT # update trap only after successful mvAll prior feedback has been addressed — LGTM overall. |
Summary
releases.jsongeneration intoscripts/build_releases_index.shscripts/test_build_releases_index.shandmake test-release-indexfor local validationrust-release.ymlto call the script instead of inlinejqjqavailability and--dateRFC3339 format in the scriptWhy
The previous inline workflow logic was hard to test locally. This change keeps behavior in one script, makes edge-case handling explicit, and adds a local test harness.
Validation
make test-release-indexbash -n scripts/build_releases_index.sh scripts/test_build_releases_index.shactionlint .github/workflows/rust-release.yml