From cf9cfe47df0f06b043f2ed9e22d86d4d0af212be Mon Sep 17 00:00:00 2001 From: brokemac79 Date: Sat, 25 Jul 2026 07:48:22 +0100 Subject: [PATCH] fix(exact-review): accept superseded publication handoffs --- .github/workflows/sweep.yml | 22 ++++++++++++---------- test/sweep-workflow.test.ts | 15 ++++----------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/sweep.yml b/.github/workflows/sweep.yml index 7aaada7b8b..00927e4175 100644 --- a/.github/workflows/sweep.yml +++ b/.github/workflows/sweep.yml @@ -1156,18 +1156,20 @@ jobs: )" signature="$(PAYLOAD="$payload" node -e 'const crypto=require("node:crypto"); process.stdout.write(`sha256=${crypto.createHmac("sha256", process.env.CLAWSWEEPER_WEBHOOK_SECRET).update(process.env.PAYLOAD).digest("hex")}`)')" for attempt in 1 2 3; do - if response="$(curl --fail --silent --show-error --connect-timeout 5 --max-time 20 \ - --request POST \ - --header "content-type: application/json" \ - --header "x-clawsweeper-exact-review-signature: $signature" \ - --data "$payload" \ - "$queue_url/internal/exact-review/enqueue")" && - jq -e '.ok == true and (.queued == true or (.deduped == true and .superseded != true))' <<< "$response" >/dev/null; then + response="$( + curl --fail --silent --show-error --connect-timeout 5 --max-time 20 \ + --request POST \ + --header "content-type: application/json" \ + --header "x-clawsweeper-exact-review-signature: $signature" \ + --data "$payload" \ + "$queue_url/internal/exact-review/enqueue" || true + )" + if jq -e '.superseded == true' <<< "$response" >/dev/null 2>&1; then + echo "::notice::Exact-review publication revision $(jq -r '.publication_revision // "unknown"' <<< "$response") was superseded by revision $(jq -r '.superseded_by_revision // "unknown"' <<< "$response"); the newer publisher owns final delivery." exit 0 fi - if jq -e '.superseded == true' <<< "${response:-}" >/dev/null 2>&1; then - echo "::error::Exact-review publication revision $(jq -r '.publication_revision // "unknown"' <<< "$response") was rejected as superseded by revision $(jq -r '.superseded_by_revision // "unknown"' <<< "$response"); the verdict was not delivered." - exit 1 + if jq -e '.ok == true and (.queued == true or .deduped == true)' <<< "$response" >/dev/null; then + exit 0 fi if [ "$attempt" -lt 3 ]; then sleep "$((attempt * 5))" diff --git a/test/sweep-workflow.test.ts b/test/sweep-workflow.test.ts index b1634216e8..da9080d777 100644 --- a/test/sweep-workflow.test.ts +++ b/test/sweep-workflow.test.ts @@ -450,10 +450,7 @@ test("exact event review hands immutable artifacts to the queue-bounded publishe assert.equal(upload.uses, "actions/upload-artifact@v7"); assert.equal(upload.with?.["retention-days"], 90); assert.match(queuePublication.run ?? "", /for attempt in 1 2 3/); - assert.match( - queuePublication.run ?? "", - /\.queued == true or \(\.deduped == true and \.superseded != true\)/, - ); + assert.match(queuePublication.run ?? "", /\.queued == true or \.deduped == true/); assert.match(complete.env?.PRIMARY_OUTCOME ?? "", /exact-review-generation-result/); assert.match(deferHeldReview.if ?? "", /reserve-exact-review-lease\.outputs\.status == 'held'/); assert.match(deferHeldReview.run ?? "", /retry deferred/); @@ -2770,7 +2767,7 @@ test("github activity workflow scopes cancellation to matching item activity", ( assert.doesNotMatch(concurrencyBlock, /workflow-run' \|\| 'activity'/); }); -test("exact review publication enqueue rejects a superseded acknowledgement", () => { +test("exact review publication enqueue accepts a superseded acknowledgement", () => { type WorkflowStep = { name?: string; id?: string; run?: string }; type WorkflowJob = { steps: WorkflowStep[] }; const workflow = YAML.parse(readText(".github/workflows/sweep.yml")) as { @@ -2781,11 +2778,7 @@ test("exact review publication enqueue rejects a superseded acknowledgement", () ); assert.ok(publicationEnqueue, "missing queue-exact-review-publication step"); const run = publicationEnqueue.run ?? ""; - assert.match( - run, - /\.ok == true and \(\.queued == true or \(\.deduped == true and \.superseded != true\)\)/, - ); - assert.doesNotMatch(run, /\.ok == true and \(\.queued == true or \.deduped == true\)/); + assert.match(run, /\.ok == true and \(\.queued == true or \.deduped == true\)/); assert.match(run, /jq -e '\.superseded == true'/); - assert.match(run, /the verdict was not delivered/); + assert.match(run, /the newer publisher owns final delivery/); });