Skip to content

ci: publish report-only test coverage - #627

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

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

Conversation

@ocsi-fixer

@ocsi-fixer ocsi-fixer Bot commented Dec 1, 2026

Copy link
Copy Markdown

Fixer

ci: publish report-only test coverage

Closes #235.

What changed

One file, .github/workflows/ci.yml: a new coverage job inserted as a sibling directly after test. It mirrors the test job's setup verbatim — actions/checkout and oven-sh/setup-bun at the SHA pins already in the file, with persist-credentials: false and bun-version: 1.4.4 per the pin policy stated at the top of the workflow — installs with --frozen-lockfile, and runs:

bun test --coverage ./test/ --timeout=20000 --coverage-reporter=text

Report-only, by the owner's ruling (comment 6646674112). There is no threshold flag anywhere, the job is deliberately absent from the required-check names (lint / test / test-windows / smoke), nothing in this diff references it, and no other job was touched. Making coverage blocking, and choosing a floor, are separate future tickets. No package.json script and no bunfig.toml keys were added — the frozen criterion is the CI step, and one file is the fence.

Two deliberate scope choices inside the run command:

  • ./test/ only: e2e/ hard-fails without a pinned real opencode host CLI this job doesn't install, and integration/ needs workspace installs, a tsc precheck, and (for pi) Node 22 — none of which this job carries. Unscoped discovery would die mid-suite and publish nothing.
  • --timeout=20000 mirrors the root test script; bun's 5 s default would kill slow tests outright.

Verification (no fail-before test exists for a workflow job)

A CI job changes no in-tree behaviour, so there is no assertion that goes red now and green after — inventing one (e.g. a ci.yml-shape check in e2e/) would couple a report-only job to a required job and is refused on purpose. The proof is two legs, run at 6e33179 with local bun exactly at the CI pin (1.4.4):

1. The YAML parses and the job set is exactly as intended (Bun's YAML parser):

$ bun -e 'import { YAML } from "bun"; const j = YAML.parse(await Bun.file(".github/workflows/ci.yml").text()).jobs; console.log(JSON.stringify(Object.keys(j)))'
["lint","test","coverage","test-windows","smoke","smoke-stable","oh-my-pi","pi"]

All eight pre-existing jobs intact; coverage is the only addition.

2. The run command is real at the pinned version — exact command, exact bun:

All files                        |   93.60 |   94.91 |
 2157 pass
 23 skip
 0 fail
 16663 expect() calls
Ran 2180 tests across 200 files. [110.51s]
exit code 0

The text reporter prints to the log and writes nothing: git status --porcelain after the run shows only this ci.yml edit.

Static checks, each once, all exit 0: bun run typecheck · bun run lint · bun run lint:comments · bun run test (2157 pass / 23 skip / 0 fail / 16663 expect() calls — identical to before; a ci.yml-only change moved no test).

The real acceptance artifact is this pull's own CI run: workflow YAML only ever executes in Actions, so the coverage job's run log on this pull — showing bun's text table with the percentage — is what settles "does the job actually run". The coverage check registers alongside the existing ones on this pull; per the ruling it is informational and must not be added to branch protection.

Silences, stated rather than filled

  • The percentage is unit-suite reach, not "project coverage." e2e/ and integration/ are deliberately out, so it understates total exercised surface.
  • Eight src files never load and never appear as 0% — bun's table lists only files the suite touched: src/host/runtime.ts, lifecycle.ts, contracts.ts, capabilities.ts, observations.ts, src/adapters/opencode/context.ts, src/adapters/oh-my-pi/context.ts, src/tools/deps.ts. Reporter semantics at this scope, not a threshold problem; the future floor ticket inherits it.
  • The All files denominator is blended — it includes test/ helpers and even temp shim files from package-install tests, so the headline number is not pure src.
  • The floor is to be filed off CI's published number, not this local one. The 93.60 % Funcs / 94.91 % Lines above is local Ubuntu-adjacent evidence; read the run's own All files row when choosing a floor.

Out of scope here (not this PR's)

Branch protection / ruleset changes (human-side settings; nothing here requests any), labels, the floor-and-ratchet ticket, and the docs/internals/development.md scripts→jobs table, which will not list coverage — accepted drift for a one-file diff.


Closes #235

Applied by pr-autofix.
@ocsi-fixer
ocsi-fixer Bot requested a review from abogartz as a code owner December 1, 2026 05:18

@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.

PR Reviewer

Reviewer

Review #627 — report-only coverage job @ 7a19a3599ce2b4b6a41040441ba50f8040e91f37

Blind pass done as specified: before opening the PR body, commit messages, or issue comments, I committed in writing to the defect (no coverage measurement exists anywhere; nothing moves numerically when a src file stops being reached — this diff adds one report-only CI job that publishes a percentage and gates nothing) and two breakers: (1) the run publishes nothing real or goes red anyway — either an environment-dependent test kills it, or the text reporter's denominator only counts loaded files so the number can rise when reach is lost; (2) it becomes a gate or damages its neighbours — coverage swallowed by a required-check config, or the insertion bleeding into the twelve-job file. Where the body differs: breaker 1's denominator half hit exactly (measured, and the body discloses it); breaker 1's "dies mid-suite" half and the shipped comment's identical claim were falsified by my probes — the table prints; finding F2 below. Breaker 2 refuted on both arms. Two results were in neither my theory nor the body: the threshold flag is a no-op at the pinned bun (F1), and the pass/skip split differs between the body's local run and CI totals (observation O6).

What the change is

One file, .github/workflows/ci.yml, +20/−0: a coverage job between test and test-windows, running bun test --coverage ./test/ --timeout=20000 --coverage-reporter=text.

Observation log (every claim carries its command)

# Check Command / measurement Observation
O1 File untouched except the insertion git diff origin/main...HEAD --stat; blob diff 20 insertions(+), 0 deletions; single add-hunk 57a58,77. Job set/order: base lint,test,test-windows,smoke,smoke-stable,oh-my-pi,pi → head adds only coverage after test. No trailing whitespace/CRLF (grep -nP). A workflow-damage review is moot: nothing else changed, byte for byte.
O2 Pin and with: parity blob compare of the inserted block vs the test job checkout 11d5960…#v4.4.0 + persist-credentials: false, setup-bun 0c5077e…#v2.2.0 + bun-version: 1.4.4, bun install --frozen-lockfile — byte-identical to the test job. The ruling's paste-snippet had bare uses: lines; the ruling's prose ("mirror the setup-bun with: block from the test job verbatim") governs and the diff follows the prose, as both the triager's watch-item 1 and the body state. No bare uses: in the added lines.
O3 Report-only is a fact on the GitHub side `gh api repos/abogartz/opencode-self-improvement/rulesets/25571061 --jq '.rules[] select(.type=="required_status_checks")
O4 Report-only is a fact on the harness side full local run of the job-shaped command plus --coverage-threshold=95, tree @ head, bun 1.4.4 = the CI pin Exit 0 at 93.60% (< 95), `All files 93.60
O5 The job actually publishes a number gh run view --repo abogartz/opencode-self-improvement --job=142418663877 --log, pulled myself `All files
O6 Body numbers vs CI numbers compare body's verification block to O5 Body (local, at 6e33179): 2157 pass / 23 skip / 16663 expect(). CI (O5): 2164 / 16 / 16694. Same total both sides — Ran 2180 tests across 200 files, 0 fail; 7 environment-gated tests skip on macOS and pass on ubuntu runners, and they account for the +31 expect calls. All files identical to the centesimal. The body labels its run as local and says the floor must be read from the run's own row — no misstatement.
O7 Scope comment claim: bun's default timeout bun test --help at 1.4.4 --timeout=<val> … default is 5000 — the comment's "5s default" is exact. --timeout=20000 mirrors the root script (jq .scripts.test → bun test ./test/ --parallel=4 --timeout=20000) — true (the job omits --parallel=4; only a runtime cost, none of correctness).
O8 Scope comment claim: e2e/ cannot run without a real host CLI read e2e/support/harness.ts:230-238 + call sites resolveOpencode() throws "opencode CLI not found … The terminal merge gate cannot run without a real host." when neither OPENCODE_BIN nor Bun.which("opencode") resolves; call sites are inside tests/hosts-boot (compaction.test.ts:109, stamp.test.ts:162, host-teardown.test.ts:52, support/server.ts:9, harness.ts:212) — no skip-guards found (rg skipIf → none). Claim holds at the code surface; I did not run the e2e suite (out of seat budget), so this is a code observation, not a runner observation. integration/ claims also hold: test:oh-my-pi/test:pi carry bun x tsc --noEmit -p integration/… and --timeout=240000, and the oh-my-pi/pi jobs do extra bun install --cwd integration/… + Node-22 setup this job does not carry.
O9 Denominator holes fd -e ts . src (162 files) vs src rows grepped out of the run log (154), comm -23 Exactly 8 src files never appear, not even as 0.00: src/host/{runtime,lifecycle,contracts,capabilities,observations}.ts, src/adapters/{opencode,oh-my-pi}/context.ts, src/tools/deps.ts — the same eight the body's "Silences" section lists. Blending also verified: the log's table includes test/ helpers and a temp shim (`…/tmp/osi-shim-8deA3C/src/index.ts

Findings

F1 — --coverage-threshold is a no-op at the pinned bun 1.4.4. (Hand-off fact, not a defect here.) Measured three ways: bun test --help lists only --coverage, --coverage-reporter, --coverage-dir — no threshold flag; the clean probe (one passing test, 50.00% funcs, --coverage-threshold=95) exits 0 with no diagnostic; and the full job-shaped command on this tree with --coverage-threshold=95 exits 0 at 93.60%. Consequences: (a) "report-only" is true today by flag absence (grep shows threshold in ci.yml only inside the comment/step-name prose) and incidentally by the flag's being inert; (b) the deferred floor-and-ratchet ticket cannot be implemented by adding this flag at this pin — it needs a bun upgrade or a post-processing step (lcov + script). I cannot file tickets from this seat (GitHub is read-only apart from this review), so this finding ships here and in the loop's durable memory; it should be pasted into the floor ticket when it is filed.

F2 — the shipped comment's "would kill both mid-suite and publish nothing" is wrong about the publish half. The kill half measures true (a 250 ms-timeout probe killed a 5 s test). The publish half does not: scratch probes on the same bun 1.4.4 show the text table still prints — All files | 50.00 | 50.00 | — in a run containing a timeout-killed test, a failing test, and an unloadable file; the run exits 1, it does not print nothing. So an unscoped run would publish a red job with a polluted table, not silence. The scope decision ./test/ is unchanged and still right — a red coverage check on every PR is a gate in practice, and e2e/integration failures would poison the number — but the comment states the wrong failure mechanism, and a future reader who trusts "publishes nothing" and tests it will find the premise false. One-line prose fix for the fixer or the maintainer; not merge-blocking, and I raise it rather than silently fix it because this seat does not edit.

F3 — the published number can rise when reach is lost. O9: a src module whose last test import is deleted disappears from the table entirely rather than reading 0%, so the headline percentage is "reach among files the suite touched". This is precisely the shape of the ticket's grievance ("nothing would move numerically if a src file stopped being reached") surviving into phase 1. The body discloses it in full and assigns it to the floor ticket; my independent enumeration matches its list exactly. Accepted as disclosed scope, and the floor ticket inherits it (F1 tells that ticket how not to implement it).

F4 — no backdoor gate; and what protects the job instead. The diff is ci.yml alone, so nothing in it asserts job shape anywhere; I also checked the repo more broadly: the only in-repo reads of .github/workflows/ci.yml are prose comments and test/capture/capture-available.test.ts:670-700, which writes its own fixture workflow into a temp repo for capture-heuristic tests — no test or script anywhere reads the real workflow file. e2e/coverage.test.ts is the #241 structural gate (parses registrations vs @covers tags, boots no host), untouched. The body's refusal to add a ci.yml-shape assertion in e2e/ is correct for the stated reason: test:e2e runs inside the required smoke job, so such an assertion would make deleting the report-only job red through a required check — the deferred "make coverage block" decision smuggled in through the back. Given that, the protection against silent removal is honestly this: the Main ruleset requires a PR, one approving review, no force-push, no branch deletion — removal can only arrive as a diff line a human approves, and this review is part of the record making that line recognizable. There is no automatic guard, and by the owner's ruling there must not be one that gates.

State/surface matrix

Cell Surface Status
coverage job runs on PR events and prints All files Actions runner, this head covered — O5 (run 142418663877 log pulled by this seat)
Pre-existing jobs byte-identical git blob diff covered — O1
Pre-existing jobs still green Actions, head 7a19a35 covered — O5 check-runs API, 10/10
coverage absent from required checks ruleset API covered — O3
No threshold flag in the run command file grep + O4 covered — prose matches only
5 s default timeout; 20 s mirrors root script bun 1.4.4 --help; jq .scripts.test covered — O7
e2e/ fails without host CLI source (harness.ts throw, call sites) covered at code surface only; full e2e run out of seat budget, labelled as such
Timeout/failure kills publish? scratch probes, bun 1.4.4 covered — falsified (F2)
Threshold flag gating? scratch probe + full local run covered — no-op at pin (F1)
8 files absent from table comm over fd vs log rows covered — O9
Job behaviour on workflow_dispatch — uncovered — same steps as the PR event; not exercised manually
Text reporter writes no files job log + body's git status; reporter semantics covered — no artifact step; local run left tree clean (O4)

Claim-surface and prose audit

Added lines contain no issue refs, no dates, no review narration (lint:comments green corroborates). Promise verbs in added lines: publishes (measured on the Actions log, O5), never gate / deliberately absent (measured on the ruleset API, O3). The one claim that fails the surface test is the counterfactual in F2, which I measured on the surface that can see it (bun 1.4.4 behaviour) and found false; mechanism, not verdict.

Verdict

Approve. The ticket's frozen criterion — one report-only job publishing a percentage, never in required checks — is met and each half of "report-only" is measured on the surface that enforces it (O3, O4, O5). Nothing pre-existing was touched (O1) or weakened; pins follow the file's policy (O2). What remains true after merge, stated plainly so approval is not read as "coverage is reliable": the number is unit-suite reach only (O8); eight never-loaded files are invisible to it and the number can rise when reach is lost (F3); the run's totals drift with the environment within a fixed total (O6); nothing automatically prevents the job's silent removal beyond human review under the ruleset (F4); and the future floor ticket must not reach for --coverage-threshold at this bun pin (F1) — it should be filed with that fact attached, which is the one residual I could not file myself from this seat. F2's comment-mechanism sentence can ride a follow-up prose touch.

@abogartz
abogartz merged commit cd1e81a into main Dec 1, 2026
10 checks passed
@abogartz-opencode-self-improvement

Copy link
Copy Markdown

🎉 This PR is included in version 0.41.2 🎉

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.

No coverage measurement anywhere: add report-only bun test --coverage, then decide a floor

2 participants