test(market-making): add MKT-1491 workflow e2e coverage - #112
test(market-making): add MKT-1491 workflow e2e coverage#112prd-carapulse[bot] wants to merge 23 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 53ed32453c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Current-head follow-up: hardened mock ladder fills against non-positive, over-published, and over-credit amounts; added partial/full rung-consumption coverage; counted individual rungs; and added strict-cross plus adjacent-safe spread cases. Scope blocker: cleanup-enabled lifecycle coverage and existing-buy/prospective-sell coverage have no production path on the current branch. The composition root exposes setup-check and one-shot bootstrap only, with no startup/shutdown cleanup boundary and no composed production ladder make adapter. The prior direct mock hard-halt test was removed rather than presenting a test-only method as production E2E coverage. Head: |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
<@U09LHAWUK3M> review |
3 similar comments
|
<@U09LHAWUK3M> review |
|
<@U09LHAWUK3M> review |
|
<@U09LHAWUK3M> review |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 757f768ae0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
e825326 to
45856c1
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 45856c12f9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2eb9dfba8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 32c48ac602
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91952d2698
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@codex review |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Fresh evidence beyond the earlier thread is that the current non-per-book path still passes each side offer into the tree separately, and the new unit test now asserts four distinct groups for a two-rung shared-rung quote, while the ladder design says shared-rung mode makes rung k one group across books (docs/decisions/TIB-2026-07-27-midnight-market-making-bot.md:431-435). For any groupMode: 'shared-rung' config this gives the lower and higher offers for the same rung independent group caps instead of the single shared rung cap operators selected, so fills can consume more inventory than the configured rung budget; group offers with the same rung index together for this mode.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
@codex review |
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0dc3af455d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70e37bce77
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30fa9b04f7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const query = new URLSearchParams({ limit: String(PAGE_SIZE) }) | ||
| if (cursor) query.set('cursor', cursor) | ||
| const rawResponse = await request( | ||
| `${parameters.baseUrl}/v0/midnight/books/${marketId}/${side}/takeable-offers?${query.toString()}`, |
There was a problem hiding this comment.
Accept the non-paginated takeable-book response
When live spread checks hit /v0/midnight/books/{market-id}/{side}/takeable-offers, this endpoint is non-paginated: the current Morpho docs say it returns up to 1,000 offers and does not accept limit/cursor parameters (https://docs.morpho.org/api/midnight/books/list-book-takeable-offers/), matching the generated OpenAPI at bots/midnight-liquidation/src/generated/midnight-api.ts:521-530. Building a paginated URL here, and then requiring response.cursor below, turns normal live responses into HTTP or book-response failures, so both bootstrap and ladder publication can be blocked before spread validation runs; read the single returned data array instead.
Useful? React with 👍 / 👎.
Why
The market-making bot needs a deterministic regression boundary before V0 is operated unattended. The prior workflow tests injected in-memory application ports, so they could not detect regressions in production composition, Router HTTP DTOs, SDK encoding/signing, Midnight transactions, or forked on-chain state.
Why now
MKT-1491 requires genuine E2E coverage before the V0 market-making workflow is relied on operationally.
What changed
48,900,000Verification
eth_chainIdreturned8453and block48,900,000was availablePATH=/home/hermes/.bun/bin:$PATH RPC_URL_8453=<canonical Morpho Base archive RPC> bun test bots/market-making/test/e2e/market-making.fork.e2e.test.ts bots/market-making/test/e2e/setup-check.e2e.test.ts— 12 passed, 0 failed, 108 assertionsPATH=/home/hermes/.bun/bin:$PATH RPC_URL_8453=<canonical Morpho Base archive RPC> bun test bots/market-making/test— 408 passed, 0 failed, 1,097 assertionsbun run --filter @morpho-org/market-making-bot typecheck— passedbun run --filter @morpho-org/market-making-bot jsdoc:build— passed; 216 public declarations inventoried and HTML generatedbun lint— 0 warnings, 0 errorsbun knip— passedbun format— passed; no working-tree changesgit diff --check origin/main...HEAD— passedLinear: https://linear.app/morpho-labs/issue/MKT-1491/add-e2e-testing-for-each-step
TIB: https://github.com/morpho-org/morpho-bots/blob/main/docs/decisions/TIB-2026-07-27-midnight-market-making-bot.md
Requested by: @julien (Slack)