feat(quoter-bot): add per-maturity bootstrap premium method - #174
Conversation
|
@codex review |
|
@prd-carapulse[bot] can you review and approve if all good |
|
Review posted on PR #174. • Verdict: Changes requested; not approved. |
There was a problem hiding this comment.
Changes requested.
- Required CI check
Dead-Codefails:DEFAULT_MATURITY_PREMIUM_PER_YEAR_BPSis reported as an unused export atbots/quoter-bot/playground/field-visibility.utils.ts:6. Remove the export or consume it through an import; then rerun CI. - Local verification was blocked by the runtime Node mismatch: repository requires Node
^24.14.1, runner has Nodev26.3.0.
Typecheck and lint pass; approval is blocked by the red Dead-Code check.
|
Round-1 findings addressed in 43a9468: the Dead-Code failure is fixed ( @codex review |
|
@prd-carapulse[bot] can you review and approve if all good |
|
Approved PR #174 at head • No blocking correctness, security, or coverage issues found. |
There was a problem hiding this comment.
Reviewed current head 43a9468. No blocking correctness, security, or test-coverage issues found in the maturity-premium changes. Lint, Typecheck, and Dead-Code checks pass; Test was still in progress at review time.
Reviewed by Hermes Agent.
|
Codex round-2 finding addressed in a69dc9b: the playground bootstrap preview now mirrors the reachability-aware load semantics — with a @codex review |
|
@prd-carapulse[bot] can you review and approve if all good |
|
Approved PR #174 at head • Review: No blocking correctness, security, or coverage issues found. |
There was a problem hiding this comment.
Reviewed current head a69dc9b. No blocking correctness, security, or test-coverage issues found in the maturity-premium changes. Lint, Typecheck, and Dead-Code pass; Test is still running and remains the merge gate. Local execution was blocked by the repository Node requirement ^24.14.1 while this runner has v26.3.0.
|
Codex Review: Didn't find any major issues. 👍 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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a69dc9ba74
ℹ️ 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: cd9766fea7
ℹ️ 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: 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". |
|
CI is green again at 09b2ff8. Since the last approvals the branch gained: two refinements from the stacked ladder work (shared maturity-read helper in src/infrastructure/maturity-read.utils.ts; reachability additionally bounded by the protocol maturity horizon via highestReachableMaturityPremiumBps) and one CI fix (ci(checks): install the pinned Foundry release directly — upstream turned foundryup into a native binary on 2026-08-25 and broke every @codex review |
|
@prd-carapulse[bot] can you review and approve if all good |
|
Review posted: • • Keep the action pinned, or verify the release asset digest/attestation before extraction. • Application changes reviewed; no additional blocking issue found. Review: #174 (review) |
There was a problem hiding this comment.
Changes requested: .github/workflows/checks.yml:52 downloads and installs a release archive by a mutable tag without verifying its digest or attestation. This replaces the previously commit-pinned foundry-toolchain action, so a tag/asset move or compromised release path can execute arbitrary binaries with sudo in CI. Keep the action pinned or pin the release asset plus a reviewed SHA-256/attestation verification before extraction. The application changes and CI checks otherwise look good.
|
Hardened per the carapulse finding in b9949db: the release download is now pinned by SHA-256 ( @codex review |
|
@prd-carapulse[bot] can you review and approve if all good |
|
Approved PR #174.
|
There was a problem hiding this comment.
Reviewed current head b9949db. No blocking correctness, security, or coverage issues found. The Foundry CI hardening now verifies the pinned v1.5.1 archive SHA-256 before extraction and avoids sudo. Lint and Dead-Code pass; Typecheck and Test are still in progress, so merge remains gated until both complete.
|
Codex Review: Didn't find any major issues. Chef's kiss. 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". |
Quote all configured maturities from one bot with a per-maturity premium: an optional per-entry maturityPremium tagged union (initial linear shape) resolves floor(premiumPerYearBps * secondsToMaturity / year), optionally capped, on top of the static premiumBps, so further maturities quote higher while the requested rate still saturates into the entry's hard range. Time to maturity is read fresh each cycle via the midnight-sdk Market.timeToMaturity on the latest Base block timestamp, composed beside the reference-rate read; a configured premium without its observation fails loud and halts the strategy. Verbose diagnostics decompose the quote into reference, static premium, and maturity premium. Implements MKT-1787; records the design and the partially superseded discounted-offer posture in TIB-2026-08-25. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…coded bounds check
Codex review findings on the maturity-read seam: raw provider failures now surface as the stable sanitized BootstrapAdapterError maturity-read classification, the immutable market read is cached per market, and one latest-block read is shared across a cycle sweep, so N maturity-enabled entries cost about one RPC per cycle instead of 2N. The helper is shared so the ladder follow-up composes the identical read path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codex finding: an uncapped curve was treated as having unbounded upside, accepting configurations a too-shallow slope leaves permanently floor-clamped. Midnight's touchMarket rejects maturities beyond block.timestamp + 100 * 365 days, so highestReachableMaturityPremiumBps resolves the premium at that horizon (the configured cap still binds below it) and the hardcoded bounds check and bootstrap preview use the finite reachable envelope. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
b9949db to
dc0c65d
Compare
|
@prd-carapulse[bot] can you review and approve if all good |
|
Approved PR #174 at current head No blocking correctness, security, or coverage issues found. Previous findings are addressed. Lint, Typecheck, and Dead-Code pass; Test remains in progress and is still the merge gate. No merge performed. |
There was a problem hiding this comment.
Reviewed current head dc0c65d. No blocking correctness, security, or test-coverage issues found in the maturity-premium implementation or the Foundry CI hardening. The previously raised findings are addressed: reachability uses the finite protocol horizon, previews account for the premium range, maturity reads are typed and shared, and the archive digest is verified before extraction. Lint and Dead-Code pass; Typecheck and Test are still running and remain merge gates. Local execution was not used because this runner has Node v26.3.0 while the repository requires ^24.14.1.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc0c65d5bf
ℹ️ 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".
|
@prd-carapulse[bot] can you review and approve if all good |
|
Approved PR #174.
|
There was a problem hiding this comment.
Reviewed current head d9659a3. No blocking correctness, security, or coverage issues found. The latest attainable-premium validation and monotonic block-share-clock changes are covered by tests; diff is clean. CI: Lint, Typecheck, and Dead-Code pass; Test is still pending and remains the merge gate. No changes made; no merge performed.
|
Codex Review: Didn't find any major issues. Bravo. 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". |
…-f85533 Takes main's SHA-256-pinned direct Foundry download (PR #174) for the checks workflow, superseding this branch's foundry-toolchain v1.9.1 bump for the same binary-foundryup breakage.
…-f85533 Takes main's SHA-256-pinned direct Foundry download (PR #174) for the checks workflow, superseding this branch's foundry-toolchain v1.9.1 bump for the same binary-foundryup breakage.
Implements MKT-1787.
Why
Midnight books are fixed-rate, fixed-maturity. The bootstrap workflow priced every configured market off one reference with a flat static
premiumBps(≤ 0), so a bot quoting several maturities lent long at short-book rates — far-maturity offers were systematically adversely selected on duration, and the only workaround was hand-tuning one bot (or entry) per maturity. MKT-1787 asks for one bot quoting all maturities with a per-maturity premium — further maturity = higher premium — making bootstrap quoting a function of market rate and maturity, with the function shape left TBD.What
maturityPremiumconfig — a tagged union discriminated byshapeso future shapes land without config migration ("shape TBD" resolved as an extension point). Initiallinearshape:floor(premiumPerYearBps × secondsToMaturity / 31 536 000), optionally capped by inclusivemaximumPremiumBps, zero at/past maturity.reference + premiumBps + maturity premium, still saturating into the entry's[minimumRateBps, maximumRateBps]. The static premium stays ≤ 0 (urgency discount anchoring the short end); the maturity term is strictly positive duration compensation — long maturities can now rest above reference, which partially supersedes the TIB-2026-07-27 "only discounted offer" posture (recorded in TIB-2026-08-25, with the 07-27 banner updated).Promise.all) only for entries that configure a premium, wired in production as SDKmarket.timeToMaturity(block.timestamp)— block clock, never wall clock, to stay consistent with tick/settlement math. A configured premium without its observation fails loud (BootstrapConfigurationError), and a failed maturity read propagates as the existing reference-read strategy-wide hard halt.unchanged, so a step republishes only when it moves the canonical Midnight tick.maturityPremiumBpsandreferenceRate.secondsToMaturity, so any requested rate decomposes from one record.BOOTSTRAP_MARKETS), README +docs/reference.md(also fixes the stale "rejected rather than clamped" claim — the domain clamps), examples; the hardcoded-rate load check is reachability-aware (rejects only rates pinned outside the bounds at every maturity), architecture note, playground (typed round-trip, editor select/inputs, clamped reachable quote-range preview with callout, browser-boundary allowlists), typedoc.Deliberate scope choices (redirect cheaply if the ticket intends otherwise)
quotePremiumBps) curve support is deliberately deferred; a curve-aware bootstrap next to a curve-blind ladder is called out in the TIB's future considerations.Validation
RPC_URL_8453env; the playground Chromium smoke failure reproduces identically on the clean base (macOS/private/varrealpath quirk) — CI is the gate for both.jsdoc:checkinventories the new public callables; TypeDoc builds with warnings-as-errors..env.examplevalues parse through the real config parsers to the expected typed values.🤖 Generated with Claude Code