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)
Thu, Nov 21, 9:20 AM
Unknown Object (File)
Sun, Nov 17, 3:22 PM
Unknown Object (File)
Sun, Nov 3, 8:11 AM
Unknown Object (File)
Tue, Oct 29, 8:43 PM
Unknown Object (File)
Sun, Oct 27, 7:24 AM
Unknown Object (File)
Sun, Oct 27, 6:29 AM
Unknown Object (File)
Oct 19 2024, 1:03 AM
Unknown Object (File)
Oct 16 2024, 6:56 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.