Commit graph

10 commits

Author SHA1 Message Date
openhands
cd459bb9b0 fix: correct buyKrk call sites for new opts param, add eslint-disable for polling loop
- no-dilution.spec.ts: pass undefined for opts, screenshotPrefix as 4th arg
- swap.ts: add eslint-disable-next-line for eth_getFilterLogs polling delay
2026-03-05 05:53:19 +00:00
openhands
f214ac8587 fix: address PR #437 review findings
- Fix price impact formula: (10000n - ...) instead of (1n - ...)
- Extract ETH_AMOUNT constant in always-leave to avoid duplication
- Add screenshotPrefix param to buyKrk for unique screenshot paths
2026-03-05 05:51:08 +00:00
openhands
c25c757024 feat(holdout): add passive-confidence/no-dilution scenario
Verifies that passive holders are not diluted when new buyers enter.

- Two wallets (Anvil accounts 4 & 5) buy KRK sequentially
- First buyer's balance must remain unchanged after second buy
- Second buyer receives fewer tokens per ETH due to AMM price impact
- Tests core protocol invariant: holding KRK does not dilute position
2026-03-05 05:51:03 +00:00
openhands
69f6a87e20 Move holdout scenarios to separate repo
- Updated holdout.config.ts to use HOLDOUT_SCENARIOS_DIR env var
- Modified evaluate.sh to clone harb-holdout-scenarios repo at runtime
- Deleted scripts/harb-evaluator/scenarios/ directory
- Added .holdout-scenarios/ to .gitignore
- Holdout scenarios are now cloned into .holdout-scenarios/ during evaluation
- This prevents dev-agent from seeing the holdout test set
2026-03-04 08:20:11 +00:00
openhands
74a043262d feat(holdout): Add reasonable slippage assertion to always-leave scenario
- Modified sellAllKrk helper to return WETH delta received
- Added assertion: WETH received >= 90% of ETH spent (0.09 ETH minimum)
- Added log showing actual slippage percentage
- This proves 'always leave' with reasonable slippage, not just exit ability
2026-03-03 19:45:46 +00:00
openhands
d0a3bdecdc feat: Shared holdout scenario test helpers (#401)
Extract reusable helpers from sovereign-exit/always-leave.spec.ts into
three focused modules under scripts/harb-evaluator/helpers/:

- helpers/wallet.ts: connectWallet, disconnectWallet, getEthBalance,
  getKrkBalance — UI connect/disconnect flow and on-chain balance reads.

- helpers/swap.ts: buyKrk (navigates to the real /app/get-krk page and
  drives the LocalSwapWidget, now that #393 fill() fix is in), sellAllKrk
  (approve + exactInputSingle via window.ethereum, no UI dependency).

- helpers/assertions.ts: expectBalanceIncrease (snapshot/action/assert
  pattern for any token or ETH), expectPoolHasLiquidity (slot0 + liquidity
  sanity check on a Uniswap V3 pool).

always-leave.spec.ts is refactored to use these helpers and to navigate
to /app/get-krk instead of the /app/cheats workaround introduced before
the #393 fix landed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 05:21:24 +00:00
openhands
13249613c0 address review: fix stale JSDoc, correct comments, remove redundant dispatchEvent 2026-03-01 19:11:43 +00:00
openhands
6489dc4896 fix: holdout scenario - use cheats page swap widget, match e2e wallet connection pattern
- Switch from account 5 to account 0 (matches e2e tests)
- Use cheats page (/app/cheats) instead of get-krk (/app/get-krk) -
  get-krk swap widget has v-model reactivity issue with Playwright fill()
- Match e2e/01 wallet connection pattern with mobile fallback
- Add debug screenshots for swap widget diagnosis
- Use getByLabel/getByRole selectors matching e2e patterns
2026-03-01 15:41:45 +00:00
openhands
cce3c92120 fix: address review feedback on holdout evaluator (#381)
- evaluate.sh: add --ignore-scripts to npm install (prevents husky from
  writing to permanent repo .git/hooks from the ephemeral worktree)
- evaluate.sh: change --silent to --quiet (errors still printed on failure)
- evaluate.sh: add `npx playwright install chromium` step so browser
  binaries are present even when the cached revision doesn't match ^1.55.1
- evaluate.sh: set CI=true inline on the playwright invocation so
  forbidOnly activates and accidental test.only() causes a gate failure
- holdout.config.ts: document that CI=true is supplied by evaluate.sh
- always-leave.spec.ts: add waitForReceipt() helper; replace fixed
  waitForTimeout(2000) after eth_sendTransaction with proper receipt
  polling so tx confirmation is not a timing assumption
- always-leave.spec.ts: log the caught error in the button-cycling
  try/catch so contract reverts surface in the output
- always-leave.spec.ts: add console.log when connect button or connector
  panel is not found to make silent-skip cases diagnosable

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 12:04:35 +00:00
openhands
2ddd8e9ed2 fix: Holdout evaluator: Playwright browser-based scenario scripts (#381)
Replace shell-script scenario runner with Playwright. The evaluator now
runs `npx playwright test --config scripts/harb-evaluator/holdout.config.ts`
after booting the stack, using the existing tests/setup/ wallet-provider
and navigation infrastructure.

Changes:
- scripts/harb-evaluator/holdout.config.ts — new Playwright config pointing
  to scenarios/, headless chromium, 5-min timeout per test
- scripts/harb-evaluator/scenarios/sovereign-exit/always-leave.spec.ts —
  Playwright spec that buys KRK through the LocalSwapWidget then sells it
  back via the injected wallet provider, asserting sovereign exit works
- scripts/harb-evaluator/evaluate.sh — adds root npm install step (needed
  for npx playwright), exports STACK_* env aliases for getStackConfig(),
  replaces shell-script loop with a single playwright test invocation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 11:24:15 +00:00