Skip to content

Say before the first task that task finish needs a reporting check #398

Closed

Description

@davison

Goal

A hub scaffolded by init has no workflow; its first task is chartered, implemented, reviewed and approved before task finish --dry-run refuses NO_CHECKS (radiusred/trading-hub#4, 2026-10-09). Close the gap without scaffolding anything: (1) init's next: lines say that task finish requires at least one check reporting on every PR and that a repository without a workflow adds one before its first task; (2) task new and task start emit a note: when the target repository has no workflow triggered on pull_request; (3) CLI.md cross-references NO_CHECKS from the init and task finish entries. The scaffolded always-reporting workflow (#391 option 2) is deferred to protocol 2.2 — record that as a Decision and re-file it as a capture. Tests for the note on a workflow-less repository.

Requirements

M21-R5

Adopts

Plan

Covers M21-R5 (adopts #391; option 1 + option 3, option 2 deferred to 2.2). A CLI patch: additive note: and next: lines only — no verb argument, refusal code, exit status or SPEC section changes.

  1. init's next: lines (internal/cli/init.go), hub and spoke mode alike: one more next: paragraph saying that task finish requires at least one check reporting on every pull request — NO_CHECKS, SPEC §8, the deterministic gate cannot be satisfied by absence — and that a repository without a workflow on pull_request adds one before its first task. Unconditional: init reads no workflows.
  2. A tracker read for workflows (internal/tracker): Workflows(repo) over GET /repos/{o}/{r}/actions/workflows (paginated), returning each workflow's path and state; the fake venue gains it. That listing answers 200 with zero workflows for a repository that has none (the contents listing of .github/workflows answers 404 there, indistinguishable from a repository the token cannot see), so a read failure can stay silent without swallowing the case the note is for.
  3. Trigger detection (internal/cli): each active workflow under .github/workflows/ is read from the default branch (FileContent) and its top-level on: parsed with yaml.v3 nodes — scalar (on: pull_request), sequence (on: [push, pull_request]) and mapping (on:\n pull_request:) forms. pull_request counts; pull_request_target does not. Disabled workflows do not run and do not count; GitHub-managed dynamic workflows (Pages, Dependabot — no file in the repository) are not read.
  4. The note in task new (target = --repo, or the current repository) and task start (the task's repository, on the branch-creating path beside the task finish is refused by gh pr merge's client-side BLOCKED check even when the caller holds the ruleset bypass GitHub would honour #392 policy notes): when no workflow triggers on pull_request — none at all, or none whose on: includes it — one note: saying task finish will refuse NO_CHECKS until a check reports on the task's pull request, and the capture's remedy: add a workflow that runs on pull_request (on the task's own branch or before it) and let it report. Any read failure — the listing (403/404) or a workflow file — says nothing. No refusal, no exit change.
  5. CLI.md: the init entry's printed lines and a cross-reference to NO_CHECKS under task finish; task finish's NO_CHECKS refusal points back at init, task new and task start; the task new / task start entries list the new reads and the note.
  6. Tests: the next: lines pinned for hub and spoke; the note in task new and task start for a repository with no workflows and with one lacking pull_request, silence when one has it and when the read fails (listing 403/404, a file unreadable); the trigger detection table (the three forms, pull_request_target alone not counting, a disabled workflow not counting). Existing fakes default to a reporting workflow so their output pins stand.
  7. CHANGELOG under [Unreleased], ending (Say before the first task that task finish needs a reporting check #398).
  8. Option 2 deferred: a Decision attributed to the coordination layer on Say before the first task that task finish needs a reporting check #398, and a new unlabeled backlog capture for the scaffolded always-reporting workflow, linked from it.

Ask-the-human points

None identified yet — the implementer adds any before starting.

Activity

  1. added
    cc:task
    on Oct 10, 2026
  2. radiusred-cody commented on Oct 10, 2026

    @radiusred-cody
    Contributor

    Decision: (the coordination layer's, settled on #391 and in M21-R5 — recorded here, not re-opened) #391's options 1 and 3 ship in this task: init's next: lines state the reporting-check requirement, task new and task start print a note: when the target repository has no workflow on pull_request, and CLI.md cross-references NO_CHECKS from init and task finish. Option 2 — init scaffolding an always-reporting workflow (a conventional-commit lint on pull_request, opt-out flag) — is deferred to protocol 2.2 and re-filed as the backlog capture #409.

    Trade-off: a fresh repository still cannot finish its first task without adding a workflow by hand; it is now told so before the task is chartered and again when it is started, instead of after review.

    Rejected: scaffolding the workflow in v2.1.1 — it writes files every adopter inherits and adds an argument to init, a protocol-level choice that the 2.1 bedding-in rule keeps out of a CLI patch.

  3. radiusred-cody commented on Oct 10, 2026

    @radiusred-cody
    Contributor

    Decision: the note reads GET /repos/{o}/{r}/actions/workflows (paginated), keeps the workflows whose state is active and whose path is under .github/workflows/, reads each from the default branch and parses its top-level on: (scalar, sequence or mapping); pull_request counts, pull_request_target does not. The note fires when that leaves no workflow triggered on pull_request — including a listing of zero. Any read that fails — the listing (403/404) or one workflow file — says nothing at all.

    Trade-off: a workflow the listing names whose file is not on the default branch (one that has only run from a pull request so far) cannot be read, so the note stays silent there rather than guess. GitHub-managed dynamic workflows (Pages, Dependabot, CodeQL default setup) have no file to read and are not counted, so a repository whose only reporting check is CodeQL default setup would see the note; its wording is about workflow files in .github/workflows and says task finish refuses until a check reports, which stays true there.

    Rejected: the contents listing of .github/workflows — it answers 404 both for a repository with no workflow directory (the case the note exists for) and for one the token cannot see, so "read failures say nothing" would have swallowed the case. Counting any listed workflow without reading its on: — a push-only workflow reports nothing on a pull request, which is exactly #391's situation in a repository that has CI for releases only.

  4. radiusred-cody commented on Oct 10, 2026

    @radiusred-cody
    Contributor

    Started by @radiusred-cody[bot].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cc:task

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions