feat(canvas): vitest coverage instrumentation (#1815, no CI gate yet) - #2147
Merged
HongmingWang-Rabbit merged 1 commit intoApr 27, 2026
Merged
Conversation
[Molecule-Platform-Evolvement-Manager] Closes step 1+2 of #1815. Step 3 (CI gate + threshold) is split into a follow-up because today's baseline is ~46% lines / ~45% statements, not the 70% the issue's draft thresholds assumed. ## What this lands - `canvas/vitest.config.ts` — `coverage` block with v8 provider, reporters: text (terminal) / html (./coverage/index.html) / json-summary (machine-readable for tooling). NO threshold — pure observability. - `canvas/package.json` — adds `test:coverage` script (`vitest run --coverage`); existing `test` script is unchanged so the default workflow is identical. - `canvas/package-lock.json` — adds @vitest/coverage-v8@^4.1.5 (the v8 provider Vitest uses for native coverage). ## Why no threshold yet Issue draft threshold was 70%/70%/65%/70% (lines/funcs/branches/stmts). Local baseline today: ``` Statements : 45.19% (3248/7186) Branches : 39.87% (2034/5101) Functions : 40.99% (724/1766) Lines : 46.36% (2905/6265) ``` Turning on a 70% gate today would either fail CI immediately or get papered over with an ad-hoc exclude list. Better path: land observability now, run coverage in PR review for any new code (via the new script), gate later when the baseline catches up. ## Heatmap (from local run, top gaps) - `src/lib/runtime-names.ts` — 0% (untouched by tests) - `src/lib/utils.ts` — 0% - `src/lib/canvas-actions.ts` — 25% - `src/store/classNames.ts` — 17% - `src/store/canvas.ts` — 73% (already-tested but the largest absolute gap by lines) Each is a concrete follow-up issue / PR target. ## Test plan - [x] `npx vitest run --coverage` runs cleanly locally (~10s) and produces `./coverage/index.html` + a `coverage-summary.json` - [x] Existing `npm run test` workflow unchanged — instrumentation only activates with `--coverage` flag - [x] No production-code changes — pure tooling addition ## Follow-ups (each tracked separately; this PR keeps minimal scope) - Step 3a — write tests for the 0% files above (~tiny each) - Step 3b — once baseline ≥ thresholds, add `thresholds` block to vitest.config.ts + a `npm run test:coverage` step in `.github/workflows/ci.yml`'s Canvas job 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
HongmingWang-Rabbit
requested a review
from hongmingwang-moleculeai
as a code owner
April 27, 2026 06:44
HongmingWang-Rabbit
enabled auto-merge
April 27, 2026 06:44
This was referenced Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Molecule-Platform-Evolvement-Manager]
Closes step 1+2 of #1815. Step 3 (CI gate + threshold) is split into a follow-up because today's baseline is ~46% lines / ~45% statements, not the 70% the issue's draft thresholds assumed.
What this lands
Why no threshold yet
Issue's draft threshold was 70%/70%/65%/70%. Local baseline today:
```
Statements : 45.19% (3248/7186)
Branches : 39.87% (2034/5101)
Functions : 40.99% (724/1766)
Lines : 46.36% (2905/6265)
```
Turning on a 70% gate today would fail CI immediately or get papered over with an ad-hoc exclude list. Better path: land observability now, gate later.
Top gaps (from local run)
Each is a concrete follow-up.
Test plan
Follow-ups (separate PRs)
🤖 Generated with Claude Code