Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-REVIEW-004

A review comments file with any problem or over its limits is ignored with one warning

When any part of the review comments file of a shown document is not valid or goes over one of its limits, the extension SHALL read no thread from it, show one warning naming the file and the first problem once for each distinct content of the file, and refuse every change to it.

Another outcome at step 1 of path 1 in StRS-MDOKFSTUDIO-REVIEW-001, in the state “A document with a review comments file is shown”.

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

Scenarios 7

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

refusalWrong shape of the file
InputOutcome
An empty fileError "the sidecar is not valid JSON"; no thread is returned
A file that is not JSONError "the sidecar is not valid JSON"; no thread is returned
A JSON arrayError "the sidecar must be a JSON object"; no thread is returned
A file of version 2Error "unsupported sidecar version (expected 1)"; no thread is returned
A file without a document nameError "the sidecar needs a document name"; no thread is returned
A file without a threads listError "the sidecar needs a threads array"; no thread is returned
refusalOne bad thread rejects the whole file
Givena file with one valid thread and a second thread with an empty id, a non-boolean resolved flag, a non-string body, a creation date that is not an ISO 8601 date-time with a zone ("yesterday", "2026-13-45T99:00:00Z" or "2026-02-30T10:00:00Z", a day that does not exist in its month; 2024-02-29 is a real day, 2026-02-29 is not), no comment, a line of 0, an endLine before its line, or the id of an earlier thread
Whenthe file is read
Thenan error is reported, the whole file is rejected and the valid thread is not returned either
boundaryLimits of the file
InputOutcome
A text of exactly 2 MiB or lessRead
A text of more than 2 MiBError "the sidecar is larger than 2097152 bytes"; no thread is returned
A comments file on disk larger than 2 MiBThe host does not read the file but hands the parser a stub of the limit length plus one, so the same error appears
Exactly 1000 valid threadsNo error; 1000 threads are returned
1001 threadsError; no thread is returned
A thread with exactly 200 commentsNo error
A thread with 201 commentsError; no thread is returned
A comment body of exactly 10 000 charactersNo error
A comment body of 10 001 charactersError; no thread is returned
refusalFirst sight of an invalid file
Givena comments file that is not valid JSON
Whenits document is rendered
Thenthe warning "The review comments file {name} is not valid and is ignored: the sidecar is not valid JSON." is shown once and no thread is posted
boundarySame content again
Giventhe same invalid content read again on the next render
Whenthe threads are posted again
Thenno second warning appears; changed invalid content warns again
refusalChange while the file is not valid
Givena comments file holding {not json
Whena comment is saved
Thenthe page is told the comments file is not valid and is left untouched, and the file text is unchanged
nominalChange when the file is valid
Givena valid comments file
Whena comment is saved
Thenthe change is written

Implemented in 3

Tested by 5