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

[HOLD for payment 2023-04-20] [$4000] Using a header (#) and a space or bold (*), then adding a code block results in the code block being bolded for a moment #15193

Closed
4 of 6 tasks
kavimuru opened this issue Feb 16, 2023 · 109 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@kavimuru
Copy link

kavimuru commented Feb 16, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Open a chat
  2. Start a message with # then a space
  3. Add a code block using three backticks

You should see the code block go bold, then normal.

Expected Result:

A code block should not show bold text.

Actual Result:

Bold text appears temporarily, then reverts to normal text.

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.2.72-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:

Screen.Recording.2023-01-06.at.3.11.31.PM.mov
Recording.1530.mp4

Expensify/Expensify Issue URL:
Issue reported by: @gadhiyamanan
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1672998135151449

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014c5422ceeae647ae
  • Upwork Job ID: 1626059997054926848
  • Last Price Increase: 2023-03-13
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 16, 2023
@MelvinBot
Copy link

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

@melvin-bot melvin-bot bot locked and limited conversation to collaborators Feb 16, 2023
@MelvinBot
Copy link

MelvinBot commented Feb 16, 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

@jliexpensify
Copy link
Contributor

Can reproduce in v1.2.72-0 as well. Seems to be occurring for Android (v1.2.71-1) as well.

@jliexpensify jliexpensify changed the title Code block gets bolded for a moment in the chat Using a # and space, then adding a code block results in the code block being bolded for a moment Feb 16, 2023
@jliexpensify jliexpensify changed the title Using a # and space, then adding a code block results in the code block being bolded for a moment Using a # and a space then adding a code block results in the code block being bolded for a moment Feb 16, 2023
@jliexpensify jliexpensify added the External Added to denote the issue can be worked on by a contributor label Feb 16, 2023
@melvin-bot melvin-bot bot unlocked this conversation Feb 16, 2023
@melvin-bot melvin-bot bot changed the title Using a # and a space then adding a code block results in the code block being bolded for a moment [$1000] Using a # and a space then adding a code block results in the code block being bolded for a moment Feb 16, 2023
@MelvinBot
Copy link

Job added to Upwork: https://www.upwork.com/jobs/~014c5422ceeae647ae

@MelvinBot
Copy link

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

@MelvinBot
Copy link

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 16, 2023
@MelvinBot
Copy link

Triggered auto assignment to @roryabraham (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@eh2077
Copy link
Contributor

eh2077 commented Feb 16, 2023

Just tested using GitHub comment. It should be displayed in bold right?

@jliexpensify
Copy link
Contributor

@eh2077 - code blocks shouldn't be bold at all.

@dgaisan
Copy link

dgaisan commented Feb 16, 2023

Proposal

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

Bold text appears temporarily, then reverts to normal text when sending # ```to send``` message

What is the root cause of the problem?

When the message is synched with the backend it's being changed from the original one:

  • original message: # bold code
  • The message gets HTML-escaped before synching with the backend: <h1><pre>bold code<pre></h1>
  • Then message is send to the backend, and after being processed on the backend it looks as following: <h1></h1><pre>bold code</pre>

Therefore the text flickering (from bold to regular) happens due to this change on the backend.
This can be clearly seen in offline mode: the message stays bold forever, until the app goes back online

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

To make sure everything is consistent I suggest to simply get rid of Bold property in the message before it's even rendered for the first time.
The change can be made in this method
The advantage of this solution is the fact that it's going to be very clean, we won't need to make changes on the backend, and we'll maintain consistency w/o introducing any regressions...

What alternative solutions did you explore? (Optional)

None

@allroundexperts
Copy link
Contributor

allroundexperts commented Feb 16, 2023

Proposal

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

Message turns bold temporarily when enclosed with a # followed by ``` or `.

What is the root cause of that problem?

The frontend parses the expression in a different way then the backend. Frontend encloses the <pre> tag inside the h1 tag while the backend does not enclose the pre tag inside h1.

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

We can change the ExpensiMark # parsing rule such that it ignores adding h1 if pre or code tag is present.
The rule exists here:
https://github.com/Expensify/expensify-common/blob/4f61e5529c89936bfb72b6cee53250990c16f188/lib/ExpensiMark.js#L166

The new regex would look like the following:

/^#(?!#) +(?!<(pre|code)>)(.+)$\s*/gm

The replacement part of this regex needs to be changed as well:

replacement: '<h1>$2</h1>',

This works well after the fix.

Screen.Recording.2023-02-16.at.2.07.00.PM.mov

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

Ignoring the # if any tag is present after it. I think we don't want to do that. We should ignore only if code or pre tag is present.

@moezh
Copy link

moezh commented Feb 16, 2023

Proposal

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

Bold text appears temporarily, then reverts to normal text, when sending # ```code``` .

What is the root cause of that problem?

The problem is related to the way the frontend and backend parse expressions, resulting in differences between the two. Specifically, the frontend sends <h1><pre>code<pre></h1>, while the backend replies with <h1></h1><pre>code</pre>.

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

To address the root cause of the problem, I recommend making the following changes:

  • Adjust the CSS for the "pre" class to prevent it from inheriting font weight and size from its parent.
  • Change the CSS for the "h1" class to use lineHeight instead of marginBottom, to take into consideration that the title might be empty.

I believe that the changes outlined above are the most effective and simple way to address the problem.

Screen.Recording.2023-02-16.at.12.41.19.PM.mov

What alternative solutions did you explore? (Optional)

None

@Santhosh-Sellavel
Copy link
Collaborator

@aimane-chnaif @roryabraham

Not sure whether this is a valid bug here is what Github does

Screen.Recording.2023-02-17.at.1.37.11.AM.mov

@allroundexperts
Copy link
Contributor

@Santhosh-Sellavel Here's how it works on Slack. IMO, it makes more sense to not allow this behaviour.

Screenshot 2023-02-17 at 10 41 23 PM

@Santhosh-Sellavel
Copy link
Collaborator

@allroundexperts Slack doesn't support # styling text as a header as we do. So the behavior aligns with what GitHub does i.e support # for header and code or code blocks

@allroundexperts
Copy link
Contributor

@allroundexperts Slack doesn't support # styling text as a header as we do. So the behavior aligns with what GitHub does i.e support # for header and code or code blocks

You're right. My bad.

@moezh
Copy link

moezh commented Feb 17, 2023

Regardless of whether the code block must appears in bold or normal text, it should not inherit any styling from its parent element. The code block should maintain its own distinct styling and formatting. The code inside <h1></h1><pre>code</pre> or <h1><pre>code</pre></h1> should look identical in terms of formatting and styling.

@moezh
Copy link

moezh commented Feb 17, 2023

After reviewing how GitHub works, the code block does inherit its styling from its parent element. So, please disregard my last message.

@jliexpensify jliexpensify added the Bug Something is broken. Auto assigns a BugZero manager. label Apr 12, 2023
@MelvinBot
Copy link

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

@MelvinBot

This comment was marked as duplicate.

@jliexpensify
Copy link
Contributor

Hi @maddylewis - I'm OOO so assigning to you for the payment + list (here's the amounts)

Upworks job is here: https://www.upwork.com/jobs/~014c5422ceeae647ae

@maddylewis
Copy link
Contributor

thank you so much for the clear instructions @jliexpensify!

i will process these payments by EOD 👍

@maddylewis
Copy link
Contributor

paid!

@aimane-chnaif
Copy link
Contributor

Oh, payment is too early. PR didn't hit the production yet and should also wait for 7 days regression period.

@maddylewis
Copy link
Contributor

well, dammit.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Apr 13, 2023
@melvin-bot melvin-bot bot changed the title [$4000] Using a header (#) and a space or bold (*), then adding a code block results in the code block being bolded for a moment [HOLD for payment 2023-04-20] [$4000] Using a header (#) and a space or bold (*), then adding a code block results in the code block being bolded for a moment Apr 13, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 13, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

MelvinBot commented Apr 13, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.99-6 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-04-20. 🎊

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
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

@MelvinBot
Copy link

MelvinBot commented Apr 13, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@aimane-chnaif / @roryabraham] The PR that introduced the bug has been identified. Link to the PR:
  • [@aimane-chnaif / @roryabraham] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@aimane-chnaif / @roryabraham] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@maddylewis] Determine if we should create a regression test for this bug.
  • [@aimane-chnaif] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@maddylewis] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@gadhiyamanan
Copy link
Contributor

@maddylewis please close the upwork contract
Thanks!

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Apr 19, 2023
@aimane-chnaif
Copy link
Contributor

There's no PR caused regression so we can check off first 3 items.
We already have automated tests with good example cases in expensify-common repo so I think no need regression test step.
@roryabraham do you agree?

@aimane-chnaif
Copy link
Contributor

The regression period is over. No regressions found.
I'd like to discuss timeline bonus/penalty.

Here's summary:

  • Contributor assigned on Mar 23
  • Issue put on hold while working on backend fix
  • Later, we discussed the expected behavior in slack
  • And posted expected result finally landed on Mar 31 - I think this can be actual assign date
  • External PR approved by C+ on Mar 31
  • Waiting period to get approval from @roryabraham
  • @roryabraham came back and reviewed PR on Apr 10
  • External PR merged on Apr 11
  • App PR finally merged on Apr 11

Total days elapsed: 13 business days (Mar 23 - Apr 11)
Hold period: 6 business days (Mar 23 - Mar 31)
Waiting for engineer period: 6 business days (Mar 31 - Apr 10)
So I can say PR was merged within 2 business days without external factors

@maddylewis
Copy link
Contributor

okay, so it sounds like @aimane-chnaif and @situchan are both eligible for the 50% merge bonus. is that correct?

would the bonus be 50% of the final payment or the original payment (ie, $500 or $2000)?

@aimane-chnaif
Copy link
Contributor

final payment

@maddylewis
Copy link
Contributor

offers sent

@gadhiyamanan
Copy link
Contributor

@maddylewis just a reminder to close the Upwork contract

@maddylewis
Copy link
Contributor

payments sent - i believe we are all set here.

@melvin-bot melvin-bot bot added the Overdue label Apr 24, 2023
@melvin-bot melvin-bot bot removed the Overdue label Apr 24, 2023
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
Projects
None yet
Development

No branches or pull requests