Skip to content

Commit 4257389

Browse files
tarasclaude
andcommitted
Point the CI guide at the PullRequest.Checks syntax reference
The Sidekick CI chapter is now the short instruction to look the element up with `<REPL.Syntax>` and branch on the watch outcome, in the approved chapter format. The test that ran the removed example, its runtime exclusion and the watch suite's extraction of it go with it; the spec no longer says the guide teaches post-merge `gh` verification. `<PullRequest.Checks>` now describes each prop in its schema, so the syntax reference states URL identity, provider selection, which hosts watch and the `timeoutSeconds` rules. The `xmd syntax` catalog fixtures carry them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 34ada7d commit 4257389

7 files changed

Lines changed: 34 additions & 340 deletions

File tree

Lines changed: 2 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,11 @@
11
# CI
22

3-
Read this when you need to wait for pull request checks or verify a specific
4-
workflow attempt after merge.
3+
Read this when you need to wait for pull request checks.
54

65
## Applies to
76

87
Sidekick responses and the REPL entries they submit.
98

109
## Instructions
1110

12-
- Read `<Guide.Entries />` first. Use the task's canonical pull request URL and
13-
choose a time budget. Put the entire wait in one ordinary entry.
14-
- `<PullRequest.Checks url=… watch timeoutSeconds={…} as="checkResult" />`
15-
watches every reported check run and commit status for the head it first
16-
observes, and binds `{ outcome, reason?, headSha, checks }`. It waits for
17-
every reported check to settle, even after one has failed.
18-
- Successful, skipped and neutral results pass. Failure, error, cancellation,
19-
timeout and action-required results fail. A pull request that reports no
20-
checks yet keeps the watch waiting.
21-
- Submit the entry, read the receipt, and then read that exact entry's output,
22-
for example with `<REPL.Entry.Output entry={2} />` when the receipt names
23-
entry 2. Read further pages as needed. A completed entry can report any CI
24-
outcome; use the watch result from that entry for the next action.
25-
- Decide from `outcome`, never from a filtered array: a list of failed records
26-
can be empty while CI is still pending.
27-
- `success`: report that the watched checks passed for `headSha`.
28-
- `failure`: inspect the failed records and their links. The query shows
29-
failed rows across the full collection.
30-
- `incomplete` with `reason: "timeout"`: report what was still pending and
31-
decide whether to wait again.
32-
- `incomplete` with `reason: "head-changed"`: report the watched `headSha`
33-
and confirm the intended revision before starting another watch.
34-
- `incomplete` with `reason: "read-error"`: report that the outcome could not
35-
be established.
36-
- While the entry runs, the person can read its **Output · live** for the short
37-
head and the passed, failed and pending counts. Draft **Stop** ends the watch
38-
and binds nothing. Sidekick **Stop** ends the Send and leaves an admitted
39-
entry running; read that exact entry when you resume.
40-
- Keep compact derived values in root bindings and put large reports or
41-
separately collected progress histories in files.
42-
43-
## Example
44-
45-
This response submits an entry that renders the result and uses `Query` to show
46-
failed rows only once the outcome is known to be `failure`.
47-
48-
`````xmd
49-
<Let as="code" select="code">
50-
````xmd
51-
<PullRequest.Checks url="https://github.com/taras/executable.md/pull/123"
52-
watch timeoutSeconds={600} as="checkResult" />
53-
54-
<Output>
55-
<Json value={checkResult} />
56-
57-
<If condition={checkResult.outcome === "failure"}>
58-
### Failed check records
59-
60-
<Query value={checkResult.checks}
61-
yq='[.[] | select((.kind == "check-run" and .status == "completed" and (.conclusion == "failure" or .conclusion == "cancelled" or .conclusion == "timed_out" or .conclusion == "action_required")) or (.kind == "commit-status" and (.state == "failure" or .state == "error")))]' />
62-
</If>
63-
</Output>
64-
````
65-
</Let>
66-
<REPL.EntryInput>{code}</REPL.EntryInput>
67-
<REPL.Submit />
68-
`````
69-
70-
If the 600-second budget expires while a check is pending, the entry renders:
71-
72-
```json
73-
{
74-
"outcome": "incomplete",
75-
"reason": "timeout",
76-
"headSha": "0123456789abcdef0123456789abcdef01234567",
77-
"checks": [
78-
{
79-
"kind": "commit-status",
80-
"id": "42",
81-
"headSha": "0123456789abcdef0123456789abcdef01234567",
82-
"name": "green",
83-
"state": "pending",
84-
"description": "CI is running",
85-
"url": "https://github.com/taras/executable.md/actions/runs/45030887260",
86-
"createdAt": "2026-11-23T12:00:00Z",
87-
"updatedAt": "2026-11-23T12:00:00Z"
88-
}
89-
]
90-
}
91-
```
92-
93-
## Verify a workflow attempt after merge
94-
95-
`<PullRequest.Checks>` watches a pull request's head, not a workflow run. For a
96-
specific attempt after merge, use `gh` with the repository, workflow, intended
97-
merge SHA, run ID and attempt number. Identify the run by workflow and merge
98-
SHA, then inspect the requested attempt:
99-
100-
```sh
101-
gh run view 45030887260 --repo taras/executable.md --attempt 1
102-
gh api repos/taras/executable.md/actions/runs/45030887260/attempts/1 --jq '{runId: .id, attempt: .run_attempt, headSha: .head_sha, status, conclusion}'
103-
```
104-
105-
Replace the example identifiers with the task's own. Compare the returned head
106-
SHA with the intended merge SHA before reporting the result. If the attempt is
107-
still active, repeat the same attempt-scoped read within the task's time budget.
108-
Use `status` and `conclusion` to report how that attempt ended. A retry has a
109-
different attempt number; keep the original attempt in the command when the
110-
task asks about its outcome.
111-
112-
## Common mistake
113-
114-
Treating an empty failed-records query as success. Query only selects from the
115-
records the watch returned; it says nothing about whether the watch settled.
116-
Branch on `outcome` first.
117-
118-
## Read next
119-
120-
`<Guide.Lifetimes />` for cancellation and `<Guide.Bindings />` for published
121-
values.
11+
Use the pull request URL and choose a time budget. Look up `<PullRequest.Checks>` with `<REPL.Syntax names={["PullRequest.Checks"]} />`. Submit the watch in one entry and read its outcome before filtering for failures. An empty list can mean checks are still pending.

‎packages/cli/tests/repl-pull-request-checks-watch.test.ts‎

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
import type { Operation, Task } from "effection";
2929
import { fromReadable } from "@effectionx/node";
3030
import { once } from "@effectionx/node/events";
31-
import { readTextFile, rm, writeTextFile } from "@effectionx/fs";
31+
import { rm, writeTextFile } from "@effectionx/fs";
3232
import { createServer } from "node:http";
3333
import type { IncomingMessage, ServerResponse } from "node:http";
3434
import type { AddressInfo } from "node:net";
@@ -979,54 +979,6 @@ describe("what a watch refuses before contacting anything", () => {
979979
});
980980
});
981981

982-
/** The entry the Sidekick CI guide submits, read from the shipped chapter. */
983-
function* guideEntry(): Operation<string> {
984-
const chapter = yield* readTextFile(new URL("../src/documents/sidekick/ci.md", import.meta.url));
985-
const fence = /(?<!`)````xmd\n([\s\S]*?)\n````(?!`)/.exec(chapter);
986-
if (fence?.[1] === undefined) {
987-
throw new Error("the CI guide carries no entry example");
988-
}
989-
return fence[1].replaceAll("https://github.com/taras/executable.md/pull/123", URL_1);
990-
}
991-
992-
describe("the Sidekick CI guide's entry", () => {
993-
it("W17: renders failed rows only when the outcome is failure", function* () {
994-
const fixture = yield* useFixture();
995-
const source = yield* guideEntry();
996-
997-
fixture.ci.runs = [
998-
checkRun(31, "build", "completed", "failure"),
999-
checkRun(32, "lint", "completed", "success"),
1000-
];
1001-
fixture.ci.statuses = [commitStatus(42, "green", "error")];
1002-
const failed = yield* run(fixture, source, new InMemoryStream());
1003-
expect(failed.refusal).toBe(undefined);
1004-
expect(failed.output).toContain("Failed check records");
1005-
const rows = failed.output.slice(failed.output.indexOf("Failed check records"));
1006-
expect(rows).toContain('"build"');
1007-
expect(rows).toContain('"green"');
1008-
expect(rows).not.toContain('"lint"');
1009-
1010-
fixture.ci.runs = [checkRun(32, "lint", "completed", "success")];
1011-
fixture.ci.statuses = [];
1012-
const passed = yield* run(fixture, source, new InMemoryStream());
1013-
expect(passed.refusal).toBe(undefined);
1014-
expect(passed.output).toContain('"success"');
1015-
expect(passed.output).not.toContain("Failed check records");
1016-
1017-
// Pending at the deadline: incomplete, with nothing failed to show.
1018-
fixture.ci.runs = [checkRun(33, "slow", "in_progress", null)];
1019-
const task = yield* started(fixture, source, new InMemoryStream());
1020-
const now = fixture.clock.now;
1021-
yield* fixture.clock.waitFor((at) => at === now + CHECK_WATCH_POLL_MS);
1022-
fixture.clock.advanceTo(now + 600_000);
1023-
const pending = yield* task;
1024-
expect(pending.output).toContain('"incomplete"');
1025-
expect(pending.output).toContain('"timeout"');
1026-
expect(pending.output).not.toContain("Failed check records");
1027-
});
1028-
});
1029-
1030982
describe("a retained watch this entry cannot account for", () => {
1031983
it("W18: every tampered checkpoint refuses before anything replays or is asked", function* () {
1032984
const fixture = yield* useFixture();

‎packages/cli/tests/repl-sidekick-ci-guide.test.ts‎

Lines changed: 0 additions & 165 deletions
This file was deleted.

‎packages/core/tests/fixtures/syntax-generated-base.json‎

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

‎packages/git/src/composition/components/PullRequestReads.ts‎

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,34 @@ export const props: PropsSchema = {
6767
const checksProps: PropsSchema = {
6868
type: "object",
6969
properties: {
70-
url: { type: "string", minLength: 1 },
71-
provider: { type: "string", minLength: 1 },
72-
watch: { type: "boolean" },
73-
timeoutSeconds: { type: "integer", minimum: 1 },
70+
url: {
71+
type: "string",
72+
minLength: 1,
73+
description:
74+
"The pull request's canonical URL, which identifies it; the provider that " +
75+
"recognizes the URL answers, such as GitHub for `github.com`.",
76+
},
77+
provider: {
78+
type: "string",
79+
minLength: 1,
80+
description:
81+
"The name of the only provider that may answer, for a URL another provider would " +
82+
"also recognize, such as a self-hosted deployment: lower-case letters, digits " +
83+
"and hyphens, starting with a letter.",
84+
},
85+
watch: {
86+
type: "boolean",
87+
description:
88+
"Wait until every check reported for the pinned head settles, instead of reading " +
89+
"once, and bind one watch result. Needs `timeoutSeconds`; only a REPL entry watches.",
90+
},
91+
timeoutSeconds: {
92+
type: "integer",
93+
minimum: 1,
94+
description:
95+
"How many seconds a watch waits before it ends `incomplete`: a positive whole " +
96+
"number, required with `watch` and refused without it.",
97+
},
7498
},
7599
required: ["url"],
76100
additionalProperties: false,

0 commit comments

Comments
 (0)