Skip to content

#724 Enable URL liveness check for release builds#729

Open
Abdulbois wants to merge 17 commits into
zigbee-alliance:masterfrom
Abdulbois:#724-URL-Reachability-Check
Open

#724 Enable URL liveness check for release builds#729
Abdulbois wants to merge 17 commits into
zigbee-alliance:masterfrom
Abdulbois:#724-URL-Reachability-Check

Conversation

@Abdulbois
Copy link
Copy Markdown
Collaborator

@Abdulbois Abdulbois commented May 2, 2026

  • Introduces a dev build tag to setup dev env dependent flags
  • Add URL liveness checks in CLI tx command for prod release

Closes #724

Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
@Abdulbois Abdulbois changed the title Enable URL liveness check for release builds #724 Enable URL liveness check for release builds May 2, 2026
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
@Abdulbois Abdulbois force-pushed the #724-URL-Reachability-Check branch from 42868dd to b98d700 Compare May 2, 2026 09:55
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
@Abdulbois Abdulbois force-pushed the #724-URL-Reachability-Check branch 3 times, most recently from 2555475 to 1e68fd2 Compare May 2, 2026 10:43
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
@Abdulbois Abdulbois force-pushed the #724-URL-Reachability-Check branch from 1e68fd2 to 45e70e3 Compare May 2, 2026 11:26
Abdulbois added 3 commits May 4, 2026 12:33
…b CI

Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
@Abdulbois Abdulbois force-pushed the #724-URL-Reachability-Check branch from 7584b83 to 13c3757 Compare May 4, 2026 10:37
Abdulbois and others added 3 commits May 7, 2026 11:37
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
@@ -49,27 +53,78 @@ func requiredIfBit0Set(fl validator.FieldLevel) bool {
}

func isValidHttpOrHttpsUrl(fl validator.FieldLevel) bool { //nolint:stylecheck
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reachability checks cannot be implemented here, because it's part of ValidateBasic function which is part of the static validation, see https://csa-matter.slack.com/archives/C025PQ6RMRA/p1777291064854469.
Please implement reachability checks in separate dedicated functions which should be called only within CLI directly, as described in the original ticket.

Copy link
Copy Markdown
Collaborator Author

@Abdulbois Abdulbois May 9, 2026

Choose a reason for hiding this comment

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

Update, but it is called(should be called) before the broadcasting txn to the DCLD nodes(before tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) call)

Abdulbois added 4 commits May 9, 2026 14:14
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Comment thread utils/cli/url_liveness.go
var allowed4XXStatusCodes = []int{
http.StatusUnauthorized,
http.StatusForbidden,
http.StatusUnavailableForLegalReasons,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we want to include also 405 Method Not Allowed — server rejects HEAD specifically?
Another option can be to treat any status beside 404 (and 5xx?) as reachable.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added 405. For the second option, as I know, when the server is down, it should return a 5xx code even requested page does not exist

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes, if the server is down - you only get server codes, not resource.

Comment thread x/model/client/cli/tx_model_version.go Outdated
specificationVersion,
)

if releaseNotesURL != "" && !cli.IsLiveURL(releaseNotesURL) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about otaURL?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated

Comment thread x/model/client/cli/tx_model_version.go Outdated
schemaVersion,
)

if releaseNotesURL != "" && !cli.IsLiveURL(releaseNotesURL) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about otaURL?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated

Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Comment thread .github/workflows/verify.yml Outdated
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GOCOVER_MODE: set # Ensure integration tests use the same mode as unit tests
GOCOVER_MODE: set # Ensure integration tests use the same mode as unit tests\
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
GOCOVER_MODE: set # Ensure integration tests use the same mode as unit tests\
GOCOVER_MODE: set # Ensure integration tests use the same mode as unit tests

Copy link
Copy Markdown
Collaborator Author

@Abdulbois Abdulbois May 14, 2026

Choose a reason for hiding this comment

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

Updated

Comment thread utils/cli/url_liveness.go Outdated
var httpClient = &http.Client{Timeout: livenessCheckTimeout}

func IsLiveURL(u string) bool {
if config.DisableURLLivenessCheck {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's rename it to URLLivenessCheckEnabled.

  1. Mark it as a boolean flag because Disable looks more like function name than boolean flag.
  2. Change negative to positive. It is easier to read URLLivenessCheckEnabled thus !URLLivenessCheckEnabled than URLLivenessCheckDisabled.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Renamed to URLLivenessCheckEnabled

Comment thread utils/cli/url_liveness.go
var allowed4XXStatusCodes = []int{
http.StatusUnauthorized,
http.StatusForbidden,
http.StatusUnavailableForLegalReasons,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes, if the server is down - you only get server codes, not resource.

Comment thread utils/cli/url_liveness.go Outdated
// Empty strings are skipped.
//
// Returns an empty string if all non-empty URLs are reachable.
func FirstUnreachableURL(urls ...string) string {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As far as I understand - reason of having this function is to throw error if ANY of given urls are not reachable.

It would be more UX friendly if we can give info on ALL unreachable urls in one check.

Worst case for both scenarios - timeout.
Best case for FirstUnreachableURL - when any of calls gives error.
Best case for CheckURLsForReachability - when all calls are completed.

@ashcherbakov what do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to provide a list of all unreachable URLs at the same time for better UX.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated

Comment thread Makefile
test:
go test -v $(PACKAGES)
go test -tags=dev -v $(PACKAGES)
go test -v utils/cli/url_liveness.go utils/cli/url_liveness_test.go
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we move these files into variable just like PACKAGES?

Copy link
Copy Markdown
Collaborator Author

@Abdulbois Abdulbois May 14, 2026

Choose a reason for hiding this comment

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

No, because url_liveness_test.go should be executed without dev tag

Abdulbois added 2 commits May 14, 2026 16:43
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
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.

URL Reachability Check as part of CLI

3 participants