Repository navigation
ci: run lint, test and coverage on pushes to main - #640
Conversation
Applied by pr-autofix.
There was a problem hiding this comment.
Verdict: APPROVED — reviewed at head b0114e671e9d106c2c0b19f2e777679da7e349e2 (single commit, base 6e6acecd28ead30fb4030e2e3d5e33832173dc37, .github/workflows/ci.yml only, +29 / −0).
Everything below was measured off GitHub and off the head's own files, not taken from the pull description. The standard is the ruling on #608 ("main gets a push trigger, with the Windows matrix job held back to pull requests").
1. The two runs, read from the jobs API
pull_request run 46776056545 (event=pull_request, head_sha=b0114e67…, PR #640) — 10 jobs, all run, all green:
coverage completed/success
lint completed/success
oh-my-pi (ubuntu-latest) completed/success
oh-my-pi (windows-latest) completed/success
pi (ubuntu-latest) completed/success
pi (windows-latest) completed/success
smoke completed/success
smoke-stable completed/success
test completed/success
test-windows completed/success
workflow_dispatch run 46776113758 (same head, same branch) — 3 run, 5 skipped:
lint completed/success
test completed/success
coverage completed/success
pi completed/skipped
oh-my-pi completed/skipped
test-windows completed/skipped
smoke completed/skipped
smoke-stable completed/skipped
Both job sets match what the change claims. Two things I added, because "unchanged on the pull side" is the claim this ticket exists to protect and a self-report is not a baseline:
- Pre-change control run. Run 46775995553 (
test/632-cut-pass-guards, filed 24 s before this PR's run, so it usesmain's copy ofci.yml) scheduled exactly the same ten job names with the same conclusions. Sorted job-name lists of the two runs are identical,test-windowsand bothwindows-latestmatrix legs included. The pull path is not narrowed. - Skipped ≠ not created. On the dispatch run the five PR-only jobs exist as jobs with
completed/skippedand empty step lists — no runner allocated, andoh-my-pi/pireport as single jobs, so the matrix never expanded. That is the proof the push path cannot start a Windows matrix:pushreaches the same false condition, and a false job-levelifis evaluated before matrix expansion.
Step-level, on the lint job: run 46776056545 step 5 Comment policy … => success, run 46776113758 step 5 Comment policy … => skipped, with Typecheck and Lint (biome) success in both. The job logs confirm the body's quoted line — comment-lint: clean (0 added comment line(s) checked against COMMENT_LINT_BASE) — and its source string, which shows the env var was non-empty on pull_request; the dispatch log contains no comment-lint line at all, i.e. the script never started.
2. Every github.* / context reference in ci.yml at head, with guard status
grep over the head file returns exactly these; there are no others.
| Line | Reference | Where | pull_request |
push (main) |
workflow_dispatch |
|---|---|---|---|---|---|
| 26 | github.event_name == 'pull_request' |
inside the new event-matrix comment | text, not evaluated | text | text |
| 44 | ${{ github.event.pull_request.base.sha }} |
jobs.lint.env.COMMENT_LINT_BASE |
PR base sha | empty (a push payload has no pull_request key) |
empty |
| 55 | github.event_name == 'pull_request' |
step if, the sole consumer of line 44 (bun run lint:comments) |
runs | skipped | skipped |
| 108 | github.event_name == 'pull_request' |
job if, test-windows |
runs | skipped | skipped |
| 132 | github.event_name == 'pull_request' |
job if, smoke |
runs | skipped | skipped |
| 158 | github.event_name == 'pull_request' |
job if, smoke-stable |
runs | skipped | skipped |
| 165 | github.event_name == 'pull_request' |
job if, oh-my-pi (matrix) |
runs (both OS) | skipped, no matrix expansion | skipped |
| 208 | github.event_name == 'pull_request' |
job if, pi (matrix) |
runs (both OS) | skipped, no matrix expansion | skipped |
| 183, 236 | runner.os == 'Linux' |
step if in oh-my-pi, pi |
valid, OS-keyed | unreachable (job skipped) | unreachable (job skipped) |
| 192, 245 | runner.os == 'Windows' |
step if in oh-my-pi, pi |
valid, OS-keyed | unreachable (job skipped) | unreachable (job skipped) |
| 172, 215 | ${{ matrix.os }} (runs-on) |
matrix jobs | valid | unreachable | unreachable |
lint, test and coverage carry no if at all → they run on every event, which is the ruling's three-job set.
Is there a step that receives an empty value on push and still runs? No. Line 44 is the only github.event.pull_request read in the file, it is evaluated unconditionally (env is not gated — the empty value is set on push/dispatch), and it has exactly one consumer, gated by line 55. So the safety key is github.event_name, not the variable, which is what the ruling asked for.
Checked the places you'd expect to break and found none, in the head file: secrets. — zero occurrences; artifact/coverage upload steps — none, the only uses: in ci.yml are actions/checkout, actions/setup-node, oven-sh/setup-bun (identical sets in main and head); commit-status or PR-comment posting — none; github.ref/sha/run_number — none. coverage publishes a text report only. jobs.lint.steps[0].with.fetch-depth: 0 is event-independent: on push it fetches full history of main, which costs a deeper fetch and depends on no PR context. There is no concurrency: block in ci.yml in either revision (not introduced, not removed).
3. Syntax, schema and scope
- YAML parses. Psych loads both revisions.
onparses to{"pull_request"=>nil, "push"=>{"branches"=>["main"]}, "workflow_dispatch"=>nil}; three distinct trigger keys, no duplicate, nothing shadowed (there was nopushkey before, andbranchesis nested only under it).permissions:iscontents: readin both.[main]is a flow sequence — GitHub treats a branch filter with no glob as an exact match, so the trigger is scoped tomainand cannot fire on feature-branch pushes. - The expressions are GitHub-valid, proven by execution rather than by eye. An expression that fails to compile aborts the run with "The workflow is not valid" and schedules no jobs; both runs on this head scheduled and completed jobs, and the dispatch run evaluated the five job conditions to false and the
lintstep condition to false.github.event_nameis defined for all three events. - Nothing else moved. The diff is additive only (+29 / −0): the trigger pair, the event-matrix comment block, the env comment, and six
if:lines. Action SHA pins are byte-identical (checkout@11d596…v4.4.0,setup-node@949feb…v7.1.0,setup-bun@0c5077…v2.2.0);bun-version,node-version,OPENCODE_VERSIONvalues are identical; job names,runs-on,needs(there are none), matrices, steprun:bodies and the&opencode_smoke_stepsanchor are unchanged. No drive-by bump — the pin policy at the top of the file is intact. release.ymlis genuinely untouched: fetched at both refs,diffis empty (4426 bytes each)..github/workflows/contains onlyci.ymlandrelease.ymlat head.- What the tag will do when this merges: nothing.
.releaserc.jsonuses@semantic-release/commit-analyzerwith noreleaseRules, so onlyfeat/fix/BREAKING CHANGEdrive a bump, and the merge commit message will be the PR title, typeci→ no bump, no tag, no npm publish. The ruleset allows onlymerge, so the analysed message is the title, not the branch's commits. I also confirmed the mechanism runs today:maincarrieschore(release): 0.42.0 [skip ci],0.41.3,0.41.2. - Double-run cost is as designed, and Windows is excluded from it. A merge now produces the PR run plus a push run. The push run is
lint(16 s) +test(1 m 26 s) +coverage(2 m 14 s) ≈ 4 min of Ubuntu minutes; the held-back legs aretest-windows4 m 34 s,oh-my-pi (windows)11 m 02 s,pi (windows)5 m 39 s at the 2× Windows rate. The push run cannot reach them — see the dispatch evidence above.
4. Shape pass (item 16), disclosed
Written to .dev/640-shape.md in the harness repo before the diff, the pull body or any review was opened; inputs were the #608 body, its ruling comment, and main's ci.yml. Route disclosure: I read the ticket body with its comments, because the ruling is the handed standard — the pass is blind to the pull thread, not to the ticket.
The space I wrote down: (A) a second file ci-main.yml carrying the push trigger, leaving ci.yml untouched; (B) keep comment-lint running on push by making the base real — ${{ github.event.pull_request.base.sha || github.event.before }}; (C) if: github.event_name != 'push' on the five legs. Invariants I required: no PR-side narrowing; cheap set on push; branch-scoped trigger; dispatch must not gain Windows; comment-lint a decision not a fall-through; names/pins/permissions frozen; no release fires; nothing may read a PR-only context.
The author's shape sits inside that space — condition the existing jobs (not A), skip rather than re-base comment-lint (not B), == 'pull_request' rather than != 'push' (not C). My predicted redundancy did not appear: no second copy of the checkout/setup-bun/pin block, which is the drift A would have created. One of my assumptions was wrong and it is worth carrying: I predicted the unguarded fall-through would be red. Measured with the head's own scripts/comment-lint.ts in a scratch repo whose HEAD adds a violating comment and whose origin/main already contains HEAD — the shape a push checkout has:
comment-lint: clean (0 added comment line(s) checked against merge-base with origin/main) exit=0
…while the same repo with a real base reports 1 added comment line(s) break the policy and exits 1. So the ungated step does not fail on push, it goes vacuously green — worse than red, because it looks like coverage. The gate chosen is correct under either polarity, and this makes the case for it stronger than the pull body's own framing (which describes wandering "into the empty-diff / merge-base path"). The ruling predicted red for the same fall-through; the decision it ruled is unaffected.
Disclosure of what cannot be proven, and my judgement of it: the pull body says plainly that GitHub only runs push-triggered workflows from the default branch's copy, so this PR cannot exercise the main-push path, and it gives the post-merge command. That is honest, not hand-waving: it names the mechanism (default-branch copy), states which side is untested, and its positive claims are each tied to a run id, job id, step number and log line — every one of which I re-fetched and confirmed above. It also volunteers the ticket acceptance it did not meet (§6), which is the opposite of hiding a gap.
5. The one action after merge
After the merge, on the first push to main (the merge commit — release commits keep [skip ci], see §6), confirm the real behaviour, which nothing before merge can show:
gh run list --repo abogartz/opencode-self-improvement --event push --branch mainExpect exactly one new ci run with event push whose job set is lint, test, coverage — and no test-windows, smoke, smoke-stable, oh-my-pi or pi job that ran. Baseline right now, for comparison: GET /repos/abogartz/opencode-self-improvement/commits/main/check-runs → total_count: 0, and gh run list --workflow ci --event push --branch main → empty. If that push run is absent, or carries a Windows job, the trigger or a condition is wrong on main and the fix is a follow-up pull, not a rerun.
6. What remains unfixed (approval is not "reliable now")
- Nothing pins the trigger set. The ticket's acceptance listed a test that reads the triggers out of the workflow; the ruling scoped it out and the body declares it. So
push: branches: [main]and the six conditions are guarded by no assertion — deletingpush:or flipping a condition produces no red anywhere, because the file that would catch it is the file being edited. Named risk, not a blocker: the ruling chose "trigger and job conditions only". - The tagged, published commit still gets zero checks. Every release commit on
maincarries[skip ci](chore(release): 0.42.0 [skip ci],0.41.3,0.41.2), and[skip ci]suppresses all workflows for that push — the newcipush trigger included. After merge, coverage onmaincovers each merge commit; the version-bump commit that is tagged and published to npm remains untested (it differs from the merge commit bypackage.json, so the exposure is small, but the ticket named release commits explicitly and this does not close that half). Filing it needs a seat that holdsissues: write; the reviewer installation does not, and borrowing a login is not an option — owner: file it, or grant the reviewer AppIssues: write. - Ruleset vs file text. The
mainruleset requireslint,test,test-windows,smoke(strict).ci.yml's own comment says "test-windowsis informational — it reports, it cannot gate merges". Pre-existing, untouched by this diff, and harmless today because both stay onpull_request— but the text is wrong, and a future "hold this leg back" edit made against that comment rather than the ruleset is how a required check goes missing. - A new, measured-benign shape: a manual
workflow_dispatchon an open PR's branch now writesskippedconclusions under the required namestest-windowsandsmokeon the PR head sha. On this head it is benign —gh pr checksreports all ten pass andmergeStateStatus: BLOCKEDisREVIEW_REQUIRED, not checks — but two runs of one workflow reporting different conclusions for the same context on the same sha is exactly where a quiet merge block appears. Watch it; if a PR ever shows "Expected" forsmoke/test-windows, look for a dispatch run on that head before anything else. docs/internals/development.mddoes not mirror what runs on which event, and the deliberate-break demonstration from the ticket's acceptance was not run. Both are declared in the body as out of scope of this pull and stay open against #608.
None of 1–5 is a defect in this diff: the change does what the ruling rules, keeps the pull path byte-for-byte equivalent in behaviour, and writes its own reason into the file where the next editor will hit it.
|
🎉 This PR is included in version 0.42.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What this changes
Implements the ruling on #608 ("CI never runs on main: shipped trees are untested"), in
.github/workflows/ci.ymlonly:on:gainspush: branches: [main].pushtomainrunslint,testandcoverage. Nowindows-latestjob is created, and the pinned-CLI / adapter legs (smoke,smoke-stable,oh-my-pi,pi) stay back too — the push set is exactly those three jobs.pull_requestruns every job it runs today, unchanged —test-windowsand both matrix legs included. Nothing was narrowed on the pull side.workflow_dispatchgets the same three-job set aspush. The PR-only jobs carryif: github.event_name == 'pull_request', not "not push" — deliberate: "not push" would hand every manual run the full Windows matrix. The decision and the reason are written into the workflow as the event-matrix comment at the top of the file, where the next reader editing a condition will hit it.release.ymlis untouched. No job steps, actions pins or Bun versions changed.The comment-lint trap, and the choice made
lintsetsCOMMENT_LINT_BASE: ${{ github.event.pull_request.base.sha }}, and the policy refuses to report green when it cannot establish a base. Onpushand onworkflow_dispatchthere is no pull request, the expression is empty, and a naive change lets the step wander into the empty-diff / merge-base path.Chosen branch of the ruling: skip comment-lint when there is no pull request underneath. The step carries
if: github.event_name == 'pull_request'; the merge already carried the review, and comparingmainagainst its own tip would report clean while checking nothing. Typecheck and biome still run on every event. This is stated in the env comment above the expression, and the step condition is the enforcement — the empty value can never reach the script because the gate keys ongithub.event_name, not on the variable.What the expression evaluates to per event, and what the workflow text then does with it:
${{ github.event.pull_request.base.sha }}github.event_name == 'pull_request'pull_requestpull_request.base.shais a required field of a PR object, so it is never empty here — an empty value cannot be produced on this event at allpushref,before,after,head_commit— there is nopull_requestkey to read)workflow_dispatchpull_requestand noref)The choice is enforced by the workflow text, not by luck: the value of the condition depends only on
github.event_name, which the runner sets, so there is no event on which the step runs with an empty base. Skipping the step is what a push cannot do silently — it is one visible step with a visible false condition, and the reason sits in the comment above the env block.Measured, on this head (
b0114e6):pull_requestrun46776056545,lintjob143101716086, step 5 completed success, and its log names the explicit source:comment-lint: clean (0 added comment line(s) checked against COMMENT_LINT_BASE)— zero added lines because this pull adds no TypeScript comments, and the source string proves it read the CI-supplied base rather than guessing.workflow_dispatchrun46776113758,lintjob143101928096, step 5 completed skipped — the empty-value case never reached the script.What this PR can and cannot prove
Cannot: GitHub only runs
push-triggered workflows from the workflow file on the default branch, so this pull request cannot exercise the main-push path — the run onmainwill usemain's copy ofci.yml, which only carries this trigger after merge. CI on this PR does not demonstrate that path.Can (evidence filled in below from the runs on this head):
46776056545onb0114e6scheduled and ran all ten checks that a pull request gets today —lint,test,coverage,test-windows,smoke,smoke-stable,oh-my-pi (ubuntu-latest),oh-my-pi (windows-latest),pi (ubuntu-latest),pi (windows-latest). Nothing narrowed on the pull side; bothwindows-latestlegs ran.workflow_dispatchon this branch (46776113758) proves the third event behaves as written:lint,testandcoveragestarted, andtest-windows,smoke,smoke-stable,oh-my-piandpireportedcompleted skipped— they exist as jobs and do not allocate a runner. This is the same setpushgets, from the same false condition.Conclusions, both runs finished on this head: PR run
46776056545—success, withtest-windows,oh-my-pi (windows-latest)andpi (windows-latest)each run and green. Dispatch run46776113758—success:lint,test,coveragegreen;test-windows,smoke,smoke-stable,oh-my-pi,piskipped, no Windows runner allocated.Post-merge check (for the next person)
After merge, the first push to
main(a merge commit; release commits keep[skip ci]) must producelint,testandcoveragecheck runs on the merged tree and no Windows job:(
--repospelled out: the harness checkout has no git remote.) The ticket's own acceptance —GET /repos/abogartz/opencode-self-improvement/commits/main/check-runsreturns a completed run for the newestmaincommit — becomes true on that first push.Verification run locally (gates before push)
bun run typecheck— clean.bun run lint(biome lint && biome formatcheck, pinned@biomejs/biomefrom devDependencies) — 0 errors (975 advisory warnings, repo baseline), format check clean.COMMENT_LINT_BASE=6e33179af00aef5da2b6d2586071755e82f7aa85 bun run lint:comments— clean, 318 added comment lines checked.bun run test(full unit suite, freshOPENCODE_MEMORY_DIR) — 2238 pass, 23 skip, 0 fail.What remains open
push-on-mainrun itself can only be confirmed post-merge (see above).docs/internals/development.mdmirror of what gets tested, and the deliberate-break demonstration. The ruling scoped this pull to "the trigger and the job conditions", so those are deliberately not in it — they remain open against the ticket.