Skip to content

Conversation

@graycraft
Copy link
Member

@graycraft graycraft commented Apr 20, 2025

Task check list

Task description

To test this complex algorithm clearly, in the src/config/development.json leave only one list with one entry.
There are 3 possible cases, let's take a look at the example of ADAMANT nodes:

  1. Domain is available, use domain.
{
  "adm": {
    "nodes": {
      "list":[
        {
          "url": "https://debate.adamant.im",
          "alt_ip": "http://95.216.161.113:36666"
        }
      ]
    }
  }
}

Screenshot from 2025-06-08 03-14-43

  1. Domain is unavailable, try to use IP.
{
  "adm": {
    "nodes": {
      "list":[
        {
          "url": "https://abc.adamant.im",
          "alt_ip": "http://95.216.161.113:36666"
        }
      ]
    }
  }
}

Screenshot from 2025-06-08 03-17-36

  1. Domain is unavailable, IP is unavailable.
{
  "adm": {
    "nodes": {
      "list":[
        {
          "url": "https://abc.adamant.im",
          "alt_ip": "http://123.123.123.123:36666"
        }
      ]
    }
  }
}

Screenshot from 2025-06-08 03-39-37

Remember to filter out log messages and leave only console.info

Screenshot from 2025-06-08 03-59-06

Test cases

url: tauri.adm.im
alt_ip: 154.26.159.245:36666

The application tries a health check (api/node/status) on the domain tauri.adm.im.

a) Domain is accessible

  • Save this state, and all subsequent requests (both health checks and data requests) go to tauri.adm.im.
  • The "by domain" status is kept until the page is reloaded or the checkbox is toggled.
  • If later a health check request fails, the node is considered (temporarily) offline, but health checks continue as before.
    This is not a node ban — the node may be temporarily offline.

b) Domain is not accessible

  • The application tries a health check (api/node/status) on IP 154.26.159.245:36666.
  • If the IP is accessible, save this state and all subsequent requests go to 154.26.159.245:36666.
  • The "by IP" status is kept until the page is reloaded or the checkbox is toggled.
  • If later a health check request fails, the node is considered (temporarily) offline, but health checks continue as before.
    This is not a node ban — the node may be temporarily offline.

c) Neither domain nor IP is accessible

  • We cannot be sure the node is unavailable. It may be a temporary node or internet failure.
  • There will be no "by domain" or "by IP" status.
  • Start again from step 1.

@graycraft graycraft added the enhancement New feature or request label Apr 20, 2025
@graycraft graycraft self-assigned this Apr 20, 2025
@vercel
Copy link

vercel bot commented Apr 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
adamant-im Ready Ready Preview Comment Oct 27, 2025 3:49pm

@github-actions
Copy link

github-actions bot commented Apr 20, 2025

Deployed to https://msg-adamant-pr-768.surge.sh 🚀

@graycraft
Copy link
Member Author

@graycraft graycraft marked this pull request as ready for review April 21, 2025 21:08
@graycraft graycraft requested a review from a team as a code owner April 21, 2025 21:08
@dvelikiy
Copy link
Collaborator

dvelikiy commented Apr 28, 2025

The logic becomes more complex, it'd be good to write tests for different use-cases.

@adamantmm
Copy link
Member

@S-FrontendDev @bludnic
Please review

@graycraft
Copy link
Member Author

Test environment: https://adamant-i3cxk32io-adamant-team.vercel.app/options/nodes Console/Network filter: /tauri.adm|159\.245/

Bug: Connection type (domain/IP) is not saved/stored.

Actual logs:

[HealthCheck] Connection via https://tauri.adm.im succeeded (URL: https://tauri.adm.im, IP: http://154.26.159.245:36666).
index-Cj9qkcvN.js:253 [HealthCheck] Node status updated for https://tauri.adm.im. Height: 48942407. Ping: 379. Node is online.
index-Cj9qkcvN.js:253 [HealthCheck] Connection via https://tauri.adm.im succeeded (URL: https://tauri.adm.im, IP: http://154.26.159.245:36666).
index-Cj9qkcvN.js:253 [HealthCheck] Node status updated for https://tauri.adm.im. Height: 48942409. Ping: 1399. Node is online.
index-Cj9qkcvN.js:253 [HealthCheck] Connection via https://tauri.adm.im succeeded (URL: https://tauri.adm.im, IP: http://154.26.159.245:36666).
index-Cj9qkcvN.js:253 [HealthCheck] Node status updated for https://tauri.adm.im. Height: 48942411. Ping: 1249. Node is online.

Expected:

1. Once connected via domain, there will be no more rechecks and message `[HealthCheck] Connection via https://tauri.adm.im succeeded` appear only once.

2. Next, only `[HealthCheck] Node status updated` messages appear in logs.

eee2431

@graycraft
Copy link
Member Author

@adamant-al @adamantmm @S-FrontendDev

The following case has been fixed:

  1. Open /options/nodes page with blocked Tauri node in Developer tools.
  2. HTTP is not allowed.
  3. Both domain (tauri.adm.im) and IP (154.26.159.245:36666) are disabled. Health checks are continue repeating.
  4. Enabled Tauri node in the Developer tools.
  5. Connected by domain.
  6. Blocked Tauri node again in the Developer tools. The application tries to connect by IP (incorrect behavior).

In other words, the final logic is: persistently save the connection type (domain/IP) during a session (until a user refreshes the page or disables/enables the node using the checkbox) for each node after the first successful connection

100cc3f

@adamantmm
Copy link
Member

adamantmm commented Oct 8, 2025

@S-FrontendDev

Maybe we should add a small popup under HTTP is not allowed, explaining that this is a browser restriction and that the user can bypass it?

This can be a separate task. For example, add ℹ️: HTTP is not allowed ⟶ HTTP is not allowed ℹ️

fyi
[UX/UI, Enhancement] Small popup for "HTTP is not allowed" #888

Copy link
Member

@adamantmm adamantmm left a comment

Choose a reason for hiding this comment

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

@graycraft

Test case failed.

url: tauri.adm.im
alt_ip: 154.26.159.245:36666

The application tries a health check (api/node/status) on the domain tauri.adm.im.

  1. Open Nodes screen
  2. Domain is accessible
  3. Done: Save this state, and all subsequent requests (both health checks and data requests) go to tauri.adm.im.
  4. Block *tauri* in Dev Tools.
  5. Health check request fails, but the node is NOT considered (temporarily) offline, it is shown as "online" with outdated height, then status changed from "online" to "syncing".

Expected in (5):

  1. Health check request fails, the node is considered (temporarily) offline, it is shown as "offline", and not used for app requests.
  2. After node goes back online, it's included in the list of live nodes, and may be "online" or "syncing" depending on its height (as usual).

@graycraft
Copy link
Member Author

@graycraft

Test case failed.

url: tauri.adm.im alt_ip: 154.26.159.245:36666

The application tries a health check (api/node/status) on the domain tauri.adm.im.

1. Open Nodes screen

2. Domain is accessible

3. Done: Save this state, and all subsequent requests (both health checks and data requests) go to tauri.adm.im.

4. Block `*tauri*` in Dev Tools.

5. Health check request fails, but the node is NOT considered (temporarily) offline, it is shown as "online" with outdated height, then status changed from "online" to "syncing".

Expected in (5):

1. Health check request fails, the node is considered (temporarily) offline, it is shown as "offline", and not used for app requests.

2. After node goes back online, it's included in the list of live nodes, and may be "online" or "syncing" depending on its height (as usual).

8993697

@S-FrontendDev
Copy link
Member

@adamantmm is test passed?

@adamantmm
Copy link
Member

@adamantmm is test passed?

Yes, it is.

Waiting for "Verbose logging" not to spam in logs, and then we can merge.

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

Labels

APIs API design, endpoints, and integrations enhancement New feature or request JavaScript Frontend or backend code in JavaScript Nodes ADM node software issues, APIs, connectivity, consensus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat, Enhancement] Health-check: Check alt_ip if web domain is not accessible

8 participants