Commit graph

547 commits

Author SHA1 Message Date
openhands
47174c3dfe fix: ENVIRONMENT.md documents contracts.env with VITE_ prefixes that do not match the actual file (#386)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 01:21:48 +00:00
johba
afcf13bc84 Merge pull request 'fix: tests/setup/navigate.ts: bare 500ms timeout after pushState is fragile under CPU pressure (#390)' (#417) from fix/issue-390 into master 2026-03-03 02:13:27 +01:00
openhands
f53e245f0e fix: tests/setup/navigate.ts: bare 500ms timeout after pushState is fragile under CPU pressure (#390)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 00:45:27 +00:00
openhands
326d026794 fix: tests/setup/navigate.ts: bare 500ms timeout after pushState is fragile under CPU pressure (#390)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 00:20:47 +00:00
johba
b8d0e07fd2 Merge pull request 'fix: getByRole('button', { name: 'Buy' }).last() fragility is duplicated across e2e/01 and this scenario (#398)' (#414) from fix/issue-398 into master 2026-03-03 01:11:00 +01:00
openhands
ed5db3b000 fix: use toHaveText to correctly await swap completion after testId migration
getByTestId('swap-buy-button').waitFor({ state: 'visible' }) resolved
immediately because the button is always rendered; only its text changes.
Replace with expect(...).toHaveText('Buy KRK', { timeout: 60_000 }) to
correctly gate on the button returning to its idle state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 23:47:53 +00:00
openhands
68601c255a fix: getByRole('button', { name: 'Buy' }).last() fragility is duplicated across e2e/01 and this scenario (#398)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 23:13:05 +00:00
johba
10643618f7 Merge pull request 'fix: tests/setup/stack.ts: contract addresses have no env var override path (#391)' (#411) from fix/issue-391 into master 2026-03-03 00:04:04 +01:00
openhands
c9fe1ab178 fix: tests/setup/stack.ts: contract addresses have no env var override path (#391)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 22:34:44 +00:00
openhands
0fe098ddc3 fix: tests/setup/stack.ts: contract addresses have no env var override path (#391)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 22:01:49 +00:00
johba
b1c2e4aff8 Merge pull request 'fix: cleanup: Remove swap functionality from cheats page after #393 fix (#400)' (#410) from fix/issue-400 into master 2026-03-02 08:57:03 +01:00
openhands
7296852d0e fix: migrate test 02 swap to get-krk page; add VITE_ENABLE_LOCAL_SWAP to CI
- Update 02-max-stake-all-tax-rates.spec.ts to buy KRK via /app/get-krk
  instead of the removed cheats-page swap card
- Add VITE_ENABLE_LOCAL_SWAP=true to the webapp CI service so
  LocalSwapWidget renders in the e2e pipeline

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 07:23:31 +00:00
openhands
3c377c84e8 ci: retrigger after infra failure 2026-03-02 06:43:47 +00:00
openhands
f612090eeb fix: cleanup: Remove swap functionality from cheats page after #393 fix (#400)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 06:32:48 +00:00
johba
be68018290 Merge pull request 'fix: feat: Shared holdout scenario test helpers (#401)' (#405) from fix/issue-401 into master 2026-03-02 07:24:24 +01:00
openhands
77a229018a fix: address review feedback on holdout helpers
- Extract rpcCall into helpers/rpc.ts to eliminate the duplicate copy
  in wallet.ts and assertions.ts (warning: code duplication)

- Fix waitForReceipt() in swap.ts to assert receipt.status === '0x1':
  reverted transactions (status 0x0) now throw immediately with a clear
  message instead of letting sellAllKrk silently succeed and fail later
  at the balance assertion (bug)

- Add screen.width debug log to connectWallet() before the isVisible
  check, restoring the regression signal from always-leave.spec.ts (warning)

- Fix expectPoolHasLiquidity() to only assert sqrtPriceX96 > 0 (pool
  is initialised); drop the active-tick liquidity() check which gives
  false negatives when price moves outside all LiquidityManager ranges
  after a sovereign exit (warning)

- Add WETH balance snapshot before/after the swap in sellAllKrk() and
  log a warning when WETH output is 0, making pool health degradation
  visible despite amountOutMinimum: 0n (warning)

- Add before/after screenshots in buyKrk() (holdout-before-buy.png,
  holdout-after-buy.png) to restore CI debugging artefacts (nit)

- Move waitForTimeout(2_000) settle buffer in buyKrk() to the catch
  path only; when the Submitting→idle transition is observed the extra
  wait is redundant (nit)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 05:59:21 +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
johba
71218464c0 Merge pull request 'fix: bug: Desktop Connect button never renders at 1280px width (#399)' (#402) from fix/issue-399 into master 2026-03-02 06:04:24 +01:00
openhands
0675694779 fix: bug: Desktop Connect button never renders at 1280px width (#399)
Replace screen.width with window.innerWidth in useMobile composable.
screen.width reports the physical screen size (0 in headless Chromium),
while window.innerWidth reflects the actual viewport — the correct metric
for responsive layout. The previous Object.defineProperty workaround in
wallet-provider.ts could not override the native Screen.prototype getter,
so screen.width remained 0, isMobile stayed true, and ConnectButton was
never rendered. Fix wallet-provider.ts to pass viewport/screen options
directly to browser.newContext() and remove the broken init-script shim.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 04:35:51 +00:00
johba
e9abea2307 Merge pull request 'fix: holdout scenario - use cheats page swap widget, match e2e wallet connection pattern' (#392) from fix/holdout-scenario-swap into master 2026-03-01 21:00:09 +01:00
johba
ba8f5d36c8 Merge pull request 'fix: bug: Get KRK page swap widget broken with Playwright fill() (#393)' (#396) from fix/issue-393 into master 2026-03-01 20:44:37 +01:00
openhands
13249613c0 address review: fix stale JSDoc, correct comments, remove redundant dispatchEvent 2026-03-01 19:11:43 +00:00
openhands
22a6264b00 ci: retrigger after infra failure 2026-03-01 18:40:37 +00:00
openhands
6876e84735 fix: bug: Get KRK page swap widget broken with Playwright fill() (#393)
Replace v-model with :value + @input on the number input in LocalSwapWidget.
Vue 3's vModelText directive coerces <input type="number"> values to numbers
via looseToNumber(), causing swapAmount to become a JS number (e.g. 0.05) after
Playwright fill(). viem's parseEther() requires a string and throws when passed
a number, triggering the "Enter a valid ETH amount" error.

The fix mirrors FInput's explicit @input handler which always reads
event.target.value as a string, keeping swapAmount typed as string throughout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 18:15:50 +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
johba
6c4ede16ab Merge pull request 'fix: Holdout evaluator: Playwright browser-based scenario scripts (#381)' (#388) from fix/issue-381 into master 2026-03-01 13:32:41 +01: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
johba
910a02a7cb Merge pull request 'fix: Holdout evaluator: fresh containerized stack per run (#380)' (#382) from fix/issue-380 into master 2026-03-01 11:34:44 +01:00
openhands
1d6dd8c628 fix: address review feedback on evaluate.sh (#380)
- container_name(): derive separator from compose version (_COMPOSE_SEP),
  so v1 (underscores) and v2 (hyphens) both resolve the right container name
- Drop buggy grep fallback for JSON branch extraction; python3 path is
  sufficient and safe; grep cannot reliably target only head.ref in the
  nested Gitea response
- Validate KRAIKEN/STAKE/LIQUIDITY_MANAGER after sourcing contracts.env to
  catch renamed variables with a clear infra_error instead of a cryptic
  'unbound variable' abort
- wait_exited: handle Docker 'dead' state alongside 'exited' to fail fast
  instead of polling the full timeout
- Ponder /ready timeout is now infra_error (was a logged warning); scenarios
  must not run against a partially-indexed chain
- Avoid double git fetch: only fetch the specific branch if the earlier
  --prune fetch (fallback path) has not already retrieved all remote refs
- Use mktemp -u so git worktree add creates the directory itself, avoiding
  failures on older git versions that reject a pre-existing target path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 10:12:34 +00:00
openhands
43c8d79afd fix: Holdout evaluator: fresh containerised stack per run (#380)
Adds scripts/harb-evaluator/evaluate.sh which:
- Accepts a PR number, resolves the branch via Codeberg API or git remote scan
- Checks out that branch into an isolated git worktree
- Boots a fresh docker compose stack with a unique COMPOSE_PROJECT name
- Waits for anvil healthy, bootstrap complete, ponder healthy + indexed
- Sources contract addresses from tmp/containers/contracts.env (never hardcoded)
- Exports EVAL_* env vars and runs any *.sh scripts under scenarios/
- Always tears down the stack and removes the worktree on exit (pass or fail)
- Returns 0 (gate passed), 1 (gate failed), or 2 (infra error)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 09:04:33 +00:00
johba
703185ea48 Merge pull request 'fix: HomeViewOffensive.vue trust section uses "Open." as a standalone claim (#313)' (#378) from fix/issue-313 into master 2026-02-28 16:22:22 +01:00
openhands
5d26100b58 ci: retrigger after infra failure 2026-02-28 14:54:03 +00:00
openhands
0b76ea9ca9 fix: HomeViewOffensive.vue trust section uses "Open." as a standalone claim (#313)
Replace "Open Source." with "On-Chain." — the repo is private so "open
source" is a false claim per PRODUCT-TRUTH.md §Code/Open Source and
UX-DECISIONS.md §Don't Say. "On-Chain." is accurate and consistent with
the subtitle already present in the section.

Also remove duplicate garbled sentence in the Adaptive Trading card
("The optimizer evolves — new versions ship as the protocol matures."
was a copy-paste repeat of the preceding clause).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 14:44:15 +00:00
openhands
10f7f1ebc0 fix: \HomeViewOffensive.vue\ trust section uses "Open." as a standalone claim (#313)
Replace vague "Open." with "Open Source." in the trust section heading
to give the claim concrete meaning and match the Source Code link below.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 14:21:03 +00:00
johba
80eb5a356f Merge pull request 'fix: taxDue ref lacks null guard before bigint arithmetic (#329)' (#376) from fix/issue-329 into master 2026-02-28 15:15:04 +01:00
openhands
bcebbd47c9 fix: \taxDue\ ref lacks null guard before bigint arithmetic (#329)
Initialize taxDue as ref<bigint>(0n) instead of ref<bigint>() so the
type is always bigint, eliminating the undefined in the Ref type and
making the bigint addition at line 219 type-safe without a null guard.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 13:51:04 +00:00
johba
cfe113b1a0 Merge pull request 'fix: {{ taxPaidGes }} and {{ profit }} render empty during async load (#330)' (#373) from fix/issue-330 into master 2026-02-28 14:42:31 +01:00
openhands
57903329bf fix: \{{ taxPaidGes }}\ and \{{ profit }}\ render empty during async load (#330)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 13:21:06 +00:00
johba
c6f25c98ab Merge pull request 'fix: No allowance set before token0.transfer in swap callback (#339)' (#370) from fix/issue-339 into master 2026-02-28 13:46:19 +01:00
openhands
0fbc666c97 fix: No allowance set before \token0.transfer\ in swap callback (#339)
Add an explanatory comment to uniswapV3SwapCallback clarifying that
address(this) is pre-funded by _replaySwap before pool.swap() is
called, so no inline mint is required (unlike uniswapV3MintCallback).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 12:14:20 +00:00
johba
936d6cd60a Merge pull request 'fix: kraiken-lib missing from ARCHITECTURE.md directory map (#342)' (#368) from fix/issue-342 into master 2026-02-28 13:05:28 +01:00
openhands
e07fbf55a0 ci: retrigger after infra failure 2026-02-28 11:34:13 +00:00
openhands
e8c6070846 fix: kraiken-lib missing from ARCHITECTURE.md directory map (#342) 2026-02-28 11:20:50 +00:00
johba
b41dbddafe Merge pull request 'fix: Dual package managers: both package-lock.json and yarn.lock tracked (#343)' (#366) from fix/issue-343 into master 2026-02-28 12:13:27 +01:00
openhands
ab68e0cb68 fix: Dual package managers: both package-lock.json and yarn.lock tracked (#343)
Remove kraiken-lib/yarn.lock (npm is the sole package manager per CI and
build scripts), add packageManager field to kraiken-lib/package.json to
make the intent explicit, and add a single-package-manager CI step that
fails the build if yarn.lock reappears in kraiken-lib/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 10:51:59 +00:00
johba
d9a38921b6 Merge pull request 'fix: Unmatched /docs/* subroutes silently render empty DocsView (#347)' (#364) from fix/issue-347 into master 2026-02-28 11:43:44 +01:00
openhands
ca1ad9467c fix: Unmatched /docs/* subroutes silently render empty DocsView (#347) 2026-02-28 10:12:10 +00:00
johba
7f0aca8377 Merge pull request 'fix: Structural duplication of swap ABIs and buyKrk() across LocalSwapWidget and CheatsView (#353)' (#360) from fix/issue-353 into master 2026-02-28 11:05:10 +01:00
openhands
e5a5486499 fix: Structural duplication of swap ABIs and buyKrk() across LocalSwapWidget and CheatsView (#353)
Extract shared Uniswap ABIs (WETH_ABI, SWAP_ROUTER_ABI, UNISWAP_FACTORY_ABI,
UNISWAP_POOL_ABI), utility functions (isRecord, coerceString, getErrorMessage,
ensureAddress), and the wrap→approve→exactInputSingle flow into a new composable
useSwapKrk(). Both LocalSwapWidget and CheatsView now delegate to this single
source of truth, so swap logic changes only need to be made in one place.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 09:32:02 +00:00