Skip to content

test: guard what the handlers claim and what the entry costs - #57

Merged
skjnldsv merged 1 commit into
mainfrom
test/coverage-and-bundle-guards
Sep 21, 2026
Merged

skjnldsv merged 1 commit into
mainfrom
test/coverage-and-bundle-guards

Conversation

@skjnldsv

Copy link
Copy Markdown
Contributor

Two checks that stop a gap reopening, rather than tests of anything new.

What the handlers claim

Reads the mime lists straight out of the models and asserts each one is opened by a test. A claim nobody exercises is how the audio handler ended up offering eleven types while a single fixture sat in the playground that no spec ever touched.

Types that cannot be covered from the playground are listed with a reason, and the list is guarded in both directions: an excuse for a type no longer claimed fails, and so does an excuse for a type some test does open. So the excuses have to be argued for rather than inherited.

It found three things on its first run, which is the best argument for it:

  • video/webm was claimed and untested. There was a webm fixture, but it was audio.
  • audio/aac was claimed and untested. The m4a fixture is audio/mp4, a different type.
  • image/apng was excused because the server has no .apng mapping. That is true and it is a different concern: the playground proves the handler renders one, and whether an upload ever arrives as that mime belongs to the server suite. Excuse removed.

Both gaps now have fixtures, and a small video spec to open them.

What the entry costs

check-bundle-size.mjs already walked the static graph with a gzip budget and a list of chunks that must stay lazy. It stopped at the package boundary: it only followed relative specifiers, so import 'konva' at the top level would have sailed through.

That is the mistake most likely to be made here, and it has come close twice. The editor sits behind defineAsyncComponent and the score renderer behind an import inside its own component, and until now nothing checked either arrangement. Two megabytes on every Files page is a bad way to find out.

dependencies: @nextcloud/capabilities, @nextcloud/files, @nextcloud/l10n/gettext, @nextcloud/logger, vue
Within budget.

I checked it fails rather than assuming: importing opensheetmusicdisplay at the top of lib/index.ts makes it exit 1 and name the package.

One thing worth saying: I wrote a second script for this before noticing the existing one did most of it. Deleted, and the check went where it belonged.

378 unit, 86 e2e.

👾 This pull request was assisted by Claude Code, commits carry an Assisted-by trailer.

Two checks that keep a gap from reopening rather than testing anything
new.

The first reads the mime lists out of the handlers and asserts each one
is opened by a test. A claim nobody exercises is how the audio handler
came to offer eleven types with a fixture that no spec touched. Types
that cannot be covered from the playground are listed with a reason, and
the list is guarded both ways: an excuse for a type no longer claimed
fails, and so does an excuse for a type a test does open.

It found three things on its first run. video/webm and audio/aac were
claimed and untested, so both have fixtures now. And image/apng was
excused on the grounds that the server has no mapping for the extension,
which is true and is a different concern: the playground proves the
handler renders one, and whether an upload ever arrives as that mime
belongs to the server suite.

The second extends the size check to dependencies. It walked this
library's own chunks and stopped at the package boundary, so konva or
the score renderer imported at the top level would have passed it. Both
have come close: the editor is behind an async component and the
renderer behind an import inside its component, and neither arrangement
was checked by anything.

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv skjnldsv added status: review Waiting for reviews type: tests 🧪 Tests related issue or changes AI assisted labels Sep 21, 2026
@codecov

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.62%. Comparing base (9eaac8e) to head (a078daf).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #57   +/-   ##
=======================================
  Coverage   88.62%   88.62%           
=======================================
  Files          39       39           
  Lines        2743     2743           
  Branches      561      561           
=======================================
  Hits         2431     2431           
  Misses        305      305           
  Partials        7        7           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@skjnldsv
skjnldsv merged commit e2333e0 into main Sep 21, 2026
18 checks passed
@skjnldsv
skjnldsv deleted the test/coverage-and-bundle-guards branch September 21, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted status: review Waiting for reviews type: tests 🧪 Tests related issue or changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant