Skip to content

ci: report an unsettled context as pending and give ci-ok one producer (#1273) - #1307

Merged
HugoXK merged 2 commits into
mainfrom
dev1/1273-ci-ok-head
Nov 24, 2026
Merged

HugoXK merged 2 commits into
mainfrom
dev1/1273-ci-ok-head

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Written-by: Fledge Platform Dev-1

Fixes #1273

What changed

The reader no longer calls an unsettled job missing. resultOf in scripts/lib/ci-ok-run.mjs returned missing for every object that was not completed, so the shape the API allows — status: in_progress beside a conclusion and a completed_at (jobs 138082842033 and 138086900960) — sent a reviewer to look for a job that did run. An unsettled object is now pending; a context with no job object at all is still missing; 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 and completed_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.mjs creates no check run at all. The word pending goes to the publisher's own log and the absent context stays red through missing. The check lands after loadJobs and before publish — the run-level skip above it inspects only the run object, so a concluded run carrying an in_progress job walks past it.

One producer for ci-ok: the in-run aggregate is renamed to ci-ok-head in both the job id (.github/workflows/ci.yml:853) and its name: (:854). main-health's needs list and its key follow the rename (scripts/main-health.mjs:40, scripts/lib/main-health.mjs:53, which now names a constant), and scripts/lib/reserved-contexts.mjs:43 is tightened to 'ci-ok': ['ci-ok-publish.yml'] with the now-false ci.yml comment rewritten. AGGREGATE_JOBS stays the two-id transition set — a head still declaring ci-ok is checked under it, and a head declaring both is refused — while AGGREGATE_JOB (:66) follows the base tree to ci-ok-head. The refresh producer's blind spot is written beside the rule in docs/code-standards.md; its red still blocks.

The red half

Large-PR: the rename keeps ci-ok to 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's pending fix 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):

not ok 7 - an unfinished job object is pending, never missing and never a pass
  expected: 'pending'
  actual: 'missing'
not ok 9 - two settled conclusions for one context: the newest wins and both are listed
  expected: 'success'
  actual: 'failure'
not ok 21 - an unsettled required job makes the publisher create no check run at all
    Error: GitHub 404 /repos/o/r/check-runs: {"message":"unexpected route"}
  expected: 0
  actual: 1

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:

function resultOf(job) {
  if (job === null || typeof job !== 'object') return 'missing'
  if (job.status !== 'completed') return 'missing'
  return typeof job.conclusion === 'string' && job.conclusion !== '' ? job.conclusion : 'missing'
}

Every touched site

The rename's consumers, each keeping its assertion:

  • test/ciNodeMatrix.test.ts:108 — job(text, 'ci-ok-head') still has to name test and coverage.
  • test/ciChanges.test.ts:216 — jobBlock(workflow, 'ci-ok-head') still accepts a skipped deploy-check only through the flag.
  • test/visualJobCeiling.test.ts:62 — the needs: [ci-ok-head, …] regex still has to contain visual.
  • test/mainHealth.test.ts:155 (failingJobsFrom fixture), :247 (doesNotMatch on the now-renamed block), :281 (needsOf('ci-ok-head')) and :342 (GREEN_RUN.NEEDS key) — 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 publishes name: ci-ok-head, which is the single-producer property.
  • test/ciOk.test.ts:238 and :268 — the needs/required-list drift check and the mock-check case resolve ci-ok-head.
  • test/codeqlRequired.test.ts:230 and :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 names ci-ok-head; the "runs from the base tree" assertions are unchanged.
  • test/gateCompare.test.ts:151, :160, :180, :294-300, :330, :341-362 — AGGREGATE_JOB is ci-ok-head, the old-id transition head is checked under ci-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 check at 379293b85b5f070515070d7f3524850d1669201f — lint baseline 11 warning(s) in 8 entries match the baseline, tsc --noEmit clean, 3443/3443 tests 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.ts on 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 verdict 7132279571 names.

Not run:

  • No live GitHub API write from the suite: fixture 21 talks to a local node:http server only, and the token in it is a fixture string.
  • No production deploy, no live database, no real SMTP.
  • No merge_queue path: the transition cases are exercised through compareGate fixtures, 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 check is the backstop. ci-ok-head is not a branch-protection context and ci-ok still 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.md gains one paragraph beside the required-context rules: settled-wins, pending ≠ missing, absent stays missing, every conclusion recorded, and the scanner's blind spot for the API-posted refresh red. docs/autonomous-dev.md follows the rename. changelog.d/1273.fixed.md is the one fragment; it is user-visible in the merge-gate sense, not the UI sense.

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 HugoXK-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 check at the tip — exit 0: lint 11 warning(s) in 8 entries match the baseline; tsc --noEmit clean; 3443 tests, 3442 pass, 1 skip (this checkout is not on a branch, so there is no diff to judge), 0 fail; build tsc -p tsconfig.build.json pass.
  • node .work1307/probe.mjs against the tip's scripts/lib/ci-ok-run.mjs — an unsettled object (status: in_progress, conclusion: success) reads pending, stays red, pendingRequired = ["changelog"], problem text required job did not succeed: changelog (pending); a context with no object at all reads missing (required job missing from needs: changelog, pendingRequired = []); two settled objects for one name read the newest (success).
  • git write-tree in 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:

  • pending vs missing: scripts/lib/ci-ok-run.mjs:87 adds PENDING = 'pending'; resultOf (:95) returns it for status !== 'completed' and for a completed object with an empty conclusion, while missing is reserved for a null/non-object job and for a required context with no job object (needsFromJobs omits it). Both stay red.
  • No check run while unsettled: scripts/ci-ok-run.mjs:301 returns after pendingRequired(result.needs) is non-empty, before checkRunPayload/publish; the CLI fixture an unsettled required job makes the publisher create no check run at all asserts 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-854 is now ci-ok-head / name: ci-ok-head; AGGREGATE_JOB at scripts/lib/gate-compare.mjs:68 is 'ci-ok-head'; AGGREGATE_JOBS at scripts/lib/gate-compare.mjs:76 is still exactly ['ci-ok-head', 'ci-ok']. The value is untouched; the line is :76 at this tip rather than the card's :74 only because the AGGREGATE_JOB doc comment gained two lines — at base 15cc6db the same two lines are :66 and :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's needs follows (scripts/lib/main-health.mjs:43, :56, .github/workflows/ci.yml), and scripts/lib/reserved-contexts.mjs:46 is 'ci-ok': ['ci-ok-publish.yml']. The refresh producer's API-posted red is documented in docs/code-standards.md and is not a job-level producer.

Checks at this sha (checked API, newest run per name by completed_at):

  • test (24) 138485760969 success, completed 13:41:52Z; coverage 138485761125 success; ci-ok 138488601653 success, 13:44:15Z; ci-ok-head 138488360907 success, 13:44:00Z; risk 138485760877 success (the PR body reports risk-tier: T3; basis: .github/workflows/ci-ok-publish.yml, consistent with the T3 rule for .github/workflows/**).
  • pr-lint: I read the success 138486095752, completed 13:40:17Z; the failure 138485760461, completed 13:39:43Z, is superseded at the same sha.
  • review-gate 138485758995 is the only remaining failure, completed 13: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.

@HugoXK-bot HugoXK-bot added the review:approved Issue reviewed and approved by the Fledge Platform Reviewer label Nov 24, 2026
@HugoXK
HugoXK merged commit 607760f into main Nov 24, 2026
37 of 39 checks passed
@HugoXK
HugoXK deleted the dev1/1273-ci-ok-head branch November 24, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved Issue reviewed and approved by the Fledge Platform Reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: a required context is reported missing while its own job object says success

2 participants