Repository navigation
test: gate the refresh jobs' required-check dispatch list - #508
Conversation
meeting-recordings-refresh.yml and hive-docs-refresh.yml dispatch the CI workflows named in REQUIRED_CHECK_WORKFLOWS because GITHUB_TOKEN PRs get no pull_request runs. That only works while each listed workflow declares workflow_dispatch and still exists under that name; a regression surfaces only inside the daily refresh run, leaving its PR without required checks. Read the workflow files in the vitest gate so the PR that breaks the contract fails instead. Co-authored-by: Copilot <[email protected]> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
❌ Deploy Preview for hivecommons-docs failed. Why did it fail? →
|
There was a problem hiding this comment.
Looks correct to me, and the shapes the test hard-codes do match the files at 6ce16ab:
REQUIRED_CHECK_WORKFLOWS: build.yml typecheck.yml vitest.yml npm-audit.ymlis an unquoted top-levelenv:scalar in bothmeeting-recordings-refresh.yml:16andhive-docs-refresh.yml:21, soreadRequiredCheckWorkflows(src/__tests__/refresh-workflow-dispatch.test.ts:28) splits it cleanly; the dispatch loops at:78-79/:83-84are literallyfor wf in $REQUIRED_CHECK_WORKFLOWS; do+gh workflow run "$wf", matching the regexes at:62-63.- All four listed workflows use a bare
on:mapping (build.yml:3,typecheck.yml:3,vitest.yml:3,npm-audit.yml:3) with two-space keys, and each declares bothpull_requestandworkflow_dispatch, soreadTriggers(:35-47) reads them and the two trigger assertions pass today — and would fail, as intended, if any of them were switched to the scalar/list form. vitest runis the repo'stestscript (package.json:24), so the new file is picked up by the existing vitest gate with no config change.
The Netlify deploy-preview / Header rules / Redirect rules / Pages changed failures on this head also fail identically on #500, so they are not caused by this test-only diff. No findings.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Looks correct to me. The gate encodes exactly what the two refresh workflows do today, and the four CI workflows it reads are all in the shape it expects.
Verified in the tree at 6ce16ab:
.github/workflows/meeting-recordings-refresh.yml:16andhive-docs-refresh.yml:21both declareREQUIRED_CHECK_WORKFLOWS: build.yml typecheck.yml vitest.yml npm-audit.ymlunquoted, soreadRequiredCheckWorkflows(src/__tests__/refresh-workflow-dispatch.test.ts:28-31) splits it cleanly;:78-79/:83-84contain the literalfor wf in $REQUIRED_CHECK_WORKFLOWS; do/gh workflow run "$wf"the test matches.- All four listed workflows use the mapping form
on:block withpull_request:andworkflow_dispatch:as 2-space keys (e.g.build.yml:3-11), which is the only shapereadTriggers(:37-49) reads. Comments inside the block are skipped by the^ {2}[A-Za-z_]match, and the loop stops at the next top-level key — the unit test at:97-111covers both. - The deliberate fail-loud behaviour for
on: push/on: [a, b](:113-116) is the right call here: a workflow silently rewritten to the list form would otherwise pass the gate while no longer being readable by it. - Ran
npx vitest run src/__tests__/refresh-workflow-dispatch.test.tson this head: 33/33 pass.
Body matches the diff; the changelog fragment uses the added- prefix. The red checks are all Netlify (Deploy Preview failed, plus the three Netlify sub-checks); #500 (bot/hive-docs-refresh) shows the identical failure on its head, and nothing in this diff is reachable from npm run build (netlify.toml:5), so that is a Netlify-side state rather than this change.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Test Improvement
Adds
src/__tests__/refresh-workflow-dispatch.test.ts, a config gate over the contract between the two scheduled refresh jobs (meeting-recordings-refresh.yml, andhive-docs-refresh.ymlfrom #499) and the CI jobs they dispatch.Why: PRs opened with
GITHUB_TOKENget nopull_requestruns, so both refresh jobs rungh workflow run <wf>for every entry inREQUIRED_CHECK_WORKFLOWS. That only works while each listed CI job still declareson: workflow_dispatchand still exists under that filename. Today nothing checks this: dropping the trigger fromvitest.yml(or renamingnpm-audit.yml) passes every PR check and only surfaces inside the next 06:17 UTC refresh run, whose PR then sits without its required checks and never merges. The same class of silent config drift is what thenetlify.tomldeploy-preview gate (#419) already guards; this mirrors that pattern (read the file, assert the invariant) for the.github/workflows/directory — read-only; no file under it changes.What the gate asserts (33 tests, all pass on
main):REQUIRED_CHECK_WORKFLOWSand iterates it in the dispatch step;workflow_dispatchandpull_request;Mutation check: deleting
workflow_dispatch:fromvitest.ymlfails two tests; restoring it passes.No YAML library is a direct dependency, so the
on:block is read line-wise in mapping form only; the scalar/list forms return no triggers so an unexpected shape fails loudly rather than being silently accepted (covered by unit tests on the helper).Touches only
src/__tests__/andchangelog.d/.Filed by quality agent (ACMM L4/L6 — full mode)
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88