Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-REVIEW-012

The host posts the threads of the review comments file and follows its changes

When a document is shown or its review comments file is created, changed, deleted or written by the Studio, the extension SHALL post the current threads of the file to the page with their comments, anchors, resolved flags and orphaned verdicts, once for each distinct content, never from a read that a newer read overtook and never from a read that failed.

Step 1 of path 1 in StRS-MDOKFSTUDIO-REVIEW-001: from “A document with a review comments file is shown” to “The threads reach the page”.

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

Scenarios 11

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

nominalValid file
Givena comments file with one thread quoting "second paragraph" whose comment body is `<b>Why?</b>`
Whenthe preview renders
Thenthe page receives that thread with the body as stored
nominalOrphan verdict
Givena thread whose quote the document no longer holds
Whenthe threads are posted
Thenthe thread is posted with orphaned true and its stored lines
boundaryDocument that is not a saved file
InputOutcome
A preview of an untitled document, or of another scheme than fileNothing is posted, whatever files exist
A preview of a document saved as a fileThe threads of its comments file are posted
boundaryDocument without a comments file
InputOutcome
A document with no comments file and no threads shown beforeNo previewComments message is posted
A preview that showed threads and whose comments file was deletedAn empty list is posted so the page removes them
nominalChange of the file outside the Studio
InputOutcome
A preview that shows two threads and a comments file rewritten with one thread, the file watcher firesThe page receives the one thread after a debounce of 150 ms
A comments file created next to a document that had noneThe threads of the new file are posted
refusalThe same threads are not posted twice
InputOutcome
A comment just written by the Studio, the file watcher reports the writeNo second post is made
The same comments file text after the lines followed in memory were dropped (see SwRS-MDOKFSTUDIO-REVIEW-119)The text is not skipped: the anchors are checked again, and a post is made only if the threads differ
A page that already shows the threads, the document renders againThe same threads are not posted again
boundaryRead overtaken by a newer read
InputOutcome
Two changes of the comments file in quick succession, the first read ends after the second startedOnly the result of the second read is posted
One change of the file, the read endsIts result is posted
A post overtaken by a newer post while it checks the anchors against the document, both reading the same new textThe newer post shows the new threads; the overtaken one posts nothing and does not mark the text as shown
refusalA read of the comments file that fails
InputOutcome
A preview that shows a resolved thread whose open popover the reader uses, the next read of the existing comments file fails (busy, denied, interrupted)Nothing is posted: the page keeps its threads and the popover stays open; the next successful read is posted as usual
A preview that showed threads and a read that finds the file missingAn empty list is posted so the page removes the threads (see the boundary "Document without a comments file")
boundaryThe watch of the comments file is released
InputOutcome
The preview shows another document, so another comments fileThe watcher of the previous file and its three change, create and delete subscriptions are all disposed; the live count stays at one watcher and three subscriptions
The preview closesThe watcher and its three subscriptions are disposed; disposing twice is harmless
nominalAfter a write by the host
InputOutcome
A comment just written, the write endsThe page receives the new list of threads
A refused change, the host answersNo new list is posted by the write
refusalShape of the threads message the page accepts
InputOutcome
previewComments with a threads list of threads (id, anchor, resolved, createdAt, comments, optional boolean orphaned) and the render fieldsThe page shows the threads
previewComments whose threads is not a listThe page keeps no thread
A thread without a non-empty string id, with an anchor line that is not an integer of at least 1, or with comments that are not a listThe page drops that thread and keeps the others
More than 1000 threads, or more than 200 comments in a threadThe page keeps the first 1000 threads and the first 200 comments of a thread
A text that is not a string, or longer than 10 000 charactersThe page uses an empty string, or the first 10 000 characters

For an invalid file the host posts no thread and shows one warning, see SwRS-MDOKFSTUDIO-REVIEW-004. The page accepts the message only when it is addressed to its render, see SwRS-MDOKFSTUDIO-TRUST-059.

Implemented in 1

Tested by 4