Skip to content

ci: report coverage on each pr, and drop tests other tests already cover - #4

Merged
aripiprazole merged 2 commits into
mainfrom
ci/coverage
Oct 14, 2026
Merged

aripiprazole merged 2 commits into
mainfrom
ci/coverage

Conversation

@aripiprazole

Copy link
Copy Markdown
Collaborator

Purpose

Coverage. bunfig.toml turns on Bun's built-in coverage for every test run. It prints a table and writes coverage/lcov.info, and skips tests/. CI saves the table from bun run check, adds it to the job summary, and keeps a single comment on each PR up to date with it. Bun reports functions and lines only, with no branch coverage.

Drop tests other tests already cover. Each of the 121 tests ran alone to record which src/ lines it reaches. A greedy pass then removed the tests whose lines the remaining tests also reach, within a half-point line-coverage budget. 45 tests go, along with the imports and helpers only they used.

before (main) after
tests 121 76
test lines −1,305
lines 75.51% 75.01%
functions 75.90% 73.88%

The budget only counted lines, so function coverage falls further, by 2 points.

Kept regardless of coverage:

  • Tests of credentials and tokens, and of never running anything locally.
  • Approvals and answers (scope, deny, who may decide), refusals, and unconfirmed sends.
  • All 8 real-terminal tests. Coverage alone would remove every one of them, and with them the Python requirement, but they're the only tests that drive Pi through a terminal.
  • Two tests that fail when run alone (see below).

Removed: mostly rendering, streaming, history paging and settings tests whose lines other tests also reach, such as the inbox labels, roster ordering, transcript ordering and reconnect replay. Their specific assertions are lost even though the lines still run.

Found while measuring:

  • Two tests depend on tests that run before them. Each fails every time it runs alone:
    • names authors from members and closes with Enter throws Theme not initialized.
    • reopening keeps every message, including ones sent mid-turn gets different entries.
  • On main, one full run out of four had a test failure.

Verification

All with Bun 1.4.2 from the Nix shell:

  • bun run check passes: Biome, ESLint, tsc, 76 of 76 tests, and the build.
  • The coverage table above comes from that run. The "before" column comes from the same command on main.
  • The CI step's grep extracts exactly the table from bun run check's output.
  • tsc --noUnusedLocals shows nothing newly unused. The one remaining hit, input in tests/interactions.test.ts, was already unused on main.

bunfig.toml has every test run report how much of src/ it ran, as a
table and as coverage/lcov.info. CI keeps the table from bun run check,
shows it in the job summary, and keeps one comment on the pull request
up to date with it.
Each test ran alone to see which src lines it reaches. 45 of 121 reach
none that the rest do not, within half a point of line coverage. They
go, with the imports and helpers only they used.

Kept whatever their lines: tests of credentials and tokens, local
execution, approvals and answers, refusals and unconfirmed sends, the
real terminal tests, and two tests that fail when run alone.
@github-actions

Copy link
Copy Markdown

Coverage

-------------------------|---------|---------|-------------------
File                     | % Funcs | % Lines | Uncovered Line #s
-------------------------|---------|---------|-------------------
All files                |   73.91 |   74.88 |
 src/api.ts              |   82.61 |   97.27 | 267-272,299-303,485-486,493-494,508
 src/config.ts           |   96.00 |   98.86 | 87-89
 src/drawers.ts          |   37.50 |    8.13 | 29-37,57-77,80-88,92-237,241-315
 src/errors.ts           |   87.50 |   87.93 | 97-103
 src/index.ts            |   37.25 |   36.49 | 115-118,165-190,199-204,222,224-229,233-238,258-260,320-324,328,349-350,355-363,365-366,369,383,385-409,446-457,460,465-485,488,493-506,511-517,521-528,549-562,573-574,586-588,595-617,621-641,644-670,673-696,701-768,774-797,811-813,826-836,843,846-847,851,860-868,879-982,987-1023,1027-1029,1045,1050-1057,1063-1066,1078-1079,1082-1083,1088-1089,1120,1124-1126,1131-1132,1135-1136,1139-1148,1151-1156,1160-1181,1184-1189,1192-1194,1197-1206,1209-1224,1231-1244,1248-1263,1266-1272,1297-1313,1322-1325,1330-1334,1336-1341,1343-1347,1349,1355,1366-1374,1378-1384,1388-1407,1411-1422,1425-1428,1431-1438,1443-1454,1475-1477,1480-1482,1492-1497
 src/interactions.ts     |   92.86 |   99.27 | 234-236
 src/render.ts           |   86.11 |   91.34 | 69,72-74,159,188,194,201,204-209,216,232-236,414-415,548-553,571-575,594,661-665,672,678,683-687
 src/runtime.ts          |  100.00 |   97.44 | 14
 src/session.ts          |   83.56 |   91.42 | 292,389-391,488-508,736-738,744-756,792-799,827-829
 src/status.ts           |   79.17 |   85.40 | 166-171,174,278-303
 src/tools.ts            |   94.12 |   84.15 | 113,122-126,128,227-253,279-283
 src/workspace/api.ts    |   82.02 |   84.90 | 168-169,195,214-218,244-248,252-266,270-283,287-301,305-318,323-336
 src/workspace/files.ts  |    0.00 |    4.71 | 23-35,40-49,54-60,66-78,82-112,117-177,181-220,229-277,282-320,325-344
 src/workspace/schema.ts |  100.00 |  100.00 | 
 src/workspace/socket.ts |   92.00 |   98.43 | 136-137,182-183,295
 src/workspace/ui.ts     |   11.11 |    7.57 | 19-29,33-46,60-199,217-229,233-252,261-367,372-408
 src/workspace/view.ts   |   94.70 |   99.74 | 1085,1177,1346
-------------------------|---------|---------|-------------------

@aripiprazole
aripiprazole added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit 0eed708 Oct 14, 2026
2 checks passed
@aripiprazole
aripiprazole deleted the ci/coverage branch October 14, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant