Skip to content

chore: cleanup tests#1153

Open
0xeye wants to merge 15 commits into
mainfrom
chore/cleanup-tests
Open

chore: cleanup tests#1153
0xeye wants to merge 15 commits into
mainfrom
chore/cleanup-tests

Conversation

@0xeye

@0xeye 0xeye commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Restructure tests to only keep what matters: math, calculations, and safety-critical logic where bugs silently cost user funds or break navigation. All tests now live in src/test/, flat — no more 1:1 source tree mirroring.

54 test files removed, 15 kept (115 tests, all with human-verifiable expected values).

Why these tests were removed

When AI writes both the implementation and the tests, it validates its own assumptions against itself. When the implementation changes, the tests get rewritten to match, so they never actually catch anything. The only tests worth keeping are ones where a human verified the expected values independently.

Specific categories dropped:

  • UI/component tests (render, screen, @testing-library/react) — AI generates and updates these alongside the code, making them circular
  • Viewport/layout tests — Tailwind standardizes responsive breakpoints, so these are redundant by definition
  • Config assertions (app lists, chart styles, supported chains) — snapshot the current config; git diff does this better
  • Route/flow string mapping (deposit route, withdraw route) — input X returns string Y, both defined in the same file
  • Boolean flag logic (vault warnings, portfolio visibility, fetch enablement) — trivially restating the if-statement
  • Schema validation — the Zod schema is the spec; testing it parses valid input is tautological
  • Data selection/preference (staking source, strategy APY fallback) — "which field wins" with no independent ground truth
  • Balance partitioning — set/array routing that verifies the implementation agrees with itself
  • ABI/call construction mapping — source X maps to ABI Y, the reference is the expected value
  • Label/copy assertions — testing that label equals a string just tracks the current copy

What is kept

15 test files in src/test/:

Math and calculations:

  • APY/APR calculations (compound interest, Katana estimates, historical annualization)
  • Bigint share/asset conversions (yvUSD locked/unlocked, PPS-based valuation)
  • Price impact calculations (deposit valuation, wrapper share normalization)
  • Currency/percent formatting (locale-independent, rounding edge cases)
  • Duration math (cooldown seconds, day formatting)
  • Staking withdrawable asset fallback chain (error recovery touching user funds)

Safety-critical logic:

  • Transaction overlay state machine (permit auto-continue, completion deferral) — wrong state here skips steps or double-submits transactions
  • URL normalization and validation (Curve URL canonicalization, route matching, scheme rejection) — broken URLs can misdirect users to wrong pools or expose XSS vectors

CLAUDE.md updated

Testing section now instructs: prioritise math, save to src/test/, do not mirror source tree, do not test what AI will just adjust to match.

0xeye and others added 11 commits April 1, 2026 22:05
* feat: initial

* feat: round two

* feat: round three

* chore: update CLAUDE.md

* fix: price impact confirmation resets (#1124)

Replace remembered confirmation keys with keyed resettable state in the deposit and withdraw widgets.

This preserves the high-price-impact warning behavior without reintroducing a reset effect, so a user returning from quote B back to quote A must acknowledge the warning again.

---------

Co-authored-by: rossgalloway <58150151+rossgalloway@users.noreply.github.com>
* fix warning not showing correctly (#1117)

* fix TVL chart (#1118)

* update strategy APY fallback behavior (#1119)

* update modals for TGE (#1122)

* update modals for TGE

* update messaging

* update modal language

* Fix vault chain selection (#1123)

Keep the vault list aligned with the selected chain filter and\nmake chain switching behave consistently across the page.\n\n- apply selected-chain filtering to holdings in both V2 and V3\n  vault filters so other-chain rows do not leak into the list\n- reuse a single-chain selection helper for the top selector and\n  row chips so switching chains cannot drift into mixed states\n- add focused tests for selected-chain matching and single-chain\n  selection behavior

* Fix reflected XSS in /api/vault/meta endpoint (#1129)

Add strict allowlist validation for chainId and address query parameters
before they are interpolated into HTML. chainId must be numeric and
address must match the 0x-prefixed 40-char hex pattern, otherwise the
request is rejected with a 400. This prevents attackers from breaking
out of meta tag attribute contexts to inject arbitrary HTML/scripts.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Add strategy-level KAT rewards APR display (#1128)

* Add strategy-level KAT rewards APR display

- Schema: make estimated apr/apy optional (Kong hydration may set
  only apr for strategy-addressed rows), add katRewardsAPR component
- Selector: fall back to estimated.apr for katana strategies when
  estimated.apy is missing, extract katRewardsAPR from estimated type
- Strategy UI: show sword emoji indicator when strategy has KAT rewards
- Tests: cover katana strategy APR fallback and non-katana isolation

* fix: make KAT rewards additive on top of oracle APY with tooltip breakdown

- Selector: estimatedAPY now always falls through to oracle.apy for
  Katana strategies instead of using estimated.apr (which is KAT rewards)
- UI: strategy row shows combined APY (oracle + KAT rewards)
- UI: hover tooltip breaks down Base APY and KAT Rewards APR
- Tooltip follows existing pattern (rounded-lg border surface-secondary)
- Tests updated to reflect additive behavior

* fix: remove sword emoji from KAT rewards tooltip

* style: fix biome formatting

* fix kong selector

---------

Co-authored-by: JuniorDevBot <juniordevbot@yearn.fi>
Co-authored-by: Ross <therossgalloway@gmail.com>
Co-authored-by: rossgalloway <58150151+rossgalloway@users.noreply.github.com>

* init tenderly testnets

* add tenderly control panel

* create tenderly script

* refine tenderly vnet script defaults

* refine tenderly control panel state

* simplify tenderly control panel

* harden tenderly vnet script

* fix simulate wrapper typing

* fix cooldown to use block time

* gate tenderly admin routes and validate config

* use request IP for tenderly admin access

* fix tenderly approval and ens config

* fix tenderly loopback and env bootstrap

* treat failed tenderly reverts as errors

* fix tenderly chain identity mapping

* fix tenderly snapshot reset and localhost forks

* keep codex agent log local

* update gitignore

* separate canonical and execution chain lists

* fix localhost aliasing and explorer defaults

* keep canonical chains in wagmi config

* preserve mainnet wagmi transport

* fix tenderly execution boundary leaks

* Fix locked yvUSD historical PPS and APY normalization (#1133)

* update locked APY and PPS timeseries values to reflect actual conditions

* review fix

* Fix yvUSD historical PPS handling

Preserve missing historical PPS values instead of collapsing them to zero.\n\n- Keep weekly and monthly PPS lookbacks nullable in Kong vault APR data\n- Reuse yvUSD chart-derived historical APY in portfolio blending\n- Align portfolio and chart history so partial snapshot PPS data does\n  not produce bogus locked APY values

* fix tenderly wagmi chain exposure

* fix biome import ordering

* update env.example

---------

Co-authored-by: murderteeth <89237203+murderteeth@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: juniordevbot[bot] <170848020+juniordevbot[bot]@users.noreply.github.com>
Co-authored-by: JuniorDevBot <juniordevbot@yearn.fi>
* add link to API

* add docs link to more info
…pdates (#1132)

Bumps the minor-updates group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@tanstack/react-query](https://github.com/TanStack/query/tree/HEAD/packages/react-query) | `5.90.21` | `5.95.0` |
| [framer-motion](https://github.com/motiondivision/motion) | `12.34.0` | `12.38.0` |
| [graphql](https://github.com/graphql/graphql-js) | `16.12.0` | `16.13.1` |
| [viem](https://github.com/wevm/viem) | `2.46.1` | `2.47.6` |
| [@tailwindcss/postcss](https://github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/@tailwindcss-postcss) | `4.1.18` | `4.2.2` |
| [lint-staged](https://github.com/lint-staged/lint-staged) | `16.2.7` | `16.4.0` |
| [tailwindcss](https://github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/tailwindcss) | `4.1.18` | `4.2.2` |



Updates `@tanstack/react-query` from 5.90.21 to 5.95.0
- [Release notes](https://github.com/TanStack/query/releases)
- [Changelog](https://github.com/TanStack/query/blob/main/packages/react-query/CHANGELOG.md)
- [Commits](https://github.com/TanStack/query/commits/@tanstack/react-query@5.95.0/packages/react-query)

Updates `framer-motion` from 12.34.0 to 12.38.0
- [Changelog](https://github.com/motiondivision/motion/blob/main/CHANGELOG.md)
- [Commits](motiondivision/motion@v12.34.0...v12.38.0)

Updates `graphql` from 16.12.0 to 16.13.1
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](graphql/graphql-js@v16.12.0...v16.13.1)

Updates `viem` from 2.46.1 to 2.47.6
- [Release notes](https://github.com/wevm/viem/releases)
- [Commits](https://github.com/wevm/viem/compare/viem@2.46.1...viem@2.47.6)

Updates `@tailwindcss/postcss` from 4.1.18 to 4.2.2
- [Release notes](https://github.com/tailwindlabs/tailwindcss/releases)
- [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/tailwindlabs/tailwindcss/commits/v4.2.2/packages/@tailwindcss-postcss)

Updates `lint-staged` from 16.2.7 to 16.4.0
- [Release notes](https://github.com/lint-staged/lint-staged/releases)
- [Changelog](https://github.com/lint-staged/lint-staged/blob/main/CHANGELOG.md)
- [Commits](lint-staged/lint-staged@v16.2.7...v16.4.0)

Updates `tailwindcss` from 4.1.18 to 4.2.2
- [Release notes](https://github.com/tailwindlabs/tailwindcss/releases)
- [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/tailwindlabs/tailwindcss/commits/v4.2.2/packages/tailwindcss)

---
updated-dependencies:
- dependency-name: "@tanstack/react-query"
  dependency-version: 5.95.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-updates
- dependency-name: framer-motion
  dependency-version: 12.38.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-updates
- dependency-name: graphql
  dependency-version: 16.13.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-updates
- dependency-name: viem
  dependency-version: 2.47.6
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-updates
- dependency-name: "@tailwindcss/postcss"
  dependency-version: 4.2.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: minor-updates
- dependency-name: lint-staged
  dependency-version: 16.4.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: minor-updates
- dependency-name: tailwindcss
  dependency-version: 4.2.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: minor-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps-dev): bump @types/node from 20.19.10 to 25.3.0

* chore(deps-dev): update bun.lock for @types/node bump

---------

Co-authored-by: Ross <therossgalloway@gmail.com>
KEEP (12 files) — real math/calculations:
  1. strategiesPercentFormat.test.ts — percent rounding rules
  2. format.test.ts — locale-aware currency formatting
  3. vaultApy.test.ts — APY/APR compound interest math
  4. useVaultApyData.test.ts — Katana APR computation
  5. valuation.test.ts — deposit value, price impact %
  6. cooldownUtils.test.ts — duration/time math
  7. yvUsd.test.ts — weighted APY, PPS conversions, APR annualization, bigint math
  8. useYvUsdCharts.helpers.test.ts — PPS series, APY derivation
  9. YvUsdWithdraw.helpers.test.ts — share/asset bigint conversions
  10. useYvUsdVaults.helpers.test.ts — TVL breakdown math
  11. kongVaultSelectors.test.ts — pricePerShare conversion, APY selection
  12. useVaultFilterUtils.test.ts — USD valuation from pricePerShare
@0xeye 0xeye requested a review from rossgalloway April 1, 2026 21:26
@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 1a06b57.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@vercel

vercel Bot commented Apr 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
yearnfi Error Error May 16, 2026 4:08pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
yearnfi-nextjs Ignored Ignored Preview May 16, 2026 4:08pm

Request Review

@0xeye 0xeye changed the base branch from main to release/04-01-26 April 1, 2026 21:59
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Base automatically changed from release/04-01-26 to main April 3, 2026 13:00
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.

2 participants