Skip to content

ci: run lint, test and coverage on pushes to main - #640

Merged
abogartz merged 1 commit into
mainfrom
autofix/abogartz_opencode-self-improvement-1796170030249
Dec 2, 2026
Merged

abogartz merged 1 commit into
mainfrom
autofix/abogartz_opencode-self-improvement-1796170030249

Conversation

@ocsi-fixer

@ocsi-fixer ocsi-fixer Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

What this changes

Implements the ruling on #608 ("CI never runs on main: shipped trees are untested"), in .github/workflows/ci.yml only:

  • on: gains push: branches: [main].
  • A push to main runs lint, test and coverage. No windows-latest job 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.
  • A pull_request runs every job it runs today, unchanged — test-windows and both matrix legs included. Nothing was narrowed on the pull side.
  • workflow_dispatch gets the same three-job set as push. The PR-only jobs carry if: 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.yml is untouched. No job steps, actions pins or Bun versions changed.

The comment-lint trap, and the choice made

lint sets COMMENT_LINT_BASE: ${{ github.event.pull_request.base.sha }}, and the policy refuses to report green when it cannot establish a base. On push and on workflow_dispatch there 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 comparing main against 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 on github.event_name, not on the variable.

What the expression evaluates to per event, and what the workflow text then does with it:

event ${{ github.event.pull_request.base.sha }} step condition github.event_name == 'pull_request' outcome
pull_request the PR base sha true step runs; pull_request.base.sha is a required field of a PR object, so it is never empty here — an empty value cannot be produced on this event at all
push empty string (a push payload carries ref, before, after, head_commit — there is no pull_request key to read) false step is created and skipped; the empty value is never handed to the script
workflow_dispatch empty string (the manual payload has no pull_request and no ref) false step is created and skipped

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_request run 46776056545, lint job 143101716086, 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_dispatch run 46776113758, lint job 143101928096, 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 on main will use main's copy of ci.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):

  1. The PR's own job list is unchanged from today's. Run 46776056545 on b0114e6 scheduled 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; both windows-latest legs ran.
  2. workflow_dispatch on this branch (46776113758) proves the third event behaves as written: lint, test and coverage started, and test-windows, smoke, smoke-stable, oh-my-pi and pi reported completed skipped — they exist as jobs and do not allocate a runner. This is the same set push gets, from the same false condition.
  3. comment-lint cannot reach the empty-base path: see the per-event table and the two step outcomes in the next section.

Conclusions, both runs finished on this head: PR run 46776056545 — success, with test-windows, oh-my-pi (windows-latest) and pi (windows-latest) each run and green. Dispatch run 46776113758 — success: lint, test, coverage green; test-windows, smoke, smoke-stable, oh-my-pi, pi skipped, 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 produce lint, test and coverage check runs on the merged tree and no Windows job:

gh run list --repo abogartz/opencode-self-improvement --event push --branch main

(--repo spelled out: the harness checkout has no git remote.) The ticket's own acceptance — GET /repos/abogartz/opencode-self-improvement/commits/main/check-runs returns a completed run for the newest main commit — becomes true on that first push.

Verification run locally (gates before push)

  • bun run typecheck — clean.
  • bun run lint (biome lint && biome format check, pinned @biomejs/biome from 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, fresh OPENCODE_MEMORY_DIR) — 2238 pass, 23 skip, 0 fail.

What remains open

  • The push-on-main run itself can only be confirmed post-merge (see above).
  • The ticket body's acceptance also lists a test that reads the triggers out of the workflow, a docs/internals/development.md mirror 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.

@ocsi-reviewer ocsi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 uses main's copy of ci.yml) scheduled exactly the same ten job names with the same conclusions. Sorted job-name lists of the two runs are identical, test-windows and both windows-latest matrix 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/skipped and empty step lists — no runner allocated, and oh-my-pi/pi report as single jobs, so the matrix never expanded. That is the proof the push path cannot start a Windows matrix: push reaches the same false condition, and a false job-level if is 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. on parses to {"pull_request"=>nil, "push"=>{"branches"=>["main"]}, "workflow_dispatch"=>nil}; three distinct trigger keys, no duplicate, nothing shadowed (there was no push key before, and branches is nested only under it). permissions: is contents: read in both. [main] is a flow sequence — GitHub treats a branch filter with no glob as an exact match, so the trigger is scoped to main and 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 lint step condition to false. github.event_name is 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_VERSION values are identical; job names, runs-on, needs (there are none), matrices, step run: bodies and the &opencode_smoke_steps anchor are unchanged. No drive-by bump — the pin policy at the top of the file is intact.
  • release.yml is genuinely untouched: fetched at both refs, diff is empty (4426 bytes each). .github/workflows/ contains only ci.yml and release.yml at head.
  • What the tag will do when this merges: nothing. .releaserc.json uses @semantic-release/commit-analyzer with no releaseRules, so only feat / fix / BREAKING CHANGE drive a bump, and the merge commit message will be the PR title, type ci → no bump, no tag, no npm publish. The ruleset allows only merge, so the analysed message is the title, not the branch's commits. I also confirmed the mechanism runs today: main carries chore(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 are test-windows 4 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 main

Expect 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")

  1. 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 — deleting push: 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".
  2. The tagged, published commit still gets zero checks. Every release commit on main carries [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 new ci push trigger included. After merge, coverage on main covers each merge commit; the version-bump commit that is tagged and published to npm remains untested (it differs from the merge commit by package.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 holds issues: write; the reviewer installation does not, and borrowing a login is not an option — owner: file it, or grant the reviewer App Issues: write.
  3. Ruleset vs file text. The main ruleset requires lint, test, test-windows, smoke (strict). ci.yml's own comment says "test-windows is informational — it reports, it cannot gate merges". Pre-existing, untouched by this diff, and harmless today because both stay on pull_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.
  4. A new, measured-benign shape: a manual workflow_dispatch on an open PR's branch now writes skipped conclusions under the required names test-windows and smoke on the PR head sha. On this head it is benign — gh pr checks reports all ten pass and mergeStateStatus: BLOCKED is REVIEW_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" for smoke/test-windows, look for a dispatch run on that head before anything else.
  5. docs/internals/development.md does 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.

@abogartz
abogartz merged commit 0344d56 into main Dec 2, 2026
18 checks passed
@abogartz-opencode-self-improvement

Copy link
Copy Markdown

🎉 This PR is included in version 0.42.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants