Abhishek-Mohan commented on code in PR #7705:
URL: https://github.com/apache/datafusion-comet/pull/7705#discussion_r4660751896


##########
dev/ci/check-ci-config.py:
##########
@@ -521,6 +521,28 @@ def fork_pr(action="synchronize", label=None, labels=(), 
base="main", repository
     ({"name": "push", "repository": UPSTREAM}, {"docs", "build_linux", 
"build_macos"}),
 ]
 
+# compute() cases: (event, changed files, the outputs that must be true). These
+# cover what POLICY_CASES cannot, a push whose file list is empty.
+FORK_MAIN_PUSH = {"name": "push", "repository": FORK, "ref": "refs/heads/main"}
+FORK_BRANCH_PUSH = {"name": "push", "repository": FORK, "ref": 
"refs/heads/feature"}
+UPSTREAM_MAIN_PUSH = {"name": "push", "repository": UPSTREAM, "ref": 
"refs/heads/main"}
+NATIVE_SOURCE = ["native/core/src/lib.rs"]
+COMPUTE_CASES = [
+    # A sync of a fork's main adds nothing to upstream, and runs the Linux 
build
+    # in cache-refresh-only mode (`build_linux` without `build_linux_full`) so
+    # the fork's branches can restore its Maven and cargo caches.
+    (FORK_MAIN_PUSH, [], {"build_linux"}),
+    # A fork's main that does add something runs the PR tier, as a branch does.
+    (FORK_MAIN_PUSH, NATIVE_SOURCE, PR_TIER),
+    (FORK_BRANCH_PUSH, NATIVE_SOURCE, PR_TIER),
+    (FORK_BRANCH_PUSH, [], set()),
+    (UPSTREAM_MAIN_PUSH, NATIVE_SOURCE, {"build_linux", "build_macos"}),
+    (UPSTREAM_MAIN_PUSH, [], set()),
+    # Only a push refreshes, and only to main itself.
+    ({"name": "schedule", "repository": FORK, "ref": "refs/heads/main"}, [], 
set()),
+    ({"name": "push", "repository": FORK, "ref": "refs/heads/fix/main"}, [], 
set()),

Review Comment:
   Optional: a case for a fork push with no `ref`, e.g. `({"name": "push", 
"repository": FORK}, [], set())`. `event_from_env` defaults `REF` to `""`, and 
this case would pin that a missing or dropped `REF` can never turn into a 
refresh. `check_event_env` already checks that ci.yml sets it, so this only 
guards the `compute()` side.



##########
.github/workflows/pr_build_linux.yml:
##########
@@ -59,7 +60,7 @@ on:
       cache-refresh-only:
         description: >-
           Populate main's actions/cache entries without running any lint or
-          test. Set by ci.yml on push to main.
+          test. Set by ci.yml on push to main and on a sync of a fork's main.

Review Comment:
   The line above still says the mode runs "without running any lint or test", 
but the Lint job runs in cache-refresh-only mode too (the comment on the `lint` 
job says so, and `build-native` has `needs: lint`). Since this description is 
being edited anyway, maybe "without running the test suites".



##########
docs/source/contributor-guide/ci.md:
##########
@@ -141,10 +141,15 @@ Some things to know:
   controls the workflow that produced it. A green fork run is a good sign, not 
a merge gate. The
   queue is the gate, and it tests your change merged with `main` and 
everything queued ahead of it,
   where the fork run tests your branch head alone.
-- **Caches are cold unless `main` builds.** A branch restores caches saved on 
its own ref or on your
-  fork's default branch, and a run on your fork's `main` saves them only when 
it builds. A push to
-  `main` that adds nothing to upstream, such as syncing your fork, selects no 
suite, so it warms
-  nothing, and a branch run rebuilds the native library. A run of the PR tier 
on a fork with cold
+- **Sync your fork's `main` to warm its caches.** A branch restores caches 
saved on its own ref or
+  on your fork's default branch, and only a run on your fork's `main` saves 
the Maven and cargo
+  caches. A push to `main` that adds nothing to upstream, such as syncing your 
fork, runs the Linux

Review Comment:
   Two cases a contributor following this bullet may hit:
   - **Already up to date:** if the fork's `main` already matches upstream when 
this merges, "Sync fork" has nothing to push, so nothing refreshes until 
upstream gets its next commit and they sync again. A sentence saying the first 
refresh comes with the next sync that actually moves `main` would save some 
confusion.
   - **Default branch:** like the README, this assumes the fork's default 
branch is `main`. Branches restore only from the default branch, so a fork with 
another default doesn't benefit.



##########
dev/ci/compute-changes.py:
##########
@@ -674,6 +675,12 @@ def release_branch_allows(job, event):
 
 def compute(files, event):
     """Return {job: bool}, folding the path filter and the event policy."""
+    # A sync of a fork's main adds nothing to upstream, so it has nothing to

Review Comment:
   `fork-push-changed-files.sh` uses a three-dot `git diff --name-only 
"$ref"..."$head"`, so the file list is empty for any push that leaves `main` 
with nothing beyond upstream, not only a sync. That includes a `main` that is 
only behind upstream, a reset to an older upstream commit, and the first push 
of a new fork. All of those refresh too, and a reset saves entries keyed on the 
older `pom.xml` / `Cargo.lock` hashes. That's harmless and arguably what we 
want, but the comment could say "a push to a fork's main that adds nothing to 
upstream, such as a sync" so it doesn't read as sync-only.



-- 
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