Skip to content

Add fair node exit command#898

Closed
Copilot wants to merge 8 commits intofairfrom
copilot/fix-896-2
Closed

Add fair node exit command#898
Copilot wants to merge 8 commits intofairfrom
copilot/fix-896-2

Conversation

Copy link

Copilot AI commented Aug 1, 2025

This PR implements the fair node exit --yes command to remove nodes from fair manager contracts as requested.

Implementation Details

The command follows the exact syntax specified:

skale fair node exit --yes

The implementation includes:

  • New CLI module (node_cli/cli/fair.py) with proper command hierarchy:

    • fair group command
    • node subgroup under fair
    • exit command with --yes confirmation flag
  • Core functionality (node_cli/core/fair.py) that:

    • Sends POST request to /api/v1/fair/node/exit route
    • Waits for API response
    • Handles success and error cases appropriately
    • Follows existing error handling patterns with error_exit()
  • API route configuration added to routes.py for the fair node removal endpoint

  • Comprehensive test suite (tests/cli/fair_test.py) with mocked scenarios:

    • Successful node removal
    • API error handling
    • Node not initialized validation

Code Quality

The implementation follows the existing codebase patterns:

  • Uses the same decorators (@check_inited, @streamed_cmd)
  • Consistent error handling with proper exit codes
  • No comments in code, keeping it simple and clean
  • Matches the style of existing node commands

All tests pass successfully and the command integrates seamlessly with the existing CLI structure.

Fixes #896.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

kucharskim and others added 7 commits June 23, 2025 20:07
Function doesn't wait for `openssl s_client ...` to finish.
It assumes that when the command is still running that is the
successful condition. However the function should wait for
exit code from the binary. We saw in production intermittent
and very often `skale ssl upload` failures. This change
should fix this problem and underlying race condition.
Replace for loop and dp.poll() with more straightforward
dp.wait() with a timeout, as requested during diff review.
Redirect the child's standard input to subprocess.DEVNULL,
so it starts with no stdin attached. This prevents the OpenSSL
health-check process from reading from, or blocking on, the
parent's terminal or execution environment stdin stream.
Fix check_ssl_connection() function
Co-authored-by: dmytrotkk <15244591+dmytrotkk@users.noreply.github.com>
Copilot AI changed the title [WIP] Add remove fair node command Add fair node exit command Aug 1, 2025
Copilot AI requested a review from dmytrotkk August 1, 2025 13:21
@dmytrotkk dmytrotkk changed the base branch from develop to fair August 1, 2025 14:26
@dmytrotkk
Copy link
Collaborator

@copilot new base branch is fair, update the PR

Copy link
Author

Copilot AI commented Aug 1, 2025

@copilot new base branch is fair, update the PR

Updated the PR to use the fair branch as the base. The implementation now properly integrates with the existing fair node CLI structure, using the same patterns as other fair node commands like change-ip and register.

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.

Add remove fair node command

4 participants