Commit Graph
5 Commits
Author SHA1 Message Date
aiongg c010bedef4 chore: check the WebAssembly build of the library
tools/check_wasm.sh builds the library for wasm32-unknown-unknown,
then builds a probe module (a cdylib generated under the target
directory that exports a function calling `indd::convert`) and checks
with Node.js that the module imports nothing: a conversion needs no
file system, clock or other host function. It then converts the
fetched fixtures, or the files given, in the probe module and compares
each package byte for byte with the native `indd convert` output.

No library change was needed: only `convert_file` and `read_header`
use `std::fs`, and `convert` does not call them. The 5 fixtures and 80
corpus files give the same packages in WebAssembly as natively. The
check takes about 10 s; it is documented in CLAUDE.md, CONTRIBUTING.md,
README.md and ARCHITECTURE.md. There is no hosted CI.

Idea from storytold/designcraft#98.
2026-10-08 04:18:22 +00:00
aiongg 057a4b934d test: convert damaged documents without panics or hangs
`src/hostile.rs` converts damaged inputs and fails if a conversion
panics or takes longer than 20 s:

- Synthetic documents built from a seed with `database::synthetic`: a
  document object with well-formed lists, spreads that hold spread
  layers, pages and page items, and objects of the model's classes with
  chunks of the model's IDs (taken from the hexadecimal constants of the
  model sources). Chunk data is shaped like UID lists, child lists,
  attribute lists, strings and numbers, or random. Each document is
  converted as built, with one object truncated, with bytes flipped, and
  with the file image truncated, through the model and the IDML writer.
- The fixture files, if fetched: truncated at structure boundaries and
  random lengths, and with 1 to 64 bytes flipped, a quarter of the cases
  in the header and master pages.

The cases come from a fixed seed and run on all cores, with a watchdog
for hangs. The default sweep has about 1,600 cases and takes 2 s in a
debug build and 0.5 s in a release build (16 cores).
INDD_HOSTILE_SCALE multiplies the cases and INDD_HOSTILE_SEED changes
the seed; sweeps at scale 40 with seeds 0x1DD and 7 (about 63,000 cases
each, debug build with overflow checks) found no panic or hang.

Idea from storytold/designcraft#98.
2026-10-08 04:18:22 +00:00
aiongg 758a12a92e docs: list the applied object style module in ARCHITECTURE.md 2026-10-07 22:34:22 +00:00
aiongg 14b36ee317 docs: list the graphic, export option and XMP modules in ARCHITECTURE.md 2026-10-07 21:26:39 +00:00
aiongg ae5a44db3a docs: add ARCHITECTURE.md and CONTRIBUTING.md; bring the README up to date
The README listed implemented features as not started, an old attribute
count, corpus size and numbers, and no library use. The numbers are from
compare.py --all with schema validation at this revision.
2026-10-07 20:07:28 +00:00