codeant-ai-for-open-source[bot] commented on code in PR #45750:
URL: https://github.com/apache/superset/pull/45750#discussion_r4383102947


##########
.github/workflows/docker.yml:
##########
@@ -300,13 +339,18 @@ jobs:
 
   docker-build:
     name: docker-build
-    needs: [setup_matrix, changes]
+    needs: [setup_matrix, changes, check-freshness]
     # Only master pushes publish images (see scripts/docker-build-plan.sh).
     # Without the Docker Hub credentials (e.g. on a fork or mirror) they can
     # publish nothing, so they are skipped there. Version-branch pushes and
     # pull_request builds only load the image to validate that it builds, so
-    # they run everywhere.
+    # they run everywhere. check-freshness.outputs.is-current is always
+    # 'true' for pull_request (it bypasses the check there โ€” a PR build has
+    # no branch tip to race against, and staleness is instead handled by
+    # this job's own cancel-in-progress: true below), so this only narrows
+    # push triggers superseded by a newer commit on the same branch.
     if: >-
+      needs.check-freshness.outputs.is-current == 'true' &&

Review Comment:
   **Suggestion:** A Docker-changing push followed by a docs-only push skips 
the first here, while the second has no detected Docker changes; release 
branches therefore never validate the Docker change.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes` ยท ๐Ÿท๏ธ `Incomplete 
implementation`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8a84f86d3136414b86c68b91e661ccd6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=8a84f86d3136414b86c68b91e661ccd6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** .github/workflows/docker.yml
   **Line:** 353:353
   **Comment:**
        *Incomplete Implementation: A Docker-changing push followed by a 
docs-only push skips the first here, while the second has no detected Docker 
changes; release branches therefore never validate the Docker change.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45750&comment_hash=29d856e8152386c7ccad56da3d92104aae10b2ff34d8958a16f303c074721069&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45750&comment_hash=29d856e8152386c7ccad56da3d92104aae10b2ff34d8958a16f303c074721069&reaction=dislike'>๐Ÿ‘Ž</a>



##########
.github/workflows/scripts/check-branch-freshness.sh:
##########
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Shared freshness gate for push-triggered workflows that serialize their
+# real work behind a static (per-branch) concurrency group with
+# cancel-in-progress: false โ€” e.g. the Docs Deployment workflow
+# (superset-docs-deploy.yml, both up front at check-freshness and again right
+# before the deploy step at recheck-freshness) and the Docker image build
+# workflow (docker.yml, check-freshness). Writes an output declaring whether
+# BUILD_SHA is still BRANCH's current tip, so a superseded run can skip
+# cleanly at the job level instead of entering the concurrency group, where a
+# burst of pushes would otherwise queue several runs behind each other and
+# have GitHub force-cancel all but the newest pending one โ€” the queue
+# pruning described at
+# https://docs.github.com/en/actions/using-jobs/using-concurrency, which
+# happens regardless of cancel-in-progress and is why a merely-superseded
+# run shows up as a failing "Cancelled" check instead of a clean "Skipped"
+# one.
+#
+# Required env vars:
+#   BUILD_SHA     - the commit SHA this run is building
+#   REPO          - "owner/repo" to query, e.g. github.repository
+#   OUTPUT_NAME   - the GITHUB_OUTPUT key to write, e.g. "is-current"
+#   GITHUB_OUTPUT - path to append outputs to (set by the Actions runner)
+# Optional env vars:
+#   BRANCH        - the branch whose tip BUILD_SHA is checked against;
+#                   defaults to "master"
+#   EVENT_NAME    - if "workflow_dispatch" or "pull_request", bypasses the
+#                   check and always reports current: a manual dispatch is a
+#                   deliberate, one-off action, and a pull_request build has
+#                   no branch tip to race against (PR staleness is instead
+#                   handled by that workflow's own cancel-in-progress: true)
+#   GH_TOKEN      - passed through to `gh`, needed to call the GitHub API
+
+set -euo pipefail
+
+branch="${BRANCH:-master}"
+
+if [ "${EVENT_NAME:-}" = "workflow_dispatch" ] || [ "${EVENT_NAME:-}" = 
"pull_request" ]; then
+  echo "${OUTPUT_NAME}=true" >>"$GITHUB_OUTPUT"
+  exit 0
+fi
+
+latest_sha="$(gh api "repos/${REPO}/commits/${branch}" --jq .sha)"

Review Comment:
   **Suggestion:** A transient API or network failure exits before writing the 
output, failing this required job and skipping Docker builds, including safe 
release-branch validation builds.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Rarely` ยท ๐Ÿท๏ธ `Possible bug`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=0c488fb26d6544ecbb38c5cb3062a0f6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=0c488fb26d6544ecbb38c5cb3062a0f6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** .github/workflows/scripts/check-branch-freshness.sh
   **Line:** 58:58
   **Comment:**
        *Possible Bug: A transient API or network failure exits before writing 
the output, failing this required job and skipping Docker builds, including 
safe release-branch validation builds.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45750&comment_hash=19358c440d87da6ed3d8883cbd42c23c6576d3434763d833fffc18ee043db5a6&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45750&comment_hash=19358c440d87da6ed3d8883cbd42c23c6576d3434763d833fffc18ee043db5a6&reaction=dislike'>๐Ÿ‘Ž</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to