Skip to content

v1.7 (VS Code extension 0.3.1)

Choose a tag to compare

@nivaca nivaca released this 12 Nov 20:18
· 16 commits to main since this release

validate.py 1.7: fixes schema-cache failures under concurrent runs

When several validations ran at once (e.g. VS Code validating multiple open files after a reload), one run could read a downloaded schema while another was still writing it, and fail with:

El esquema …-smtrad-schema.rng no es XML bien formado: Premature end of data …

The truncated copy then stayed in the cache, so every later run failed too, until --refresh.

  • Atomic cache writes. Downloaded schemas and the harvested and extracted .sch files are written to a temporary file and renamed into place only when complete. Other runs see either nothing or the whole file, and an interrupted write leaves nothing behind.
  • Damaged copies are replaced. A damaged cached copy left by an older version is detected and re-downloaded or regenerated.
  • Bad downloads are never cached. A download that isn't well-formed XML is reported and not stored.
  • Harvest self-check before writing. The harvest self-check now runs on the serialized bytes before anything is written.

Stress test (one process re-downloading with --refresh for 20 s while three others validate): the old code failed 88 of 635 reads; 1.7 failed 0 of 513.

VS Code extension 0.3.1

This release only bundles validate.py 1.7; the extension's behaviour is unchanged.

code --install-extension validate-schematron-0.3.1.vsix