-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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-03-01] [$1000] Trailing line break is not working inside three backticks messages on the web #14694
Comments
Triggered auto assignment to @mallenexpensify ( |
Tested, can confirm it's happening. I updated the OP
@jayeshmangwani you'll still be compensated as the bug reporter if we fix this, just wanted to make sure all instances were addressed. Moving to engineer to confirm this can be |
Job added to Upwork: https://www.upwork.com/jobs/~01888fcd2426613ce9 |
Current assignee @mallenexpensify is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav ( |
Triggered auto assignment to @bondydaa ( |
Proposal RCA
converts to html <pre><br />test<br /></pre> But html will not display the last newline represented by the last Solution
to html <pre><br />test<br /><br /></pre> which will display necessary new trailing line breaks. And also remove a trailing new line when translating html to markdown, which will avoid an extra trailing new line shown when editing a sent message. If you want to verify the solution, you can apply the following diff to expensify common module diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js
index 7f94ffe..b6cb064 100644
--- a/lib/ExpensiMark.js
+++ b/lib/ExpensiMark.js
@@ -31,7 +31,7 @@ export default class ExpensiMark {
// will create styling issues so use  
replacement: (match, __, textWithinFences) => {
const group = textWithinFences.replace(/(?:(?![\n\r])\s)/g, ' ');
- return `<pre>${group}</pre>`;
+ return `<pre>${group}<br /></pre>`;
},
},
@@ -268,7 +268,7 @@ export default class ExpensiMark {
{
name: 'codeFence',
regex: /<(pre)(?:"[^"]*"|'[^']*'|[^'">])*>([\s\S]*?)<\/\1>(?![^<]*(<\/pre>|<\/code>))/gi,
- replacement: '```\n$2\n```',
+ replacement: '```\n$2```',
},
{
name: 'anchor', |
ProposalProblemThe regular expression that matches the code fence block consumes the last new line. SolutionFirst ruleFix the expression to match the newline the same way it does currently, but without consuming it. With: + regex: /(```[\n]?)((?:\s*?(?![\n]?```(?!`))[\S])+\s*?)((?=\n?)```)/g, The difference is replacing Second ruleWhen editing a comment with a code block, the second The other proposal changes it to not add a new line because it assumes that the comment was added by the first rule, which has been changed to always add a new line in that proposal. I believe that neither is a reliable solution. Each rule should work independently of the other and not always add lines with no relation to the existing lines in the block. In the case of the first rule, it means not changing the existing lines. In the case of the second rule, it means to add a new line only if the ending triple tick would not occupy a separate line. + regex: /<(pre)(?:"[^"]*"|'[^']*'|[^'">])*>([\s\S]*?)(\n?)<\/\1>(?![^<]*(<\/pre>|<\/code>))/gi, , which adds and the line below it with + replacement: (match, g1, g2, g3) => '```\n' + g2 + (g3 || '\n') + '```', , which adds |
@marktoman's proposal looks cleaner and simple to implement. I think we should go with that. @bondydaa what do you think? |
Yeah I think we'd prefer to fix this with the regex. that one is a doosy so I would also suggest making sure we update the tests https://github.com/Expensify/expensify-common/blob/aaf49708420187a13ebe3bdb97b67104e6a6bcfc/__tests__/ExpensiMark-Markdown-test.js to also verify the extra line(s) being persevered. |
📣 @marktoman You have been assigned to this job by @bondydaa! |
Hi @mananjadhav and @bondydaa I think my proposal will be the better solution because it avoids breaking following regression cases
```
test
```
```
test
``` I also recorded a video to show it codefence-regression.mp4As the video shows, my proposal will ensure the line break of both the html and markdown are correct. But @marktoman 's proposal will bring regression for markdown line break issue. Really hope you would take the above into consideration. Thanks for the reviewing! |
@eh2077 That is another unrelated bug, which is when you edit a code block, it adds a new line. Your solution strips every last line whether it should be there or not, so while it appears to fix both problems, in reality it introduces regression for every case where the last line is supposed to be there. |
I've added a solution for the other bug. |
The extra line break I'd like to compare the differences of our proposal through following cases based on the latest updated version of your proposal. Case 1Currently by sending a new message, below code fence ```
test
``` is translated to <pre><br />test<br /></pre> and both our solution will translate the markdown into <pre><br />test<br /><br /></pre> Note the Case 2Currently if you edit a sent message, there'll be an additional trailing line break in the markdown. As you pointed out, this is an another unrelated bug. Both of our proposals will fix it for new saved messages and historical messages. Case 3Currently if you edit a sent message and save changes(no matter has changes or not), no extra trailing line break will be added to Case 4For historical saved code fence messages, both of our proposal can't get enough information to fix the potential previous missing trailing line break. If you want to test it, you can send the following two code fence block before applying the patch ```
original code fence with two trailing line breaks, which will show one trailing line break
``` ```
original code fence with three trailing line breaks, which will show two trailing line breaks
``` ConclusionThough both of the proposals fix the issue, my proposal has the following advantages 1. Simple. It's easy to understand and doesn’t add extra complexity to the magic regex expression |
@marktoman @jayeshmangwani @mananjadhav can you please accept the job and reply here once you have? |
Accepted @mallenexpensify |
@bondydaa I was looking at the original PR that caused this issue and it looks like the first newline handling was done in Expensify/expensify-common@36531c0 (PR Expensify/expensify-common#376). But I wouldn't mark it is a regression PR because the regex did what was expected as per the GH issue. Let me know what you think. |
👍 yeah I agree with that assessment. |
I left an Upwork-specific question on the contract proposal @mallenexpensify |
Replied there @marktoman |
Accepted @mallenexpensify |
Thanks for the test steps @marktoman @mananjadhav do you have read-only access to TestRail yet? If so, can you access this - https://expensify.testrail.io/index.php?/cases/view/1971213 ?
|
@marktoman it appears you were hired on 2/1 and the PR was merged on 2/20 which is 13 biz days. We have
Before I subtract 50% from the pay for you and @mananjadhav , do either of you have reasoning to provide why it shouldn't be deducted? Thanks |
@mallenexpensify There were two PRs: 1) to expensify-common, 2) to App. The first one merged quickly and covered everything discussed here. On the second PR, I found a separate issue. I would expect the second problem to occur as a new issue at some point if I would not solve it under this one. |
@mallenexpensify As @marktoman mentioned, there were two PRs and here's link of the problem they reported in rendering, which took sometime to resolve. Plus I was out sick during that period that I wasn't helpful in resolve it faster. |
Thanks for the context. @mananjadhav what do you propose the payment breakdown should be here? |
Quick question @mallenexpensify, if we would've put the issue on Hold when we found the issue, would it still impact the payment here? If the answer is that it wouldn't have impacted, then would be great if we can make an exception here and do the 1000$ payout. If the answer is, it would still impact during the hold period, then I think it's fair to have the 50% deduction penalty. |
Thanks @mananjadhav , this appears to be an edge case because of the non-E/App repo and because the PR was put on hold which slowed things down. I propose we do the full $1000 payout for @marktoman and @mananjadhav for C+. @bondydaa and/or @mananjadhav can you add a comment to confirm you're OK with this then I'll issue payments. |
I am definitely okay ;) Should we wait for @bondydaa to confirm? Ohh and I recently asked how do we want to treat two PRs, I think @mallenexpensify you should look at the response. (which might warrant for a deduction) Response is:
|
@mananjadhav, @bondydaa, @mallenexpensify, @marktoman Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
@mananjadhav, @bondydaa, @mallenexpensify, @marktoman Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Thanks @mananjadhav , I didn't piece 2-2 together when I saw that Slack post last week. I get the reasoning behind 'repos we control', I'm unsure we make it clear in CONTRIBUTING.md or other guides how we manage multiple PRs (nor.. if we have to, at least right now). The one part I'm unsure on is that the two PRs weren't able to be worked on in tandem, correct? If that's so, then the contributor shouldn't be penalized while they're waiting for one PR to be merged or hit production because they're able to post the next PR. @bondydaa can you take a peek when you're back on tomorrow? |
I think the difference here is we fixed the reported issue, and also a probable future issue and that held the PR. The more we discuss, I feel we shouldn't penalize for solving it right. Still waiting for @bondydaa to chime in on this one. |
@mallenexpensify @bondydaa do we have any update here? Been pending since long. |
Sorry was OOO most of the past 2 weeks. Yep I don't think we should reduce the pay here, any delays here were due to the 2 PRs or people being OOO so not really in the control of those involved so I think $1000 makes sense. |
Thanks @bondydaa and everyone else for the patience @jayeshmangwani paid $250 for reporting 📕 |
Thanks @mallenexpensify and @bondydaa |
Correct, they cannot. I tried to parallelize them on another issue but had to wait. (Everything clicked there, including C+ staying up till 4 am to match the opposite timezone, the internal engineers being immediately responsive, and me having a commit and everything uploaded before being assigned, so no decrease there, but only just.) |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
line break should reflect in the message
Actual Result:
line break is being ignored and there is no space at the end of the message ends.
NOTE
What appears to be happening is that one less line break is shows than added so...
1 line break added doesn't show
2 line breaks added shows 1
and so on, so the deliverable is to fix all instances of "one less line break added" and not just the instance of a single line break not showing
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.2.62-1
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:
Recording.1412.mp4
Expensify/Expensify Issue URL:
Issue reported by: @jayeshmangwani
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1675110851241419
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: