Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- **Harness reset no longer misses open PRs beyond the first page** (#321): the three `gh pr list` calls in `test-action-on-github.sh` had no `--limit`, so a repo with more than 30 open PRs kept its oldest through the reset — on 2026-09-21 the `.ml` lane had 31 after diagnosis work between two gates, and the survivor read as a missing verdict in the v0.29.2 tally. Now `--limit 200`, and a post-reset check that stops the run if any repo still has an open PR (a failed listing counts too: it no longer reads as "nothing to close").

## [0.29.2] - 2026-09-21

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion tool-test-action-on-github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ cd /path/to/action-translation/tool-test-action-on-github
```

The script will:
1. Reset test repositories to clean state
1. Reset test repositories to clean state — every open PR on the source repo and each target repo is closed, and the script stops if any is still open afterwards (a survivor would be counted as one of this run's PRs)
2. Run 28 automated test scenarios
3. Create PRs in source repository with `test-translation` label
4. Label triggers action → creates translation PRs in **every** target repository
Expand Down Expand Up @@ -239,6 +239,7 @@ Evaluation reports are saved to `reports/`:
**Script fails to reset repositories:**
- Check GitHub CLI authentication: `gh auth status`
- Verify repository access permissions
- "Reset left open PRs behind": the post-reset check found a PR still open on the repo it names. Close it by hand (or work out why `gh` could not) and run the script again; do not create fixture PRs on top of it

**PRs not created:**
- Check source repository workflow configuration
Expand Down
45 changes: 41 additions & 4 deletions tool-test-action-on-github/test-action-on-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,15 @@ if [ "$DRY_RUN" = false ]; then
cd "$WORK_DIR/$SOURCE_REPO"
fi

# Close PRs on source repo
# Close PRs on source repo.
# Every `gh pr list` here carries --limit 200: the default is 30, and a lane that
# has had diagnosis work between two gates (a re-run, a local-bundle validation)
# can hold more open PRs than that. On 2026-09-21 the .ml lane had 31, the oldest
# was never listed, and it survived the reset to be read as a missing verdict
# (#321). The check after the close loops makes any survivor, whatever its
# cause, stop the run before a fixture PR is created.
if [ "$DRY_RUN" = true ]; then
OPEN_PRS=$(gh pr list --repo "$OWNER/$SOURCE_REPO" --state open --json number --jq '.[].number' 2>/dev/null || echo "")
OPEN_PRS=$(gh pr list --repo "$OWNER/$SOURCE_REPO" --state open --limit 200 --json number --jq '.[].number' 2>/dev/null || echo "")
if [ -z "$OPEN_PRS" ]; then
echo -e "${CYAN}[DRY RUN] No open PRs to close on source repo${NC}"
else
Expand All @@ -630,7 +636,7 @@ if [ "$DRY_RUN" = true ]; then
fi
else
# Get list of open PRs
OPEN_PRS=$(gh pr list --repo "$OWNER/$SOURCE_REPO" --state open --json number --jq '.[].number')
OPEN_PRS=$(gh pr list --repo "$OWNER/$SOURCE_REPO" --state open --limit 200 --json number --jq '.[].number')

if [ -z "$OPEN_PRS" ]; then
echo "No open PRs to close on source repo"
Expand All @@ -652,7 +658,7 @@ for L in "${LANGUAGES[@]}"; do
name="$(lang_name "$L")"
repo="$OWNER/$SOURCE_REPO.$code"

TARGET_PRS=$(gh pr list --repo "$repo" --state open --json number --jq '.[].number' 2>/dev/null || echo "")
TARGET_PRS=$(gh pr list --repo "$repo" --state open --limit 200 --json number --jq '.[].number' 2>/dev/null || echo "")
if [ -z "$TARGET_PRS" ]; then
echo "No open PRs to close on $name target repo"
continue
Expand All @@ -667,6 +673,37 @@ for L in "${LANGUAGES[@]}"; do
done
done

# Verify the reset actually emptied every repo. A survivor here — a PR beyond the
# list page, a listing that failed and read as empty, a close that did not take —
# would be counted as one of this run's PRs and read as a missing verdict, so it
# is a hard stop, not a warning.
if [ "$DRY_RUN" != true ]; then
REPOS_TO_CHECK=("$OWNER/$SOURCE_REPO")
for L in "${LANGUAGES[@]}"; do
REPOS_TO_CHECK+=("$OWNER/$SOURCE_REPO.$(lang_code "$L")")
done
RESET_LEFTOVERS=""
for repo in "${REPOS_TO_CHECK[@]}"; do
# A listing that fails is a failure too — but say which repo and why, rather than
# letting `set -e` stop the run silently on the assignment.
if ! REMAINING=$(gh pr list --repo "$repo" --state open --limit 200 --json number --jq '.[].number' 2>&1); then
echo -e "${RED}✗ Could not list open PRs on ${repo}: ${REMAINING}${NC}"
echo -e "${RED} The reset cannot be verified — fix the listing and run the script again.${NC}"
exit 1
fi
if [ -n "$REMAINING" ]; then
RESET_LEFTOVERS="${RESET_LEFTOVERS} ${repo}: #$(echo "$REMAINING" | tr '\n' ' ' | sed 's/ $//; s/ / #/g')\n"
fi
done
if [ -n "$RESET_LEFTOVERS" ]; then
echo -e "${RED}✗ Reset left open PRs behind — stopping before any fixture PR is created:${NC}"
echo -e "$RESET_LEFTOVERS"
echo -e "${RED} Close them (or find out why gh could not) and run the script again.${NC}"
exit 1
fi
echo -e "${GREEN}✓${NC} All ${#REPOS_TO_CHECK[@]} repos have no open PRs"
fi

echo ""

#
Expand Down
Loading