Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide human readable messages for backend messages #1058

Merged
merged 1 commit into from
Nov 28, 2022

Conversation

hannaeko
Copy link
Member

Purpose

Provide human readable message for backend generated messages.

Context

When a test times out or dies this is how the new result UI would present the error.

Screenshot 2022-11-24 at 13-29-14 samsung com · Zonemaster

Changes

  • use UNSPECIFIED test case when no test case has been provided in message.
  • convert backend message tags to human readable messages, allowing for message translation.

UI with the changes:
Screenshot 2022-11-24 at 13-31-32 samsung com · Zonemaster

How to test this PR

  • Create a test and make it timeout (set timeout to a small value in backend.ini)
  • Query for the test results:
    % ./script/zmb --server http://127.0.0.1:5000 get_test_results --test-id 8c8b436b5b890c8c --lang en | jq '.result.results'
    [
      {
        "module": "BACKEND_TEST_AGENT",
        "testcase": "UNSPECIFIED",
        "message": "The test was unabled to finish.\n",
        "level": "CRITICAL"
      }
    ]
    

For reference here is the ouput of this command on develop:

[
  {
    "testcase": null,
    "module": "BACKEND_TEST_AGENT",
    "message": "BACKEND_TEST_AGENT:UNSPECIFIED:UNABLE_TO_FINISH_TEST \n",
    "level": "CRITICAL"
  }
]

@hannaeko hannaeko added P-High Priority: Issue to be solved before other V-Minor Versioning: The change gives an update of minor in version. labels Nov 24, 2022
@hannaeko hannaeko added this to the v2022.2 milestone Nov 24, 2022
Copy link
Contributor

@matsduf matsduf left a comment

Choose a reason for hiding this comment

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

There is no reason to add the new message to the PO files. When you follow the translation process the PO file will be updated with untranslated (empty) entries for new strings to translate. See "./update-po xx.po" step in https://github.com/zonemaster/zonemaster/blob/develop/docs/internal-documentation/maintenance/Instructions-for-translators.md#translation-steps

Comment on lines 22 to 23
__x # BACKEND_TEST_AGENT:UNABLE_TO_FINISH_TEST
"The test was unabled to finish.", @_;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the pseudo-level will be displayed to the users, I think it is worth considering its name. Is BACKEND_TEST_AGENT a good name for normal users? What is backend for them? Will we use this pseudo-level for other messages?

ZONEMASTER-TEST-AGENT (is hyphen a problem?) or AGENT or TEST-AGENT or TESTAGENT

And the message I suggest "Zonemaster was unable to start or finish the test" or "It was not possible to start or finish the test".

Copy link
Contributor

Choose a reason for hiding this comment

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

There is alread the SYSTEM level. Is there any problem to add that message to that level? If not, then we do not have to create a new level.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe reuse SYSTEM yes, and so then we can be extra explicit for the message tag (if we want to) since it will not be displayed to users, e.g. "BACKEND_TEST_AGENT_UNABLE_TO_FINISH_TEST". I'm suggesting to be extra explicit because I think SYSTEM messages come from Engine exclusively.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is fine to have "ugly" tags (there are more of them) since they are usually not shown.

Copy link
Member Author

@hannaeko hannaeko Nov 28, 2022

Choose a reason for hiding this comment

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

While I agree that SYSTEM would be better I don't think I will make that change in this PR as it would imply migrating the database to change the pseudo module of previous messages.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can live without migrating the database. I only means that those old tests, which probably are few and have short value, will be displayed differently. I think that is a better alternative than living with that strange pseudotag.

@matsduf
Copy link
Contributor

matsduf commented Nov 24, 2022

In general, I like the idea in this PR.

ghost
ghost previously approved these changes Nov 25, 2022
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

fine to me to go with the "UNSPECIFIED" or "SYSTEM" tag here

@matsduf
Copy link
Contributor

matsduf commented Nov 25, 2022

fine to me to go with the "UNSPECIFIED" or "SYSTEM" tag here

I guess you mean pseudo module.

@hannaeko
Copy link
Member Author

There is no reason to add the new message to the PO files.

I removed the update of the PO files from the PR.

@matsduf matsduf dismissed their stale review November 28, 2022 08:54

I think this PR would be better with SYSTEM as psedo-module, but I do not object it as-is. It is an improvement to provlde an understandable message to the users.

@hannaeko hannaeko force-pushed the fix-message-timeout branch from 4fb00bc to 56051b8 Compare November 28, 2022 10:55
@hannaeko
Copy link
Member Author

I think I will merge this PR as-is and open a new issue for a more long term solution.

@hannaeko hannaeko merged commit 978c77c into zonemaster:develop Nov 28, 2022
@matsduf matsduf added the S-ReleaseTested Status: The PR has been successfully tested in release testing label Dec 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-High Priority: Issue to be solved before other S-ReleaseTested Status: The PR has been successfully tested in release testing V-Minor Versioning: The change gives an update of minor in version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants