Repository navigation
perf(source-control): find pr-verify FAILs by exact-name index instead of the whole artifact listing #12302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
perf(source-control): find pr-verify FAILs by exact-name index instead of the whole artifact listing #12302
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e6e88f6
perf(source-control): upload a FAIL index before each pr-verify FAIL
kyle-sexton aab5d41
perf(source-control): judge verdicts by exact-name index reads
kyle-sexton fae2a74
fix(source-control): write no unindexed FAIL and reach the legacy file
kyle-sexton 2b9d334
chore(source-control): add changelog fragments for the FAIL index
kyle-sexton ea4f4f0
feat(source-control): build the legacy FAILs file from verifier runs
kyle-sexton 9babebd
Merge branch 'main' into perf/verdict-reader-name-index
kyle-sexton 8342d75
fix(source-control): build legacy FAILs from runs and the listing's u…
kyle-sexton 696ba56
fix(source-control): keep earlier FAIL indexes and read re-run and in…
kyle-sexton 44b849d
fix(source-control): answer the #12302 review threads on the FAIL index
kyle-sexton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
.changes/pr-pipeline/perf-verdict-reader-name-index-8d2f4b16.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| bump: minor | ||
| --- | ||
|
|
||
| ### Changed | ||
|
|
||
| - A pr-verify FAIL first uploads one index artifact per tie the merge gate counts (`.github/actions/upload-fail-index`), and uploads only once every index did; a job without the index step writes no FAIL. The gate reads those exact names instead of the whole artifact listing once the legacy FAILs file is committed. |
8 changes: 8 additions & 0 deletions
8
.changes/source-control/perf-verdict-reader-name-index-5c1e7a93.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| bump: minor | ||
| --- | ||
|
|
||
| ### Added | ||
|
|
||
| - The pr-merge verdict reader has an index mode: once `verify-legacy-fails.json` sits beside it, a judgment finds every FAIL by exact-name reads of the FAIL index (`pr-verify-index-pr-<n>`, `-sha-<head>`, `-ref-<digest>`, `-issue-<i>`) and the runs they name, instead of paging the whole artifact listing. Any read that fails or misses its own count refuses. | ||
| - `babysit_verify_evidence.py legacy-fails --merge-sha <sha>` builds that file. It reads every pr-verify run in one-day `created` windows up to the cutover the merge commit sets, and each run's artifacts, each read holding its own `total_count`. It then adds every run a whole artifact listing names, and refuses when a listed FAIL is still missing. Its calls are paced, capped per rate-limit window and resumable from a checkpoint. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| name: Upload a FAIL's index artifacts | ||
| description: > | ||
| Upload one small artifact per name in `names` (write-verdict.mjs | ||
| failIndexNames: the pull request, the head, the head branch's digest and each | ||
| issue the FAIL records), each holding `path`, so the pr-merge lane's reader | ||
| finds every FAIL by exact-name lookups instead of the repository's whole | ||
| artifact listing (babysit_verify_evidence.py `Reader._targeted`). The FAIL's | ||
| upload must require this step's success: a FAIL with no index is one that | ||
| reader cannot see, and a failed index upload leaves no verdict at all. More | ||
| names than slots fail the step. A name the run already holds (an earlier | ||
| attempt's upload) fails the step too, so a re-run attempt writes no FAIL: | ||
| replacing the name would delete the earlier attempt's pointer first, and | ||
| keeping it would leave a new FAIL that outlives its index. | ||
|
|
||
| inputs: | ||
| names: | ||
| description: The index artifact names, one per line (at most 13). | ||
| required: true | ||
| path: | ||
| description: The file each index artifact holds. | ||
| required: true | ||
| retention-days: | ||
| description: The FAIL's retention, which each index keeps. | ||
| required: true | ||
| github-token: | ||
| description: A token that can read this run's artifacts (actions read). | ||
| required: true | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Split the names | ||
| id: slots | ||
| shell: bash | ||
| env: | ||
| NAMES: ${{ inputs.names }} | ||
| RETENTION: ${{ inputs.retention-days }} | ||
| GH_TOKEN: ${{ inputs.github-token }} | ||
| REPO: ${{ github.repository }} | ||
| RUN_ID: ${{ github.run_id }} | ||
| run: | | ||
| case "$RETENTION" in | ||
| [1-9] | [1-8][0-9] | 90) echo "retention-days=$RETENTION" >>"$GITHUB_OUTPUT" ;; | ||
| *) | ||
| echo "::error::retention-days is not 1 to 90" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| mapfile -t names < <(printf '%s\n' "$NAMES" | sed '/^$/d') | ||
| if [ "${#names[@]}" -lt 3 ] || [ "${#names[@]}" -gt 13 ]; then | ||
| echo "::error::${#names[@]} FAIL index names, not 3 to 13" | ||
| exit 1 | ||
| fi | ||
| # The names this run holds already, every attempt's, in one read | ||
| # that must hold its own count. | ||
| if ! body=$(gh api "repos/$REPO/actions/runs/$RUN_ID/artifacts?per_page=100"); then | ||
| echo "::error::the run's artifacts could not be read" | ||
| exit 1 | ||
| fi | ||
| if ! jq -e '.total_count == (.artifacts | length) and .total_count < 100' <<<"$body" >/dev/null; then | ||
| echo "::error::the run's artifacts do not hold their count" | ||
| exit 1 | ||
| fi | ||
| mapfile -t held < <(jq -r '.artifacts[].name' <<<"$body") | ||
| slot=0 | ||
| for name in "${names[@]}"; do | ||
| case "$name" in | ||
| pr-verify-index-[a-z]*-[0-9a-f]*) ;; | ||
| *) | ||
| echo "::error::a FAIL index name no reader takes" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| found= | ||
| for have in "${held[@]}"; do | ||
| if [ "$have" = "$name" ]; then found=1; fi | ||
| done | ||
| if [ -n "$found" ]; then | ||
| echo "::error::$name is held by an earlier attempt of this run, so this attempt writes no FAIL" | ||
| exit 1 | ||
| fi | ||
| slot=$((slot + 1)) | ||
| echo "n$slot=$name" >>"$GITHUB_OUTPUT" | ||
| done | ||
| - name: Upload index 1 | ||
| if: ${{ steps.slots.outputs.n1 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n1 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
| - name: Upload index 2 | ||
| if: ${{ steps.slots.outputs.n2 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n2 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
| - name: Upload index 3 | ||
| if: ${{ steps.slots.outputs.n3 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n3 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
| - name: Upload index 4 | ||
| if: ${{ steps.slots.outputs.n4 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n4 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
| - name: Upload index 5 | ||
| if: ${{ steps.slots.outputs.n5 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n5 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
| - name: Upload index 6 | ||
| if: ${{ steps.slots.outputs.n6 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n6 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
| - name: Upload index 7 | ||
| if: ${{ steps.slots.outputs.n7 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n7 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
| - name: Upload index 8 | ||
| if: ${{ steps.slots.outputs.n8 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n8 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
| - name: Upload index 9 | ||
| if: ${{ steps.slots.outputs.n9 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n9 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
| - name: Upload index 10 | ||
| if: ${{ steps.slots.outputs.n10 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n10 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
| - name: Upload index 11 | ||
| if: ${{ steps.slots.outputs.n11 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n11 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
| - name: Upload index 12 | ||
| if: ${{ steps.slots.outputs.n12 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n12 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
| - name: Upload index 13 | ||
| if: ${{ steps.slots.outputs.n13 != '' }} | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: { name: "${{ steps.slots.outputs.n13 }}", path: "${{ inputs.path }}", retention-days: "${{ steps.slots.outputs.retention-days }}", if-no-files-found: error } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.