World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[MINOR] improvement(ci): Explain pending trusted verification and recovery (#15089)
Qi Yu783025be1169
diff --git a/.github/scripts/publish-ci-status.cjs b/.github/scripts/publish-ci-status.cjsindex 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.cjsindex 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 definiticonst { 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 thawait 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.cjsindex 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);});