Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-REVIEW-100

A thread follows its quote in the plain text, narrowed by its context, or is orphaned and keeps its lines

When the quote of a review thread is no longer in its old lines but occurs in the document at one place, the extension SHALL move the thread to the lines of that place, and, when the quote cannot be found and its old lines do not resemble it, mark the thread as orphaned and keep its stored lines and comments

Another outcome at step 1 of path 1 in StRS-MDOKFSTUDIO-REVIEW-008, in the state “The text of a document with review threads changes”.

Part of StRS-MDOKFSTUDIO-REVIEW-001, outside the paths drawn on its map.

Scenarios 13

The situations the tests check; open one to read it.

nominalA thread follows its quote to the line where it moved
Givena thread on line 3 and lines inserted above, so that the quote is now on line 9
Whenthe thread is checked
Thenthe thread moves to line 9
nominalUnchanged threads are kept
Givena list of threads of which one moved, one is orphaned and one is in place
Whenthe threads are checked
Thenonly the moved thread gets new lines and no thread is lost
nominalSeveral copies are narrowed by the prefix and suffix of the thread
Giventwo copies of "fix the login flow" and a thread with prefix "Do not " and suffix " today."
Whenthe thread is checked
Thenthe thread moves to the copy with that surrounding
a second thread with prefix "Please " and suffix " soon." moves to the other copy
boundaryWithout usable context only the nearest copy within 50 lines counts

When several copies remain and the surroundings do not decide, the thread moves to the nearest copy only if it lies within 50 lines (WINDOW_LINES) of the old lines and is strictly nearer than the next copy.

InputOutcome
a thread on line 205 and copies on lines 11 and 212the thread moves to line 212
copies only outside the windowthe thread is orphaned
two copies at the same distancethe thread is orphaned
boundaryDistance allowed for a short and for a long quote
InputOutcome
a thread on line 3 quoting Fox (fewer than 12 characters, MIN_FAR_QUOTE) and a copy 20 lines furtherthe thread moves there
the same short quote only 200 lines furtherthe thread is orphaned
a thread on line 4 and a long quote (at least 12 characters) occurring exactly once, now on line 301the thread moves to line 301, however far it is
a long quote occurring twice, far from the old linesthe thread is orphaned
nominalThe quote is searched in the plain text of the document

The searched text has block markers, link targets, emphasis marks, table pipes and rules, HTML tags and comments and footnote markers removed, entities decoded and whitespace collapsed. A MyST role is read as the text it renders: the content of a role such as {kbd}`Ctrl`, and nothing for a role that renders a label the source does not hold, such as {cite} and {ref} without text.

InputOutcome
a list item "see **the quick** brown [fox](https://example.com) now" and the quote "the quick brown fox now"the thread is found on that line
a line "Tom & Jerry went home. `<!-- TODO fix -->`" and the quote "Tom & Jerry went home."the thread stays on that line
the source "Press {kbd}`Ctrl` to continue." and the quote "Press Ctrl to continue."the thread stays anchored
the source "As shown in {cite}`smith2020` the result holds." and the quote "As shown in Smith, 2020 the result holds."the thread stays anchored at its original line
refusalCode fences and front matter are never searched
Givena quote that occurs only in a fenced code block and in the front matter
Whenthe thread is checked
Thenthe thread is orphaned
when the quote also occurs in a paragraph, the thread is found in the paragraph
boundaryA quote spanning several lines, also in a CRLF document
InputOutcome
the quote "brown fox jumps over the lazy" over lines 3 to 5the thread moves to lines 3 to 5
the same document with CRLF line endsthe result is the same
nominalA deleted quote orphans the thread
Givena thread on line 3 and a document without the quote
Whenthe thread is checked
Thenthe state is orphaned and the lines are still 3 to 3
nominalAn orphan among several threads is untouched
Givena thread list with one orphan
Whenthe threads are checked
Thenthe orphan keeps its lines 4 to 6 and its comments, the orphan set holds the thread id and the thread object is unchanged
boundaryThe old lines are checked before the cap of 200 candidates
Given300 lines holding the word item and a thread on line 301
Whenthe thread is checked
Thenthe thread stays anchored on line 301, because a quote that occurs in more than 200 places is still looked for in the old lines first
for a quote with more than 200 copies and no copy in the old lines, at most 200 copies are examined (MAX_CANDIDATES)
refusalSurroundings that disagree prevent a move
InputOutcome
a thread quoting Overview (a short quote) with prefix "Intro: " and a document where the word has other surroundingsthe thread is orphaned
two copies of the quote and none that matches the stored prefix and suffixthe thread is orphaned
boundaryOld lines that still resemble the quote keep the thread

When the quote has no acceptable place but at least 60 percent of its words occur in order in the old lines (RESEMBLANCE = 0.6), or the old lines hold a role that renders text the source lacks, the thread stays on those lines.

InputOutcome
the quote "The scheduler stops after the first problem" and the old line "The scheduler stops after a first problem happens."the thread stays anchored
a quote with no word in common with the old linesthe thread is orphaned

Implemented in 1

Tested by 1

Replaces

SwRS-MDOKFSTUDIO-REVIEW-101A thread whose quote is gone or ambiguous is orphaned and keeps its lines superseded superseded by SwRS-MDOKFSTUDIO-REVIEW-100 Markdown file