From d82edfc4d2258b41190821b182fae62a9480896b Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Thu, 13 Aug 2026 01:56:00 +0800 Subject: [PATCH] fix(ci): preserve periphery artifacts across reruns (#122743) --- .../shared-openclawkit-periphery.yml | 15 +++++--- test/scripts/periphery-intersection.test.ts | 37 +++++++++++++++++-- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/.github/workflows/shared-openclawkit-periphery.yml b/.github/workflows/shared-openclawkit-periphery.yml index 2be5d6772788..e3fc412addce 100644 --- a/.github/workflows/shared-openclawkit-periphery.yml +++ b/.github/workflows/shared-openclawkit-periphery.yml @@ -152,14 +152,17 @@ jobs: cp "$output_dir/periphery.stdout.json" "$output_dir/periphery.json" fi + # Failed-job reruns retain successful producer artifacts from the original attempt. + # Keep artifact slots run-scoped; rerun producers overwrite their slot. - name: Upload iOS consumer report if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: - name: shared-periphery-ios-${{ github.run_id }}-${{ github.run_attempt }} + name: shared-periphery-ios-${{ github.run_id }} path: ${{ runner.temp }}/shared-periphery-ios if-no-files-found: error retention-days: 14 + overwrite: true scan-macos: name: Scan shared kit from macOS @@ -225,10 +228,11 @@ jobs: if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: - name: shared-periphery-macos-${{ github.run_id }}-${{ github.run_attempt }} + name: shared-periphery-macos-${{ github.run_id }} path: ${{ runner.temp }}/shared-periphery-macos if-no-files-found: error retention-days: 14 + overwrite: true intersect: name: Intersect shared OpenClawKit dead code @@ -247,13 +251,13 @@ jobs: - name: Download iOS consumer report uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: shared-periphery-ios-${{ github.run_id }}-${{ github.run_attempt }} + name: shared-periphery-ios-${{ github.run_id }} path: ${{ runner.temp }}/shared-periphery-ios - name: Download macOS consumer report uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: shared-periphery-macos-${{ github.run_id }}-${{ github.run_attempt }} + name: shared-periphery-macos-${{ github.run_id }} path: ${{ runner.temp }}/shared-periphery-macos - name: Intersect exact Swift identities @@ -269,7 +273,8 @@ jobs: if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: - name: shared-periphery-intersection-${{ github.run_id }}-${{ github.run_attempt }} + name: shared-periphery-intersection-${{ github.run_id }} path: ${{ runner.temp }}/shared-periphery-intersection if-no-files-found: warn retention-days: 14 + overwrite: true diff --git a/test/scripts/periphery-intersection.test.ts b/test/scripts/periphery-intersection.test.ts index ad8d9f7db8dc..8b31568f73c3 100644 --- a/test/scripts/periphery-intersection.test.ts +++ b/test/scripts/periphery-intersection.test.ts @@ -19,7 +19,7 @@ type WorkflowStep = { id?: string; name?: string; run?: string; - with?: { name?: string; path?: string; script?: string }; + with?: { name?: string; overwrite?: boolean; path?: string; script?: string }; }; type Workflow = { @@ -148,8 +148,39 @@ describe("shared OpenClawKit Periphery workflow", () => { const macosUpload = workflow.jobs?.["scan-macos"]?.steps?.find( (step) => step.name === "Upload macOS consumer report", ); - expect(iosUpload?.with?.name).toContain("shared-periphery-ios-"); - expect(macosUpload?.with?.name).toContain("shared-periphery-macos-"); + const iosDownload = workflow.jobs?.intersect?.steps?.find( + (step) => step.name === "Download iOS consumer report", + ); + const macosDownload = workflow.jobs?.intersect?.steps?.find( + (step) => step.name === "Download macOS consumer report", + ); + const intersectionUpload = workflow.jobs?.intersect?.steps?.find( + (step) => step.name === "Upload shared intersection", + ); + + expect(iosUpload?.with?.name).toBe("shared-periphery-ios-${{ github.run_id }}"); + expect(iosDownload?.with?.name).toBe(iosUpload?.with?.name); + expect(macosUpload?.with?.name).toBe("shared-periphery-macos-${{ github.run_id }}"); + expect(macosDownload?.with?.name).toBe(macosUpload?.with?.name); + expect(intersectionUpload?.with?.name).toBe( + "shared-periphery-intersection-${{ github.run_id }}", + ); + + const artifactNames = [ + iosUpload?.with?.name, + iosDownload?.with?.name, + macosUpload?.with?.name, + macosDownload?.with?.name, + intersectionUpload?.with?.name, + ]; + expect(artifactNames).not.toContain(undefined); + for (const artifactName of artifactNames) { + expect(artifactName).not.toContain("github.run_attempt"); + } + + expect(iosUpload?.with?.overwrite).toBe(true); + expect(macosUpload?.with?.overwrite).toBe(true); + expect(intersectionUpload?.with?.overwrite).toBe(true); }); it("retains the generated protocol contract and leaves findings for the intersection", () => {