Skip to content

start maker on creation#87

Open
keraliss wants to merge 2 commits into
mainfrom
start_maker
Open

start maker on creation#87
keraliss wants to merge 2 commits into
mainfrom
start_maker

Conversation

@keraliss
Copy link
Copy Markdown
Collaborator

@keraliss keraliss commented May 9, 2026

Summary by CodeRabbit

  • New Features

    • Makers are now automatically started immediately after creation; creation still succeeds if auto-start fails (warning logged).
    • Previously saved makers are automatically restarted when the dashboard launches.
    • Improved node-status probing: added a fallback scan of standard local node ports to better detect running local nodes.
  • Tests

    • Integration tests updated to assume makers are auto-started on creation.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 9, 2026

📝 Walkthrough

Walkthrough

Auto-starts maker coinswap servers on startup recovery and immediately after creation (non-blocking on failures), adds a localhost standard-ports fallback RPC probe for bitcoind status, and updates tests to assume makers auto-start on creation.

Changes

Maker Auto-Start Feature

Layer / File(s) Summary
Initialization Auto-Start
src/maker_manager/mod.rs
After restoring and persisting maker configs, MakerManager::new iterates restored maker IDs and attempts to start each maker's coinswap server, logging outcomes.
Creation Auto-Start
src/api/makers.rs
create_maker now calls mgr.start_maker after successful creation; start failures are logged as warnings but the handler still returns 201 Created with MakerInfo.
Bitcoind Standard Ports Probe
src/api/bitcoind.rs
Adds probe_standard_ports to TCP-check localhost regtest/signet default RPC ports with fallback auths; /api/bitcoind/status calls this probe if configured RPC endpoints fail before falling back to managed process state.
Integration Test Update
tests/integration_test.rs
Removes explicit POST-based start step; tests assume makers are auto-started on creation and wait for coinswap server readiness.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰
Makers wake at dawn, no human hand to steer,
Servers hum and hop — each coin finds its rear,
If one trips, a warning in the log will show,
Still onward goes the dashboard's gentle flow,
I nibble carrots, proud of what I sewed.

🚥 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 'start maker on creation' directly and concisely summarizes the main change: makers are now auto-started immediately upon creation.
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 start_maker

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/maker_manager/mod.rs (1)

110-110: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the outdated comment.

The comment states the function "does NOT start servers", but lines 148-159 now auto-start all successfully restored makers during dashboard startup.

📝 Proposed fix
-    /// Creates a new MakerManager with persistence at the given config directory.
-    /// Loads any previously saved maker configs and re-initializes them (but does NOT start servers).
+    /// Creates a new MakerManager with persistence at the given config directory.
+    /// Loads any previously saved maker configs, re-initializes them, and attempts to auto-start them.
     pub fn new(config_dir: PathBuf) -> Result<Self> {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/maker_manager/mod.rs` at line 110, The doc comment that starts "Loads any
previously saved maker configs and re-initializes them (but does NOT start
servers)" is now inaccurate; update that comment in the maker_manager module to
reflect that restored makers are auto-started during dashboard startup (remove
the "does NOT start servers" clause and describe that successfully restored
makers will be started automatically). Locate the doc comment above the
loader/restore function in mod.rs (the comment beginning with "Loads any
previously saved maker configs and re-initializes them") and replace it with a
concise, accurate description that mentions auto-start behavior for restored
makers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/maker_manager/mod.rs`:
- Line 110: The doc comment that starts "Loads any previously saved maker
configs and re-initializes them (but does NOT start servers)" is now inaccurate;
update that comment in the maker_manager module to reflect that restored makers
are auto-started during dashboard startup (remove the "does NOT start servers"
clause and describe that successfully restored makers will be started
automatically). Locate the doc comment above the loader/restore function in
mod.rs (the comment beginning with "Loads any previously saved maker configs and
re-initializes them") and replace it with a concise, accurate description that
mentions auto-start behavior for restored makers.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0c0b2521-29b8-47d2-b7a5-ba09e74d3485

📥 Commits

Reviewing files that changed from the base of the PR and between 37e806b and 42205ce.

📒 Files selected for processing (2)
  • src/api/makers.rs
  • src/maker_manager/mod.rs

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/api/bitcoind.rs`:
- Line 56: The loop is cloning the entire auth_methods collection on each
iteration causing unnecessary allocations; change the for auth in
auth_methods.clone() loop to iterate by reference (for auth in &auth_methods)
and only clone the individual auth when needed (e.g., pass auth.clone() into
Client::new), ensuring other uses use &auth to avoid extra copies; update any
uses inside the loop that expect owned String accordingly to call .clone() at
the point of Client::new.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 17f207fd-8840-4654-99cd-6e52bf904f71

📥 Commits

Reviewing files that changed from the base of the PR and between 42205ce and c04b858.

📒 Files selected for processing (2)
  • src/api/bitcoind.rs
  • tests/integration_test.rs

Comment thread src/api/bitcoind.rs
continue;
}
let url = format!("http://{}", address);
for auth in auth_methods.clone() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | 💤 Low value

Avoid unnecessary array cloning in the loop.

The current code clones the entire auth_methods array (including owned String values from line 44) on every iteration of the outer loop. Iterate by reference instead and clone only when passing to Client::new.

♻️ Proposed fix
-    for auth in auth_methods.clone() {
-        if let Ok(client) = Client::new(&url, auth) {
+    for auth in &auth_methods {
+        if let Ok(client) = Client::new(&url, auth.clone()) {
             if let Ok(info) = client.get_blockchain_info() {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for auth in auth_methods.clone() {
for auth in &auth_methods {
if let Ok(client) = Client::new(&url, auth.clone()) {
if let Ok(info) = client.get_blockchain_info() {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/api/bitcoind.rs` at line 56, The loop is cloning the entire auth_methods
collection on each iteration causing unnecessary allocations; change the for
auth in auth_methods.clone() loop to iterate by reference (for auth in
&auth_methods) and only clone the individual auth when needed (e.g., pass
auth.clone() into Client::new), ensuring other uses use &auth to avoid extra
copies; update any uses inside the loop that expect owned String accordingly to
call .clone() at the point of Client::new.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants