Page MenuHomePhabricator

Correct a prose diff behavior when prose pieces include newlines
ClosedPublic

Authored by epriestley on May 30 2020, 9:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 10:50 AM
Unknown Object (File)
Wed, Dec 11, 7:14 AM
Unknown Object (File)
Mon, Dec 9, 9:57 PM
Unknown Object (File)
Sat, Dec 7, 9:25 AM
Unknown Object (File)
Thu, Dec 5, 7:57 PM
Unknown Object (File)
Tue, Dec 3, 12:17 PM
Unknown Object (File)
Mon, Dec 2, 9:55 AM
Unknown Object (File)
Sat, Nov 30, 12:33 AM
Subscribers

Details

Summary

See https://discourse.phabricator-community.org/t/bad-regex-in-prose-diff-logic/3969.

The prose splitting rules normally guarantee that newlines appear only at the beginning or end of blocks. However, if a prose sentence ends with text like "...x\n.", we can end up with a newline inside a "sentence".

If we do, the regular expression that breaks it into pieces will fail.

Arguably, this is an error in how sentences are split apart (we might prefer to split this into two sentences, "x\n" and ".", rather than a single "x\n." sentence) but in the general case it's not unreasonable for blocks to contain newlines, so a simple fix is to make the pattern more robust.

Test Plan

Added a failing test which includes this behavior, made it pass.

Diff Detail

Repository
rP Phabricator
Branch
prose1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 24532
Build 33807: Run Core Tests
Build 33806: arc lint + arc unit

Event Timeline

This revision was not accepted when it landed; it landed in state Needs Review.May 30 2020, 9:11 PM
This revision was automatically updated to reflect the committed changes.

thanks. I can confirm the change lets the daemon finish the task and renders a reasonable diff.