Skip to content

fix(ci): unbreak python + contracts jobs on main#27

Merged
abhicris merged 1 commit into
mainfrom
fix/ci-green-2026-04-21
Apr 21, 2026
Merged

fix(ci): unbreak python + contracts jobs on main#27
abhicris merged 1 commit into
mainfrom
fix/ci-green-2026-04-21

Conversation

@abhicris
Copy link
Copy Markdown
Contributor

Root cause

Default-branch CI has been red since 2026-04-09. Two independent issues, both introduced by recently merged external PRs:

  1. contracts jobnpm ci fails with EUSAGE: no package-lock.json in deploy/. The hardhat scaffold (feat: add multi-chain deployment support (Arbitrum, Optimism, Base) #22 multi-chain deploy) was merged without a committed lockfile.
  2. python job — three test failures:
    • tests/unit/connectors/test_websocket_feed.py (from feat: add WebSocket price streaming for live market data #21) uses @pytest.mark.asyncio + async def but pytest-asyncio isn't in requirements.txt, so pytest emits Failed: async def functions are not natively supported.
    • tests/integration/test_chainlink.py::test_unknown_pair_raises uses patch.object(oracle, "w3"), but w3 is a @property. On modern mock, patch.object evaluates the property during setup, triggering a real HTTP connect attempt to http://localhost:8545 and raising OracleConnectionError before the test body executes.

Fix

  • deploy/package-lock.json — committed so npm ci has something to install.
  • requirements.txt — add pytest-asyncio>=0.23.0.
  • pytest.ini (new) — asyncio_mode = auto and register the asyncio marker so async tests run and marker warnings stop.
  • tests/integration/test_chainlink.py — patch oracle._w3 (the underlying attribute) instead of the w3 property; test now correctly exercises the OracleFeedNotFound path without touching the network.
  • .gitignore — ignore node_modules/, deploy/artifacts/, deploy/cache/.

Verification

  • python -m pytest tests/ locally → 79 passed, 2 skipped (2 skips are live-Sepolia tests, correctly skipped when WEB3_PROVIDER_URL_SEPOLIA unset), 0 failed.
  • cd deploy && rm -rf node_modules && npm ci && npx hardhat compile locally → clean install, "Nothing to compile" (no .sol sources wired to hardhat config yet — separate issue, not the CI break).

Out of scope

kcolbchain / Abhishek Krishna

Root cause
----------
Both jobs on default branch have been red since 2026-04-09. Two independent
issues, both introduced by merged external PRs:

1. contracts job — `npm ci` fails with EUSAGE: no package-lock.json exists in
   deploy/. The hardhat scaffold (PR #22, multi-chain deploy) was merged
   without a committed lockfile.

2. python job — three failures:
   - tests/unit/connectors/test_websocket_feed.py (PR #21) uses
     `@pytest.mark.asyncio` + `async def` but pytest-asyncio isn't in
     requirements.txt, so pytest errors with "async def functions are not
     natively supported".
   - tests/integration/test_chainlink.py::test_unknown_pair_raises uses
     `patch.object(oracle, "w3")`, but `w3` is a @Property. On modern mock
     this evaluates the property during patch setup, which triggers a real
     HTTP connection attempt to http://localhost:8545 and raises
     OracleConnectionError before the test body runs.

Fix
---
- deploy/package-lock.json: committed so `npm ci` has something to install.
- requirements.txt: add pytest-asyncio>=0.23.0.
- pytest.ini: new — sets asyncio_mode=auto and registers the asyncio marker
  so async tests run and marker warnings stop.
- tests/integration/test_chainlink.py: patch `oracle._w3` directly (the
  underlying attribute) instead of the `w3` property — no real network
  calls, test_unknown_pair_raises now correctly exercises the
  OracleFeedNotFound path.
- .gitignore: ignore node_modules/, deploy/artifacts/, deploy/cache/.

Verification
------------
Local: `python -m pytest tests/` → 79 passed, 2 skipped (live-net tests
skipped when WEB3_PROVIDER_URL_SEPOLIA unset), 0 failed.
Local: `cd deploy && rm -rf node_modules && npm ci && npx hardhat compile`
→ clean install + "Nothing to compile" (no .sol sources wired to hardhat
config yet — separate issue from CI green).

— [kcolbchain](https://kcolbchain.com) / [Abhishek Krishna](https://abhishekkrishna.com)
@abhicris abhicris merged commit ecf8acb into main Apr 21, 2026
4 checks passed
@abhicris abhicris deleted the fix/ci-green-2026-04-21 branch April 21, 2026 01:16
abhicris added a commit that referenced this pull request Apr 23, 2026
PR #27 unbroke `npx hardhat compile` (got `npm ci` working), but the job
still output "Nothing to compile" — hardhat looked at `deploy/contracts/`
which doesn't exist; the repo's Solidity sources live in `contracts/` at
the repo root.

This wires them up properly:

- `paths.root = ".."` + `paths.sources = "contracts"` points hardhat at
  the real source tree. `paths.tests` / `paths.cache` / `paths.artifacts`
  follow the same root-relative convention so the structure stays clean.
- Solidity bumped to `0.8.26` with `evmVersion: "cancun"` because
  `@openzeppelin/contracts ^5.0.0` (already in `package.json`) uses
  `mcopy` in `utils/Memory.sol`, which needs the cancun opcode.

Verification (locally, from `deploy/`):

```
$ rm -rf cache artifacts && npx hardhat compile
Compiled 24 Solidity files successfully (evm target: cancun).
```

The `contracts` CI job on main will now actually type-check the four
Solidity files we ship — `MeridianVault.sol`, `MeridianVaultERC4626.sol`
(ERC-4626 vault-share token), `OracleAdapter.sol`, `StrategyExecutor.sol`
— instead of silently succeeding on an empty source set.

Follow-up (separate PR): fix the `_getChainlinkPrice(pairId, ...)` vs
`pairId(string)` name-shadowing warning in OracleAdapter.sol.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
abhicris added a commit that referenced this pull request Apr 23, 2026
…un (#32)

PR #27 unbroke `npx hardhat compile` (got `npm ci` working), but the job
still output "Nothing to compile" — hardhat looked at `deploy/contracts/`
which doesn't exist; the repo's Solidity sources live in `contracts/` at
the repo root.

This wires them up properly:

- `paths.root = ".."` + `paths.sources = "contracts"` points hardhat at
  the real source tree. `paths.tests` / `paths.cache` / `paths.artifacts`
  follow the same root-relative convention so the structure stays clean.
- Solidity bumped to `0.8.26` with `evmVersion: "cancun"` because
  `@openzeppelin/contracts ^5.0.0` (already in `package.json`) uses
  `mcopy` in `utils/Memory.sol`, which needs the cancun opcode.

Verification (locally, from `deploy/`):

```
$ rm -rf cache artifacts && npx hardhat compile
Compiled 24 Solidity files successfully (evm target: cancun).
```

The `contracts` CI job on main will now actually type-check the four
Solidity files we ship — `MeridianVault.sol`, `MeridianVaultERC4626.sol`
(ERC-4626 vault-share token), `OracleAdapter.sol`, `StrategyExecutor.sol`
— instead of silently succeeding on an empty source set.

Follow-up (separate PR): fix the `_getChainlinkPrice(pairId, ...)` vs
`pairId(string)` name-shadowing warning in OracleAdapter.sol.

Co-authored-by: Claude Opus 4.7 <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