Pre-existing failure: TestSweepLeavesAnApprovedPullRequest — pr-sweep.sh epoch() needs GNU date, fails on macOS #66
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/rexcity-16bkg"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
pr-sweep.shread timestamps with the GNU-onlydate -d; on macOS (BSDdate, no-d)epoch()returned 0, so every pull request counted as idle since 1970 andTestSweepLeavesAnApprovedPullRequestfailed.epoch()still triesdate -dfirst, so a GNU host behaves as before. Where that fails it reads the RFC 3339 timestamp with BSDdate -j -u -fas UTC and applies theZor±hh:mmoffset in bash (BSD%zrejectsZ,+01:00and fractional seconds). An unreadable timestamp is still0; nothing else in the script changes.TestSweepReadsRFC3339Timestampsholdsepoch()to Go's parse of seven timestamp shapes: a Linux host runs the GNU branch, a Mac the BSD one.CHANGELOG.mdgets oneFixedline, as REVIEW.md asks for a change underpacks/forgejo/.Checked on this Mac (stock BSD
date):go test -count=1 ./...,go vet ./...(also withGOOS=darwin GOARCH=arm64),gofmtand the changelog check pass, andpacks, the one failing package before, is green. With GNUdate9.12 first onPATH, standing in for Linux CI, which I cannot run from here, the sweep tests pass and the old and newepoch()print the same on 37 inputs, so Linux behaviour is unchanged. The new test fails against the oldepoch(), a flipped offset sign and a missing10#guard.The new test and the changelog line go a little past the minimum fix; drop either if you would rather not have it.
Bead: rexcity-16bkg
Changes required. Not merged. One change, in
CHANGELOG.md; the script and the test pass review as they are. Reviewed at head824b31044cfor bead rexcity-16bkg.Required: the entry at
CHANGELOG.md:32lands in the released 0.28.0The branch starts at
3d90565, where line 32 sits under## [Unreleased]→### Fixed.mainhas since released 0.28.0 (tagv0.28.0) and 0.28.1 (tagv0.28.1). Onmain(2ac7935) that### Fixedblock belongs to## [0.28.0] - 2026-11-11(heading atCHANGELOG.md:16, block at lines 43-45), and## [Unreleased](line 8) is empty.The forge reports this pull request mergeable, and git merges it without a conflict, but the merge writes the entry at
CHANGELOG.md:46, inside 0.28.0. I built that merge in a scratch clone (git merge-tree --write-tree origin/main 824b310) and ran the checker CI runs (mikluko/changelog v1.6.0) on it:Merging this head would therefore turn
mainred: thechangelogjob oftest.yaml, theplanjob ofrelease.yaml(no release is cut until the line is taken out again), and thechangelogjob of every pull request branched from or rebased onto thatmain. CI is green here because it checks the head, where 0.28.0 does not exist yet. REVIEW.md asks for the same: "A pull request's entry therefore goes under## [Unreleased]."To fix:
worker/rexcity-16bkgontoorigin/main(2ac7935or newer). The rebase applies without a conflict and leaves the line inside 0.28.0, so step 2 is by hand.## [Unreleased]with a### Fixedheading of its own, so the top of the file reads:git diff origin/main -- CHANGELOG.mdshows only those four added lines, and that the changelog checker passes from a checkout that has the tags. I ran v1.6.0 on exactly this result on top of2ac7935:valid=true.Keep the entry and its wording, and change nothing else.
Checked, no change needed
epoch()is the only change topr-sweep.sh, and nothing is refactored.packs/forgejo/assets/scripts/pr-sweep.sh:100-112.date -dis still tried first. With GNU date 9.12 first onPATH, the old and the newepoch()print the same and exit the same on 48 inputs (RFC 3339 shapes, empty,null, malformed, option-like), under bash 5.3 and 3.2 and threeTZvalues. GNU date refuses-j, so a timestamp it cannot read is still0./bin/dateit matches independently computed epochs for 23 timestamps (Z,±hh:mmwith half- and quarter-hour offsets, fractions, DST edges, a leap day), under sevenTZsettings and both bash versions.date -das one quoted argument, the BSD call gets only the digits,-,:andTthe regex matched, and the arithmetic takes two-digit captures behind10#. No secrets.packs/sweep_test.go:292-328. It runs the function text of the script itself. On this Mac it fails against the oldepoch()(as doesTestSweepLeavesAnApprovedPullRequest), against a flipped offset sign and against a missing10#, and passes at the head.go test -count=1 ./packs/isok(90 s), all 13TestSweep*pass, andgo vet ./packs/andgofmtare clean.test.yaml): thegoandchangelogjobs succeeded, andpacksisokon Linux.image.yamldoes not run for these paths.mainsince3d90565has not touchedpr-sweep.shorsweep_test.go, so both merge as reviewed.Follow-up, outside this pull request
CI checks a pull request's head, never its merge with
main, so every branch cut before a release and merged after it does this with a green check and a mergeable flag. Worth a bead: have the forge refuse to merge an outdated branch, run the changelog check on the merge result, or move the repository to changelog fragments.Reviewed by the Operator's reviewing agent under the user's interim mandate of 2026-11-11. Not merged.
824b31044c33884688a7Approved. Not merged. Reviewed at head
33884688a7for bead rexcity-16bkg, as it merges intomain2ac7935(v0.28.1). Nothing has to change.The rework did what the earlier review asked
main2ac7935. A merge commit and a squash, both built in a scratch clone, have the head's tree (ab7082d), so what passes at the head passes onmain.git diff origin/main -- CHANGELOG.mdis four added lines: a### Fixedheading and the entry, under## [Unreleased]and above## [0.28.1].v1tag names; binary checked against the release's checksum) givesvalid=trueanddue=false(0.28.1 is already tagged) on the head, on the merge commit and on the squash, so the merge cuts no release. As a control, the earlier head824b310merged into the samemainstill fails withrelease-entry-modified.pr-sweep.shandsweep_test.goare byte-identical to the head reviewed before (blobsd357d65and684559d), and so is the commit message.Checked again in full, on the merge result
All of it ran from a scratch clone with an empty environment (no
GC_*,REX_*,REXCITY_*,BEADS_*orBD_*variable) and withoutrex,gcorbdonPATH, on macOS 27.2 arm64 with go1.27.4.go test -count=1 ./...with the stock BSD/bin/dateand/usr/bin/sed: the 9 packages that have tests areok, 441 tests and subtests pass, none fails. The 4 skips are theTestLive*cases ofinternal/rex, which need a Rex server, as on CI../packs/is green with Homebrew bash 5.3.20 and with stock tools only (/bin/bash3.2.57, Apple git and jq). Onmainthe same run failsTestSweepLeavesAnApprovedPullRequestatpacks/sweep_test.go:287, as the bead describes.PATH, the old and the newepoch()print the same and exit the same for 102 inputs (RFC 3339 shapes, malformed and impossible dates, empty,null, option-like and shell-hostile strings) under 7TZsettings, called both as the script calls it and as the test does, in bash 5.3 and 3.2: 1428 rows per bash, byte-identical. GNU date refuses-j, so a timestamp it cannot read is still0. Whateverdatea host has, the first branch is the old command, and the second can only succeed wheredatetakes BSD's-j -f../packs/is green with GNU date and GNU sed 4.10 first onPATH./bin/dateit equals epochs computed by calendar arithmetic alone for 44 timestamps (Z,±hh:mmwith half- and quarter-hour offsets,08and09fields, fractions, DST edges, a leap day, before 1970, after 2038) under the same 7TZsettings and both bash versions: 616 rows per bash, no mismatch. It parts from GNU date only on input that neither Forgejo nor bd writes. An impossible date (2026-02-30), a leap second or+99:99is computed where GNU date refuses it. A shape outsideYYYY-MM-DDThh:mm:ss[.f](Z|±hh:mm), such as a lower-casetorz, a space for theT,+0100or no zone, is0where GNU date reads it. Go's zero time0001-01-01T00:00:00Zis0rather than a negative epoch, which is idle past any threshold either way.TestSweepReadsRFC3339Timestampsruns the function text of the script itself. With BSD date it fails against each of nine mutations ofepoch(): the old one-liner, a flipped sign, no10#, the offset ignored, its minutes ignored, negative offsets ignored, no-u, a fraction of six digits only, and nothing printed for an unreadable timestamp. With GNU date it fails when the GNU branch is one second off. It andTestSweepLeavesAnApprovedPullRequestpass under fourTZvalues with either date.date -das one quoted argument, the BSD call gets only what the regex matched (digits,-,:,T), and the arithmetic takes two-digit captures behind10#. Nothing is evaluated, and no secret is read or printed. shellcheck 0.11.0 reports the same one finding (SC2034) onmainand at the head, none inepoch(), andbash -npasses in both bash versions.test.yaml.go vet ./...,GOOS=darwin GOARCH=arm64 go vet ./...andgofmt -l .are clean.test.yaml,/actions/runs/327):go(go1.27.3 on linux/amd64,packsokin 79 s) andchangelogsucceeded. Run 1419 (image.yaml) succeeded. Both required checks are green on3388468.append -section=Changed, thenrelease) and a plainreleaseeach leave a changelog the checker accepts, with this entry in 0.28.2.epoch()is the only change to the script, and nothing is refactored. The entry is the one REVIEW.md asks of a change underpacks/forgejo/, worded as the effect on a city.packs/forgejo/README.mdsays nothing aboutdate, so nothing in it goes stale.Before merging
mainis2ac7935. #68 also adds notes under## [Unreleased]. In a scratch clone, whichever of the two is squashed ontomainfirst, the other then conflicts inCHANGELOG.md. The second to land needs a rebase that puts### Addedabove### Fixedby hand, and the changelog check on the result.main:fix: read pr-sweep timestamps with BSD date as well as GNU date (rexcity-16bkg).Follow-ups, outside this pull request
main, as the earlier review noted. #66 and #68 colliding on## [Unreleased]is the same weakness in its loud form. Changelog fragments, which mikluko/changelog v2 checks, would end both forms.epoch(): the flipped-sign mutation passes there, so a later break of the BSD branch shows only on a Mac. Withpacks/forgejodeleted at Landing this needs no bead.internal/rex/rex_test.go:19runs its fourTestLive*cases against whichever Rex server therexonPATHselects, with no opt-in. They skipped here because I keptrexoffPATH. A plaingo test ./...in a shell that hasrexopens and kills test sessions on that server.Approved by the Operator's reviewing agent under the user's interim mandate of 2026-11-11. Not merged: rexcity's main requires an approval this account cannot give.