Skip to content

Neutralize metaboards (~5s per request saved)#86

Closed
alastairong1 wants to merge 1 commit intomainfrom
alastair/neutralize-metaboards
Closed

Neutralize metaboards (~5s per request saved)#86
alastairong1 wants to merge 1 commit intomainfrom
alastair/neutralize-metaboards

Conversation

@alastairong1
Copy link
Copy Markdown
Contributor

@alastairong1 alastairong1 commented Apr 20, 2026

Summary

  • Adds neutralize_metaboards() to replace Goldsky metaboard subgraph URLs with a localhost stub
  • The library's fetch_orders_dotrain_sources() calls each order's metaboard (~5s for 20 orders) — our API never uses DotrainSourceV1, so this is pure waste
  • Switches load() to use RaindexClient::new(vec![neutralized_settings], None, db) instead of registry.get_raindex_client()
  • Includes 3 unit tests for the neutralization logic

Test plan

  • cargo check passes
  • cargo test passes (3 new tests for neutralize_metaboards)
  • Time /v1/orders/token/{addr} before/after — expect ~5s improvement

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Changes

    • Metaboards configuration entries are now automatically replaced with a disabled redirect to localhost during startup, ensuring those entries are not activated.
  • Tests

    • Added tests covering configuration processing: replacement of metaboards, behavior when the section is absent, and replacement when the entry appears at end-of-file.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d85481f8-52ac-4e44-8796-10353dd8a283

📥 Commits

Reviewing files that changed from the base of the PR and between bb039b7 and b63a8ef.

📒 Files selected for processing (1)
  • src/raindex/config.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/raindex/config.rs

📝 Walkthrough

Walkthrough

Replaces top-level metaboards: YAML in raindex settings with a _disabled: https://localhost block via a new neutralize_metaboards() transformer and uses the transformed settings when constructing the raindex client; unit tests cover replacement, absence, and EOF placement cases.

Changes

Cohort / File(s) Summary
YAML Configuration Processing
src/raindex/config.rs
Added neutralize_metaboards() which scans YAML text and rewrites a top-level metaboards: section to _disabled: https://localhost while preserving other content. Updated Raindex client construction to use neutralized settings instead of registry-based client creation. Added three unit tests: metaboards replacement, missing section, and replacement at EOF.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble YAML lines at dawn,
I swap metaboards for localhost lawn,
Neutral and neat, the config hops free,
A tiny rabbit's tidy refactor glee. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Neutralize metaboards (~5s per request saved)' accurately describes the main change: a new neutralize_metaboards function that improves performance by replacing metaboard URLs with localhost stubs.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch alastair/neutralize-metaboards

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/raindex/config.rs (1)

19-42: Consider using a YAML parser for robustness.

The line-based rewrite works for the current registry format but is fragile: it assumes metaboards: only ever appears as a top-level key and that child entries are indented (no blank lines, no flow-style spanning multiple lines, no comments at column 0 inside the block). A serde_yaml / serde_yml round-trip that removes the metaboards mapping and inserts {_disabled: https://localhost} would be less brittle and easier to reason about. Not a blocker given the registry format is controlled, but worth considering if registry YAML ever becomes more flexible.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/raindex/config.rs` around lines 19 - 42, The current
neutralize_metaboards function does fragile line-based editing; replace it with
a YAML parse/modify/serialize approach using serde_yaml: in
neutralize_metaboards parse the input into a serde_yaml::Value (or Mapping),
remove or replace the top-level "metaboards" entry, insert a mapping value
{"_disabled": "https://localhost"} under that key, then serialize the Value back
to a String and return it; use serde_yaml::from_str and serde_yaml::to_string
and handle parse/serialize errors appropriately within neutralize_metaboards.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/raindex/config.rs`:
- Around line 19-42: The current neutralize_metaboards function does fragile
line-based editing; replace it with a YAML parse/modify/serialize approach using
serde_yaml: in neutralize_metaboards parse the input into a serde_yaml::Value
(or Mapping), remove or replace the top-level "metaboards" entry, insert a
mapping value {"_disabled": "https://localhost"} under that key, then serialize
the Value back to a String and return it; use serde_yaml::from_str and
serde_yaml::to_string and handle parse/serialize errors appropriately within
neutralize_metaboards.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f77d2be7-8a5f-4eb4-b63d-04df0d41c32d

📥 Commits

Reviewing files that changed from the base of the PR and between b1ebea3 and bb039b7.

📒 Files selected for processing (1)
  • src/raindex/config.rs

@alastairong1
Copy link
Copy Markdown
Contributor Author

Re: the serde_yaml suggestion for neutralize_metaboards — acknowledged, but intentionally keeping the line-based approach for now:

  1. The registry YAML format is controlled by us and hasn't changed structurally
  2. Adding serde_yaml as a dependency just for this single transform adds build weight
  3. A serde round-trip can reorder keys and strip comments, which could cause subtle issues if the config is inspected manually
  4. The function has 3 unit tests covering the key scenarios (mid-file, absent, end-of-file)

If the registry format becomes more complex in the future, we can revisit. Good callout though.

@findolor findolor changed the base branch from main to graphite-base/86 April 27, 2026 07:33
@findolor findolor force-pushed the alastair/neutralize-metaboards branch from bb039b7 to 503a210 Compare April 27, 2026 07:33
@findolor findolor changed the base branch from graphite-base/86 to revert/alastair-direct-main-pushes April 27, 2026 07:33
Copy link
Copy Markdown
Collaborator

findolor commented Apr 27, 2026


How to use the Graphite Merge Queue

Add the label add-to-gt-merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@findolor findolor changed the base branch from revert/alastair-direct-main-pushes to graphite-base/86 April 27, 2026 10:09
@graphite-app graphite-app Bot force-pushed the alastair/neutralize-metaboards branch from 503a210 to fb31e7b Compare April 27, 2026 12:30
@graphite-app graphite-app Bot force-pushed the graphite-base/86 branch from bb989eb to 5951bd2 Compare April 27, 2026 12:30
@graphite-app graphite-app Bot changed the base branch from graphite-base/86 to main April 27, 2026 12:31
@graphite-app graphite-app Bot force-pushed the alastair/neutralize-metaboards branch from fb31e7b to 56061d9 Compare April 27, 2026 12:31
@alastairong1 alastairong1 requested a review from findolor April 28, 2026 19:20
Copy link
Copy Markdown
Collaborator

@findolor findolor left a comment

Choose a reason for hiding this comment

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

I don't think we should have a logic where we omit some of the fields we have in settings yaml. If we don't need the fields we should not add the fields in the first place if it's possible.

That said I don't think this PR should be merged. We should update the registry with a settings yaml that does not have the metaboard fields. @alastairong1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@findolor findolor force-pushed the alastair/neutralize-metaboards branch from 56061d9 to b63a8ef Compare April 30, 2026 11:19
@findolor findolor closed this May 4, 2026
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.

2 participants