This is an automated email from the ASF dual-hosted git repository.

yuqi1129 pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new c362f33783 [Cherry-pick to branch-2.0] [MINOR] improvement(ci): 
Explain pending trusted verification and recovery (#15089) (#15094)
c362f33783 is described below

commit c362f3378364462b7fae2627828ef225cfa149cd
Author: Qi Yu <[email protected]>
AuthorDate: Thu Nov 19 09:59:02 2026 +0800

    [Cherry-pick to branch-2.0] [MINOR] improvement(ci): Explain pending 
trusted verification and recovery (#15089) (#15094)
    
    **Cherry-pick Information:**
    - Original commit: 783025be1169f61a1aeceeb624aaa5142687478d
    - Target branch: `branch-2.0`
    - Status: ✅ Clean cherry-pick (no conflicts)
    - Fork CI: runs in `yuqi1129/gravitino`; re-run it there or push to this
    PR branch
---
 .github/scripts/publish-ci-status.cjs  |  8 ++++---
 .github/scripts/tests/fork-ci.test.cjs | 39 +++++++++++++++++++++++++++++++---
 .github/scripts/update-fork-ci.cjs     |  5 +++--
 3 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/.github/scripts/publish-ci-status.cjs 
b/.github/scripts/publish-ci-status.cjs
index c8538f768b..3939b95389 100644
--- a/.github/scripts/publish-ci-status.cjs
+++ b/.github/scripts/publish-ci-status.cjs
@@ -61,7 +61,9 @@ async function publishStatus({ github, repo, sha, context, 
state, description, t
 
 // Waiting for a committer is not a failure of the contributor's change.
 const NEEDS_ATTENTION = 'Fork CI needs attention';
-const TRUSTED_REQUIRED = 'Fork CI passed; trusted verification required';
+const LEGACY_TRUSTED_REQUIRED = 'Fork CI passed; trusted verification 
required';
+const TRUSTED_REQUIRED = 'Fork CI passed; CI files differ from target branch. 
' +
+  'Committer: run Fork CI in apache/gravitino on that branch with this PR 
number.';
 
 function statusState(result) {
   if (result.status !== 'completed') return 'pending';
@@ -72,7 +74,7 @@ function statusState(result) {
 
 // Whether a published status reports a finished execution, including pending 
trusted verification.
 function statusCompleted(status) {
-  return status.state !== 'pending' || status.description === TRUSTED_REQUIRED;
+  return status.state !== 'pending' || [TRUSTED_REQUIRED, 
LEGACY_TRUSTED_REQUIRED].includes(status.description);
 }
 
-module.exports = { NEEDS_ATTENTION, TRUSTED_REQUIRED, latestStatus, 
parseRunUrl, publishStatus, runUrl, statusCompleted, statusState };
+module.exports = { NEEDS_ATTENTION, TRUSTED_REQUIRED, LEGACY_TRUSTED_REQUIRED, 
latestStatus, parseRunUrl, publishStatus, runUrl, statusCompleted, statusState 
};
diff --git a/.github/scripts/tests/fork-ci.test.cjs 
b/.github/scripts/tests/fork-ci.test.cjs
index 267c614c7c..bf024a17e4 100644
--- a/.github/scripts/tests/fork-ci.test.cjs
+++ b/.github/scripts/tests/fork-ci.test.cjs
@@ -511,7 +511,7 @@ test('scheduled publication ignores poisoned cache state 
and recomputes definiti
   const { github, statuses } = publisherMock();
   github.rest.git = serviceMock({ changed: true }).rest.git;
   await update({ github, context: ctx, core, stateFile, sleep: async () => {} 
});
-  assert.equal(statuses[0].description, 'Fork CI passed; trusted verification 
required');
+  assert.equal(statuses[0].description, TRUSTED_REQUIRED);
   const workflow = await readFile(path.join(__dirname, 
'../../workflows/fork-ci-status-update.yml'), 'utf8');
   assert.ok(!workflow.includes('actions/cache/'));
 }));
@@ -1289,7 +1289,7 @@ test('changed CI definitions stay pending, not red, until 
trusted CI verifies th
   await update({ github, context: ctx, core, sleep: async () => {} });
   // Waiting for a committer is not a failure of the contributor's change.
   assert.equal(statuses[0].state, 'pending');
-  assert.equal(statuses[0].description, 'Fork CI passed; trusted verification 
required');
+  assert.equal(statuses[0].description, TRUSTED_REQUIRED);
 }));
 
 test('CI edits mirror execution progress and failures without self-approving 
success', async () => withPublisher(async ({ ctx, core }) => {
@@ -1298,7 +1298,7 @@ test('CI edits mirror execution progress and failures 
without self-approving suc
     ['in_progress', null, 'pending', 'Fork CI is running'],
     ['completed', 'failure', 'failure', 'Failed: backend / test; re-run it in 
your fork'],
     ['completed', 'cancelled', 'error', 'Fork CI cancelled; re-run it in your 
fork'],
-    ['completed', 'success', 'pending', 'Fork CI passed; trusted verification 
required']]) {
+    ['completed', 'success', 'pending', TRUSTED_REQUIRED]]) {
     const { github, statuses } = publisherMock({ rerun: { ...run(), status, 
conclusion } });
     github.rest.git = serviceMock({ changed: true }).rest.git;
     await update({ github, context: ctx, core, sleep: async () => {} });
@@ -2316,3 +2316,36 @@ test('trusted rerun failures stay retryable until the 
current summary identifies
     }
   }
 });
+
+
+test('trusted verification hint explains the cause and recovery without 
truncation', async () => withPublisher(async ({ ctx, core }) => {
+  const { github, statuses } = publisherMock();
+  github.rest.git = serviceMock({ changed: true }).rest.git;
+  await update({ github, context: ctx, core });
+  assert.equal(statuses[0].state, 'pending');
+  assert.equal(statuses[0].description, 'Fork CI passed; CI files differ from 
target branch. ' +
+    'Committer: run Fork CI in apache/gravitino on that branch with this PR 
number.');
+  assert.ok(statuses[0].description.length <= 140);
+}));
+
+test('scheduled probes upgrade the old trust hint without repeatedly rewriting 
the new hint', async () => withPublisher(async ({ ctx, core }) => {
+  ctx.eventName = 'schedule'; delete ctx.payload.inputs;
+  const recent = { ...pr(), updated_at: new Date().toISOString() };
+  for (const description of ['Fork CI passed; trusted verification required', 
TRUSTED_REQUIRED]) {
+    const { github, statuses } = publisherMock({ latest: forkStatus('pending', 
description) });
+    github.rest.git = serviceMock({ changed: true }).rest.git;
+    const listPulls = github.rest.pulls.list, paginate = github.paginate;
+    github.paginate = async (endpoint, args) => endpoint === listPulls ? 
[recent] : paginate(endpoint, args);
+    github.rest.pulls.get = async () => ({ data: recent });
+    let inspected = false;
+    const getTree = github.rest.git.getTree;
+    github.rest.git.getTree = async args => { inspected = true; return 
getTree(args); };
+    await update({ github, context: ctx, core, sleep: async () => {} });
+    assert.equal(inspected, description !== TRUSTED_REQUIRED);
+    assert.equal(statuses.length, description === TRUSTED_REQUIRED ? 0 : 1);
+    if (statuses.length) {
+      assert.equal(statuses[0].state, 'pending');
+      assert.equal(statuses[0].description, TRUSTED_REQUIRED);
+    }
+  }
+}));
diff --git a/.github/scripts/update-fork-ci.cjs 
b/.github/scripts/update-fork-ci.cjs
index 489f03e7a3..dcda789fa1 100644
--- a/.github/scripts/update-fork-ci.cjs
+++ b/.github/scripts/update-fork-ci.cjs
@@ -14,7 +14,7 @@
  */
 'use strict';
 const { createService } = require('./fork-ci-status.cjs');
-const { NEEDS_ATTENTION, latestStatus, parseRunUrl, publishStatus, runUrl, 
statusCompleted, statusState } = require('./publish-ci-status.cjs');
+const { NEEDS_ATTENTION, LEGACY_TRUSTED_REQUIRED, latestStatus, parseRunUrl, 
publishStatus, runUrl, statusCompleted, statusState } = 
require('./publish-ci-status.cjs');
 const { retireCancelled } = require('./retire-fork-ci.cjs');
 
 const RECENT_MS = 6 * 60 * 60 * 1000;
@@ -197,7 +197,8 @@ async function update({ github, context, core, sleep = ms 
=> new Promise(resolve
           // Legacy links have no context proof and are refreshed once. The 
rewritten
           // link restores cheap probing, including after a missed retarget 
signal.
           const sameBase = shown?.base_sha === pr.base.sha && shown?.base_ref 
=== pr.base.ref;
-          if (settled && (!shown || sameBase)) return;
+          // Refresh the old trust hint once so existing pending PRs receive 
actionable instructions.
+          if (settled && (!shown || sameBase) && latest.description !== 
LEGACY_TRUSTED_REQUIRED) return;
         }
         await refresh(pr);
       });

Reply via email to