Repository navigation
ci: report an unsettled context as pending and give ci-ok one producer (#1273) - #1307
Conversation
The publisher reported `missing` for a job object the API answers with `status: in_progress` beside a `conclusion` (jobs 138082842033 and 138086900960 in run 45286143428), which sends a reader to look for a job that did run. The fixture expects `pending`, states that absent stays `missing`, pins two settled conclusions to the newest one with both recorded, and drives the real CLI against a fake API to prove an unsettled set creates no check run. The eleven call sites that resolve the in-run aggregate by its literal job id move to `ci-ok-head` in the same commit as the rename, each keeping its assertion, together with the four readers the Lead named (`gateBaseTree.test.ts`, both `mainHealth.test.ts` fixtures, and `gateCompare.test.ts`'s constant). Red on the unbroken tip: 5 of 21 in `test/ciOkPublish.test.ts`, including the CLI fixture, which posts a red check run for an unsettled context.
#1273) `resultOf` in `scripts/lib/ci-ok-run.mjs` returned `missing` for every job object that was not `completed`, so the contradiction the API allows — `status: in_progress` with a `conclusion` and a `completed_at` — was resolved to the one word that sends a reviewer looking for a job that did run. An unsettled object is now `pending`; a context with no object at all is still `missing`, and both are red. Two settled conclusions for one display name are read newest-first, and every object seen for a required context is recorded in the published summary with id, status, conclusion and `completed_at`, so "two conclusions" can be told from "no conclusions". While any required context is unsettled the publisher creates no check run at all: the word goes to its own log and the absent context stays red. The check lands after `loadJobs` and before `publish`, because the run-level skip only inspects the run object and a concluded run can still carry an `in_progress` job. The in-run aggregate is renamed to `ci-ok-head` in both the job id and its `name:`, with `main-health`'s `needs` list and key, the reserved-contexts table (now `ci-ok-publish.yml` alone) and the comparator's base id following it. The accepted set `['ci-ok-head', 'ci-ok']` is unchanged, so a branch still carrying the old id is checked under it and a head declaring both is refused. The scanner's blind spot for the refresh producer is written beside the rule in `docs/code-standards.md`.
HugoXK-bot
left a comment
There was a problem hiding this comment.
Verdict: PASS at 379293b
Written-by: HugoXK-bot
Posted-by: HugoXK-bot
Judged this tip only: 379293b85b5f070515070d7f3524850d1669201f. I did not judge 97f70b0b29eb2a574f0c35e127797469654aa97f; that is the red-first commit and it is red on purpose.
Identity: the commit object reports tree f29e143173958a8df6acccafb9e639e8e1dc5ef9, and a fresh materialization of that tree at the same sha re-hashes to f29e143173958a8df6acccafb9e639e8e1dc5ef9 with git write-tree. github.com:443 was unavailable for git fetch, so the tree came through the Git Data API at this sha, not through a branch ref; the recomputed tree hash is the identity that counts, and it matches.
Ran:
npm run checkat the tip — exit 0: lint11 warning(s) in 8 entries match the baseline;tsc --noEmitclean;3443tests,3442pass,1skip (this checkout is not on a branch, so there is no diff to judge),0fail; buildtsc -p tsconfig.build.jsonpass.node .work1307/probe.mjsagainst the tip'sscripts/lib/ci-ok-run.mjs— an unsettled object (status: in_progress,conclusion: success) readspending, stays red,pendingRequired = ["changelog"], problem textrequired job did not succeed: changelog (pending); a context with no object at all readsmissing(required job missing from needs: changelog,pendingRequired = []); two settled objects for one name read the newest (success).git write-treein the materialized tree —f29e143173958a8df6acccafb9e639e8e1dc5ef9, equal to the commit object's tree.
Not run: no GitHub API write from the suite (fixture 21 drives the real CLI against a local node:http server with a fixture token); no Docker image; no merge_group queued run; no deploy, live database or SMTP.
The two behaviours the card is about, read at the tip:
pendingvsmissing:scripts/lib/ci-ok-run.mjs:87addsPENDING = 'pending';resultOf(:95) returns it forstatus !== 'completed'and for a completed object with an empty conclusion, whilemissingis reserved for a null/non-object job and for a required context with no job object (needsFromJobsomits it). Both stay red.- No check run while unsettled:
scripts/ci-ok-run.mjs:301returns afterpendingRequired(result.needs)is non-empty, beforecheckRunPayload/publish; the CLI fixturean unsettled required job makes the publisher create no check run at allasserts zero POST requests against a local fake API. The four new fixtures are green in the run above (TAP 396, 397, 399, 411). - One producer:
.github/workflows/ci.yml:853-854is nowci-ok-head/name: ci-ok-head;AGGREGATE_JOBatscripts/lib/gate-compare.mjs:68is'ci-ok-head';AGGREGATE_JOBSatscripts/lib/gate-compare.mjs:76is still exactly['ci-ok-head', 'ci-ok']. The value is untouched; the line is:76at this tip rather than the card's:74only because theAGGREGATE_JOBdoc comment gained two lines — at base15cc6dbthe same two lines are:66and:74. Consumers renamed:test/gateBaseTree.test.ts:42,test/mainHealth.test.ts:155/:247/:281/:342,test/gateCompare.test.ts:160(asserts the exact transition set),test/reservedContexts.test.ts:110-121,test/ciOkPublish.test.ts:92;main-health'sneedsfollows (scripts/lib/main-health.mjs:43,:56,.github/workflows/ci.yml), andscripts/lib/reserved-contexts.mjs:46is'ci-ok': ['ci-ok-publish.yml']. The refresh producer's API-posted red is documented indocs/code-standards.mdand is not a job-level producer.
Checks at this sha (checked API, newest run per name by completed_at):
test (24)138485760969success, completed13:41:52Z;coverage138485761125success;ci-ok138488601653success,13:44:15Z;ci-ok-head138488360907success,13:44:00Z;risk138485760877success (the PR body reportsrisk-tier: T3; basis: .github/workflows/ci-ok-publish.yml, consistent with the T3 rule for.github/workflows/**).pr-lint: I read the success138486095752, completed13:40:17Z; the failure138485760461, completed13:39:43Z, is superseded at the same sha.review-gate138485758995is the only remaining failure, completed13:39:44Z: no PASS at this tip yet, which this review supplies. No other non-green run is a code failure.
No UI surface: this PR touches workflows, scripts, docs and tests only, so the before/after screenshot rule does not apply.
Findings: none blocking. One accuracy note for the record: the card's AGGREGATE_JOBS line number is a base-tree number (:74); at this tip the unchanged set sits at :76. Nothing in the work changes.
Conclusion: PASS at 379293b85b5f070515070d7f3524850d1669201f. The reader separates pending from missing, the publisher creates no check run while any required context is unsettled, the aggregate rename moves the job id, its name: and every in-tree consumer while AGGREGATE_JOBS keeps the two-id transition set, and npm run check is green at this tip.
Written-by: Fledge Platform Dev-1
Fixes #1273
What changed
The reader no longer calls an unsettled job
missing.resultOfinscripts/lib/ci-ok-run.mjsreturnedmissingfor every object that was notcompleted, so the shape the API allows —status: in_progressbeside aconclusionand acompleted_at(jobs 138082842033 and 138086900960) — sent a reviewer to look for a job that did run. An unsettled object is nowpending; a context with no job object at all is stillmissing; both are red. Two settled conclusions for one display name are read newest-first (ties and unorderable pairs keep the worse result), and the published summary now lists every object seen for a required context with id, status, conclusion andcompleted_at, so "two conclusions" can be told from "no conclusions" without re-querying the API.Shape 1: while any required context is unsettled,
scripts/ci-ok-run.mjscreates no check run at all. The wordpendinggoes to the publisher's own log and the absent context stays red throughmissing. The check lands afterloadJobsand beforepublish— the run-level skip above it inspects only the run object, so a concluded run carrying anin_progressjob walks past it.One producer for
ci-ok: the in-run aggregate is renamed toci-ok-headin both the job id (.github/workflows/ci.yml:853) and itsname:(:854).main-health'sneedslist and its key follow the rename (scripts/main-health.mjs:40,scripts/lib/main-health.mjs:53, which now names a constant), andscripts/lib/reserved-contexts.mjs:43is tightened to'ci-ok': ['ci-ok-publish.yml']with the now-falseci.ymlcomment rewritten.AGGREGATE_JOBSstays the two-id transition set — a head still declaringci-okis checked under it, and a head declaring both is refused — whileAGGREGATE_JOB(:66) follows the base tree toci-ok-head. The refresh producer's blind spot is written beside the rule indocs/code-standards.md; its red still blocks.The red half
Large-PR: the rename keeps
ci-okto one producer only if the job id, its four readers in the tree, and the eleven test call sites that resolve it move in the same commit; the reader'spendingfix is the same card and the same PR is the only place the two halves can be reviewed together. The body lists every site.At the base tree the new fixtures failed as follows (
test/ciOkPublish.test.ts):Fixture 21 drives the real CLI against a local fake API, so the 404 is the publisher attempting a check-run POST for a context that had not settled — the defect the card exists to remove, measured rather than described.
The branch that produced the word, quoted from the unbroken tip:
Every touched site
The rename's consumers, each keeping its assertion:
test/ciNodeMatrix.test.ts:108—job(text, 'ci-ok-head')still has to nametestandcoverage.test/ciChanges.test.ts:216—jobBlock(workflow, 'ci-ok-head')still accepts a skippeddeploy-checkonly through the flag.test/visualJobCeiling.test.ts:62— theneeds: [ci-ok-head, …]regex still has to containvisual.test/mainHealth.test.ts:155(failingJobsFromfixture),:247(doesNotMatchon the now-renamed block),:281(needsOf('ci-ok-head')) and:342(GREEN_RUN.NEEDSkey) — the reporter still ignores the aggregate and still mirrors its whole needs list.test/ciOkPublish.test.ts:92— rewritten, not deleted: it now asserts the in-run aggregate publishesname: ci-ok-head, which is the single-producer property.test/ciOk.test.ts:238and:268— the needs/required-list drift check and themock-checkcase resolveci-ok-head.test/codeqlRequired.test.ts:230and:239— the block lookup and the slice boundary both move, so the slice cannot silently widen.test/reservedContexts.test.ts:66-72(the table now names the publisher alone),:110-121(the canonical-file sample) and:229(ci-ok-head).test/gateBaseTree.test.ts:42— the evaluators table namesci-ok-head; the "runs from the base tree" assertions are unchanged.test/gateCompare.test.ts:151,:160,:180,:294-300,:330,:341-362—AGGREGATE_JOBisci-ok-head, the old-id transition head is checked underci-ok, a head declaring both is refused, and the three aggregate checks follow whichever id the head declares.Code and docs:
.github/workflows/ci.yml,.github/workflows/ci-ok-publish.yml(header comment),scripts/ci-ok-run.mjs,scripts/lib/ci-ok-run.mjs+.d.mts,scripts/lib/gate-compare.mjs,scripts/lib/main-health.mjs,scripts/lib/reserved-contexts.mjs,scripts/main-health.mjs,docs/code-standards.md,docs/autonomous-dev.md,changelog.d/1273.fixed.md.Ran:
npm run checkat379293b85b5f070515070d7f3524850d1669201f— lint baseline11 warning(s) in 8 entries match the baseline,tsc --noEmitclean,3443/3443tests pass, build passes.node scripts/risk-gate.mjs --base 15cc6db17eda9bca1bc057a5f1fc3416aeb8f0dd—risk-tier: T3; basis: .github/workflows/ci-ok-publish.yml.npx tsx --test test/ciOkPublish.test.tson the unbroken base tree — 5 of 21 red, quoted above.GITHUB_REPOSITORY=HugoXK/fledge node scripts/issue-hash.mjs --issue 1273—raw cbf2225aa0da, the hash verdict7132279571names.Not run:
node:httpserver only, and the token in it is a fixture string.merge_queuepath: the transition cases are exercised throughcompareGatefixtures, not a queued run.Risks and rollback
The risk is the rename itself: a consumer of the old job id outside the ten files above would stop checking rather than fail loudly, which is why every literal read found by grep is in this commit and
npm run checkis the backstop.ci-ok-headis not a branch-protection context andci-okstill is, so branch protection does not move. Rollback is a revert of the two commits: the old id returns with its accepted-set membership, and no state outside the repository is touched.Docs and changelog
docs/code-standards.mdgains one paragraph beside the required-context rules: settled-wins,pending≠missing, absent staysmissing, every conclusion recorded, and the scanner's blind spot for the API-posted refresh red.docs/autonomous-dev.mdfollows the rename.changelog.d/1273.fixed.mdis the one fragment; it is user-visible in the merge-gate sense, not the UI sense.