Skip to content

feat(midnight-crossed-books): add readonly mode - #152

Open
prd-carapulse[bot] wants to merge 16 commits into
mainfrom
hermes/midnight-crossed-books-readonly
Open

feat(midnight-crossed-books): add readonly mode#152
prd-carapulse[bot] wants to merge 16 commits into
mainfrom
hermes/midnight-crossed-books-readonly

Conversation

@prd-carapulse

@prd-carapulse prd-carapulse Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Why

Operators need a safe observation mode for the crossed-books resolver that can identify and simulate profitable resolutions without loading signing authority or broadcasting transactions.

What changed

  • Add fail-closed READONLY=true/1 runtime configuration; absent/false/0 retain write mode and malformed values are rejected.
  • Omit and ignore RESOLVER_PRIVATE_KEY in readonly mode while retaining the named write-mode key invariant.
  • Require an explicit non-zero public SIMULATION_CALLER_ADDRESS for keyless, execution-equivalent msg.sender and profit-transfer simulation.
  • Gate simulation-caller reading, validation, and retention entirely to readonly mode; write mode ignores malformed, zero, and valid stale caller values and derives the execution caller from the signer.
  • Compose readonly runtime without a signer, pending queue, or balance monitor.
  • Simulate and log every profitable market as match.computed without submission.
  • Fail closed if a readonly transport is ever asked to submit.
  • Synchronize mode-exclusive Railway variables before changing READONLY: readonly removes a stale private key; write mode removes a stale simulation caller.
  • Replace raw-value railway variable list --json mode detection with Railway's paginated key-only metadata and an explicitly project/environment/service/name-scoped variableDelete mutation.
  • Treat a metadata-proven absent opposite-mode key as idempotent success; fail closed on target lookup, malformed metadata, transport, GraphQL, or delete failures using named sanitized errors.
  • Keep secret sets on stdin and route public/secret set failures through named sanitized errors.
  • Document readonly startup, Docker Compose, Railway transitions, API-token requirement, and the non-zero public caller requirement.

Verification

  • Railway CLI 5.26.3 help confirms variable delete does not support --skip-deploys; current deletion uses no CLI delete command. variable set does support and retains --skip-deploys.
  • Focused TDD RED captured three write-mode simulation-caller failures (malformed, zero, and valid stale values); focused GREEN is 32/32. A temporary assertion mutation failed all three cases as expected.
  • Earlier Railway TDD covered no-list targeted deletion, malformed metadata, and set-error sanitization (26/26).
  • pnpm exec vitest run --project midnight-crossed-books (101 passed).
  • pnpm --filter @morpho-org/midnight-crossed-books run typecheck (passed).
  • pnpm --filter @morpho-org/midnight-crossed-books run build (passed).
  • pnpm lint (0 warnings, 0 errors).
  • pnpm format (passed; only intended files changed).
  • pnpm knip (passed).
  • pnpm --filter @morpho-org/quoter-bot run jsdoc:build (passed; 408 declarations, HTML generated).
  • pnpm test reached 1,719 passing / 2 skipped locally; three unrelated fork suites require unavailable RPC_URL_8453, so current-head CI is authoritative for the full workspace.
  • git diff --check and added-line secret-pattern scan passed.

Requested by: <@U02N5KRFDB9> | Julien Thomas

Co-authored-by: Julien Thomas <61523188+julien-devatom@users.noreply.github.com>
@prd-carapulse
prd-carapulse Bot marked this pull request as ready for review August 12, 2026 13:31

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread bots/midnight-crossed-books/src/bootstrap.ts Outdated
Co-authored-by: Julien Thomas <61523188+julien-devatom@users.noreply.github.com>
@prd-carapulse

prd-carapulse Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e19cbbaef9

鈩癸笍 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".

Comment thread bots/midnight-crossed-books/src/config/config.service.ts Outdated
Comment thread bots/midnight-crossed-books/src/config/config.service.ts Outdated
Comment thread bots/midnight-crossed-books/README.md
@prd-carapulse

prd-carapulse Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

Co-authored-by: Julien Thomas <61523188+julien-devatom@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d211480caa

鈩癸笍 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".

Comment thread bots/midnight-crossed-books/src/config/config.service.ts Outdated
Comment thread bots/midnight-crossed-books/scripts/railway.ts Outdated
Comment thread bots/midnight-crossed-books/scripts/railway.ts Outdated
@prd-carapulse

prd-carapulse Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 2403415328

鈩癸笍 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 and others added 3 commits August 12, 2026 14:49
Co-authored-by: Julien Thomas <61523188+julien-devatom@users.noreply.github.com>
Co-authored-by: Julien Thomas <61523188+julien-devatom@users.noreply.github.com>
Co-authored-by: Julien Thomas <61523188+julien-devatom@users.noreply.github.com>
@prd-carapulse

prd-carapulse Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 471dc1830f

鈩癸笍 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 and others added 2 commits August 12, 2026 16:12
Co-authored-by: Julien Thomas <61523188+julien-devatom@users.noreply.github.com>
Co-authored-by: Julien Thomas <61523188+julien-devatom@users.noreply.github.com>
@julien-devatom

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b9f2c9c535

鈩癸笍 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".

Comment thread bots/midnight-crossed-books/scripts/railway.ts
Comment thread bots/midnight-crossed-books/scripts/deploy-railway.ts
@prd-carapulse

prd-carapulse Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

Remove the unsupported project flag from Railway variable set commands and cover both public and stdin-backed variable writes.
@prd-carapulse

prd-carapulse Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4fbfe77aa

鈩癸笍 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".

Comment thread bots/midnight-crossed-books/scripts/railway.ts Outdated
Comment thread bots/midnight-crossed-books/scripts/deploy-railway.ts
Comment thread bots/midnight-crossed-books/scripts/railway.ts
Comment thread bots/midnight-crossed-books/scripts/railway.ts Outdated
Use supported Railway deletion paths, preserve idempotent CLI reruns, and pass explicit project context.
@prd-carapulse

prd-carapulse Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91efac1a69

鈩癸笍 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".

Comment thread bots/midnight-crossed-books/scripts/railway.ts Outdated
Comment thread bots/midnight-crossed-books/scripts/deploy-railway.ts
@prd-carapulse

prd-carapulse Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9a13e928a

鈩癸笍 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".

Comment thread bots/midnight-crossed-books/scripts/railway.ts Outdated
@prd-carapulse

prd-carapulse Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90e8d32252

鈩癸笍 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".

Comment thread bots/midnight-crossed-books/scripts/railway.ts Outdated
@prd-carapulse

prd-carapulse Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f6fbb0134

鈩癸笍 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".

Comment thread bots/midnight-crossed-books/scripts/deploy-railway.ts Outdated
Comment thread bots/midnight-crossed-books/scripts/railway.ts
@prd-carapulse

prd-carapulse Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 5be87efca5

鈩癸笍 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".

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