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

[Paid] [$500] Safely catch translation key when it's wrong/missing #27759

Closed
JmillsExpensify opened this issue Sep 19, 2023 · 24 comments
Closed
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@JmillsExpensify
Copy link

JmillsExpensify commented Sep 19, 2023

We've had several bad scenarios where the app crashes because the wrong translation key was used. We expect this to start increasing as we add "workspace violations" because these violations come directly from the API (and aren't translated).

Some ideas discussing with @mountiny and @cead22 on how to potentially handle this:

  • Throw some error locally, and if in staging or production, add a fallback option for these keys which are expected to come from the backend
  • Show an empty string instead of crashing, and maybe overkill but we could show MISSING TRANSLATION to @expensify.com users

Or something else. While this is out of scope for the internal project, we wanted to get an agency working on this one.

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01da041a99d48079d8
  • Upwork Job ID: 1704697208410533888
  • Last Price Increase: 2023-09-21
  • Automatic offers:
    • dukenv0307 | Contributor | 26899854
@JmillsExpensify JmillsExpensify added Weekly KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 19, 2023

Triggered auto assignment to @strepanier03 (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Sep 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 19, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@strepanier03
Copy link
Contributor

@JmillsExpensify - In this case would I label this internal or should I leave it be for now? I don't want it held up because I'm not sure what to do with it. Thanks for the direction.

@mountiny mountiny added the External Added to denote the issue can be worked on by a contributor label Sep 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 21, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01da041a99d48079d8

@melvin-bot melvin-bot bot changed the title Safely catch translation key when it's wrong/missing [$500] Safely catch translation key when it's wrong/missing Sep 21, 2023
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 21, 2023

Current assignee @strepanier03 is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Sep 21, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @robertKozik (External)

@dukenv0307
Copy link
Contributor

While this is out of scope for the internal project, we wanted to get an agency working on this one.

@mountiny @JmillsExpensify is this open to External contributor or will be assigned to an agency?

@mountiny
Copy link
Contributor

Asking agency but if you can create a good proposal, we can go with contributor too

@dukenv0307
Copy link
Contributor

dukenv0307 commented Sep 21, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

We want to safely catch translation key when it's wrong/missing

What is the root cause of that problem?

Currently it will crash in non-production environment as in here.

What changes do you think we should make in order to solve the problem?

We should follow the approaches highlighted in the OP, I think they are good ideas already

  1. Update this line to include staging, so it won't crash on staging
  2. Currently we're displaying the translation key on prod in case the translation is missing. If we want to display empty string then can change the logic here to return empty string.

To show MISSING TRANSLATION to @expensify.com users, we can check the login (by connecting to the ONYXKEYS.SESSION), if it's from those users then will return MISSING TRANSLATION

add a fallback option for these keys which are expected to come from the backend

If we have fallback text for the keys coming from back-end, we can add a fallback as another param in translate, if it's defined, in 2 above we'll return that instead of empty string/MISSING TRANSLATION. Some related functions like translateLocal will need the param too.

What alternative solutions did you explore? (Optional)

We can consider throwing the error locally if the translation is missing for the user-chosen language too, since it's unexpected behavior. Currently it will only send an alert to the server.

@mountiny
Copy link
Contributor

Seems quite good, @robertKozik can you please review the proposal thoroughly?

@melvin-bot melvin-bot bot added the Overdue label Sep 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 26, 2023

@strepanier03, @robertKozik Huh... This is 4 days overdue. Who can take care of this?

@robertKozik
Copy link
Contributor

I like your proposals as well @dukenv0307. It ticks all the boxes provided in the issue description. Moreover I would suggest that MISSING TRANSLATION string should be also visible when running Expensify app locally - It should help both Contributor and Contributor+ to track them while checking the PRs.

Also I'm not the huge fan of returning empty string in place of translation key. Providing some context (even as translation key) can be helpful in certain scenarios, as it informs the user that there should be additional information available.

@mountiny All in all I think we can go with this proposal

@melvin-bot melvin-bot bot removed the Overdue label Sep 26, 2023
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 27, 2023

📣 @dukenv0307 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@mountiny mountiny self-assigned this Sep 27, 2023
@dukenv0307
Copy link
Contributor

dukenv0307 commented Sep 28, 2023

@mountiny @robertKozik Please help review this draft PR: #28377
This PR is updated to

  1. Logging translation errors in both Production and Staging
  2. Showing " MISSING TRANSLATION" to @expensify users

If we have fallback text for the keys coming from back-end, we can add a fallback as another param in translate, if it's defined, in 2 above we'll return that instead of empty string/MISSING TRANSLATION. Some related functions like translateLocal will need the param too.

As mentioned in my proposal, I believe I need more guidance on

  • How are the APIs gonna return fallback text
  • How to test the PR locally

Please let me know if any concerns

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Oct 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @dukenv0307 got assigned: 2023-09-27 06:57:58 Z
  • when the PR got merged: 2023-10-09 13:19:00 UTC
  • days elapsed: 8

On to the next one 🚀

@sonialiap
Copy link
Contributor

I'm seeing this error message in a weird spot. I'm guessing that's a separate issue, but sharing just in case https://expensify.slack.com/archives/C049HHMV9SM/p1696940644742429

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 11, 2023
@melvin-bot melvin-bot bot changed the title [$500] Safely catch translation key when it's wrong/missing [HOLD for payment 2023-10-18] [$500] Safely catch translation key when it's wrong/missing Oct 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 11, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 11, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.80-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-10-18. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter - N/A, internal report
  • Contributor that fixed the issue - @dukenv0307 - $500 via Upwork
  • Contributor+ that helped on the issue and/or PR - @robertKozik no payment needed.

For reference, here are some details about the assignees on this issue:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot

This comment was marked as off-topic.

@robertKozik
Copy link
Contributor

@mountiny @strepanier03 Is BugZero Checklist applicable here? This issue got more like new feature vibe

@mountiny
Copy link
Contributor

Not applicable

This is ready for a payout once the date is met $500 to @dukenv0307

@melvin-bot
Copy link

melvin-bot bot commented Oct 12, 2023

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@strepanier03
Copy link
Contributor

Okay, this is ready to be paid tomorrow and be closed. Will take care of then.

@strepanier03 strepanier03 changed the title [HOLD for payment 2023-10-18] [$500] Safely catch translation key when it's wrong/missing [Paid] [$500] Safely catch translation key when it's wrong/missing Oct 18, 2023
@strepanier03
Copy link
Contributor

All paid out and closing. Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants