Closed effigies closed 3 months ago
Attention: Patch coverage is 84.14634%
with 13 lines
in your changes missing coverage. Please review.
Project coverage is 87.13%. Comparing base (
e93fd01
) to head (40ef8be
).
Files | Patch % | Lines |
---|---|---|
bids-validator/src/schema/context.ts | 20.00% | 12 Missing :warning: |
bids-validator/src/files/json.ts | 96.29% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This implements standard issues:
Because
BIDSFile.text()
is intended to mimic the behavior ofFile.text()
and replace unknown characters, it's unsuited to validating JSON, which needs to be actual UTF-8. Further, pipingBIDSFile.stream
through aTextDecoderStream
can reliably cause resource leaks on UTF16 data (https://github.com/denoland/deno/issues/24872). Therefore I've reimplemented reading withreadBytes()
followed by an all-at-once decoding, which seems to be safer.The main bit of interest is in passing options toTextDecoderStream
to ensure we catch bad unicode. This creates a divergence with the browser implementation, so we would need to decide what the best API is. I could switch to usingfile.stream
directly.There appears to be a bug inTextDecoderStream
(https://github.com/denoland/deno/issues/24872) that prevents us cleaning up properly. So the subtests all pass, but the whole JSON UTF-16 test fails due to a detected leak.