Skip to content

chore(coverage): add @vitest/coverage-v8 + per-package baseline measurement - #30

Merged
Hiksang merged 2 commits into
mainfrom
chore/coverage-baseline
May 8, 2026
Merged

Hiksang merged 2 commits into
mainfrom
chore/coverage-baseline

Conversation

@Hiksang

@Hiksang Hiksang commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Adds @vitest/coverage-v8 workspace dev-dep and pnpm test:coverage script to record per-package baseline coverage. Output goes to gitignored coverage/ dirs.

🤖 Generated with Claude Code

Hiksang added 2 commits May 5, 2026 19:42
…rement

P2 follow-up tracked in qa/2026-05-05-test-foundation. Establishes a
quantitative coverage baseline so the next QA cycle can pick targets
data-driven instead of guessing.

Tooling changes:
- ts/package.json: add @vitest/coverage-v8 ^3.0.0 (vitest official
  dev dep; npmjs.com/package/@vitest/coverage-v8). User-approved per
  SSOT Section 3.
- ts/package.json: add `test:coverage` script that delegates to each
  workspace's own vitest run. Single root invocation reads 0% line
  coverage because the workspace dist alias intercepts source imports;
  per-package execution sees the actual src files.
- ts/vitest.config.ts: workspace-package src aliases (used by future
  cross-package tests; root coverage path is preferred per-package).
- packages/{defi-core,defi-protocols,defi-cli}/vitest.config.ts:
  per-package coverage block (provider=v8, text-summary reporter).
- .gitignore: ts/coverage/ + ts/packages/*/coverage/.

Baseline measurement (main @ ae5bb65):

| package         | lines | covered | %      |
|-----------------|------:|--------:|-------:|
| defi-core       |   399 |     261 | 65.4%  |
| defi-protocols  |  5976 |    5880 | 98.4%  |
| defi-cli        |  6299 |     961 | 15.3%  |
| **monorepo**    | 12674 |    7102 | 56.0%  |

Headlines:
1. defi-cli at 15.3% — 5338 of 6299 lines never executed by the
   current test suite. CLI command handlers (commands/lp.ts,
   commands/lending.ts, commands/swap.ts, ...) are mostly untested.
   This is the next-cycle P0 target.
2. defi-protocols statements 98.4% / functions 9.1% (1 of 11). The
   functions count under-reports because v8's provider only counts
   module-level functions, not adapter-class instance methods. The
   high statements % is real — module loading evaluates most adapter
   files — but branches at 27.8% reveals that conditional paths
   (e.g. cl_style switches, useTickSpacingQuoter) are largely
   untested.
3. defi-core 65.4% lines / 78.9% functions — the most balanced
   surface, fits the small-utility shape.

Full report: docs/qa-reports/2026-05-05-coverage-baseline.md.

Verified: monorepo build/test/lint clean — 79/79 tests pass on
host (defi-core 32 + defi-protocols 18 + defi-cli 29; the defi-protocols
delta vs PR #3 is because that PR is not yet merged here).

Refs: P2 in docs/qa-reports/2026-05-05-test-foundation.md follow-ups.
@Hiksang
Hiksang merged commit 4824651 into main May 8, 2026
3 checks passed
@Hiksang
Hiksang deleted the chore/coverage-baseline branch May 8, 2026 11:57
Hiksang added a commit that referenced this pull request May 8, 2026
…ion + adapter fixes (#32)

* build: regenerate dist + sync prebuild package configs for v1.0.13

Re-runs `pnpm -r build` from current main HEAD and syncs the package-
local config mirror so npm-published artifacts match the source tree.

Reason: across PRs #23 / #26 / #27 we resolved dist conflict markers
by taking main's stale dist (`git checkout --theirs`) — that kept the
PRs mergeable but left committed dist files out of sync with the
post-merge source. This single rebuild commit reconciles them.

Affected:
  defi-cli/dist/{index,main,mcp-server}.js  (~+700 lines source-derived)
  defi-cli/dist/*.map
  defi-protocols/dist/{index.js, index.d.ts, *.map}
  defi-core/dist/{index.d.ts, *.map}
  defi-cli/config/protocols/lending/venus_flux_bnb.toml
    (prebuild sync from workspace root: vusdt → vlisusd rename)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Release v1.0.13: bridge feature + production-grade verification + adapter fixes

Highlights since v1.0.12 (30 commits across 8 PRs):

== Bridge feature complete ==
- Relay added as 4th provider (~3s native bridge, executor-wired live)
- LiFi + deBridge + CCTP wired to Executor — `--broadcast` no longer silently ignored
- CCTP V2 `--auto-receive` — burn → poll Iris attestation → auto-receiveMessage on dest
- Live-verified Base→Arbitrum 0.1 USDC E2E (burn 0x6b5d41fd, receive 0x9b5bd5c2)
- Per-chain src/dst token resolution for cross-chain stables
- Relay errorCode parsing → actionable hints (AMOUNT_TOO_LOW, NO_QUOTES, etc)
- MCP `defi_bridge` 3 latent fixes: dst-token, Relay symbol→native, LiFi fromAddress

== Adapter bug fixes ==
- compound_v2: uint256.max withdraw + outstanding-borrow guard (Venus, Compound V2 forks)
- venus-flux-bnb: rename mislabeled `vusdt` → `vlisusd` (actual underlying is lisUSD)
- Ramses CL mint encoding + MerchantMoe/TraderJoe LB token-order realign
- Curve target the pool not router + StableswapNG dynamic uint256[] ABI
- uniswap-v2 / solidly LP-token approval on remove
- Hybra V4 --redeem-type CLI flag for instant-exit vs 2-year veHYBR lock
- Aave V3 collateral toggle + eMode for borrow lifecycle (#21)
- Morpho marketId-based supply/borrow + supplyCollateral (#22)
- Compound V2 enterMarkets toggle for Venus borrow lifecycle (#26)
- Native wrap/unwrap CLI + Morpho marketId registry + max-repay-by-shares (#27)

== Production-grade verification sweep ==
- HyperEVM 11/11 protocols full lifecycle (emission tokens received)
- Mantle: Aave V3 + UniV3 + MerchantMoe LB (MOE 1.009 received)
- Base: UniV3 + Aerodrome V2 + Aerodrome CL (AERO emission received)
- BNB upgraded to 🟢 production: 13/16 protocols verified live
- Monad partial: UniV3 + UniV2 (mainnet TBD for the rest)
- ve(3,3) emission tokens live-received: RAM, KITTEN, MOE, AERO, THE
- ULTRAQA sandbox script (51-test sweep across 4 chains)

== Hardening ==
- ip-address >=10.1.1 via pnpm.overrides (GHSA-v2v4-37r5-5v8g moderate XSS)
- viem wallet/public clients anchored to chainId at construction (#29)
- CLI handler unit-test coverage for status/schema (#28)
- @vitest/coverage-v8 baseline measurement script (#30)
- post-baseline test-foundation QA report (#31)

== Test plan ==
- pnpm -r test: 189/189 pass (defi-core 32, defi-protocols 55, defi-cli 102)
- pnpm -r build: clean across all 3 packages
- pnpm audit: 0 vulnerabilities
- ULTRAQA sandbox: 51/51 pass + 8/8 ve(3,3) lp pipeline
- CCTP --auto-receive E2E: live broadcast verified
- MCP defi_bridge smoke: LiFi USDC + Relay USDC + Relay native — all OK

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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