Skip to content

test: pin encapsulated write, latin1 fallback, and CS multi-value length behavior - #526

Merged
awatson1978 merged 1 commit into
release/1.0-beta-corefrom
core/bank-encapsulated
Sep 29, 2026
Merged

awatson1978 merged 1 commit into
release/1.0-beta-corefrom
core/bank-encapsulated

Conversation

@awatson1978

@awatson1978 awatson1978 commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Another installment of the regression bank: suites that document what the writer and reader already do correctly on this branch, with the still-broken cases checked in as it.skip entries carrying their issue numbers. Nothing in the library changes here — the point is that these behaviors can't quietly regress while the engine work proceeds, and each skip is an executable to-do for the fix passes.

test/issues/issue293-encapsulated-write.test.js covers writing encapsulated pixel data — the DICOM layout where compressed frames are stored as a list of fragments rather than one contiguous block. Five upstream reports are pinned. #293: odd-length frames must be padded inside each frame's final fragment, not with a single pad byte at the end of the whole tag (pydicom parity). #159: writing 120 frames of 64 KB completes in bounded time and size — upstream, per-fragment concatenation was quadratic and froze the browser tab. #161: an OW element inside a sequence item writes without the old "Cannot read property 'fragmentMultiframe' of undefined" crash. #90: a sequence that was read with a defined length is legally rewritten with undefined length; semantic equality is the pinned contract, and byte-identity of the length encoding is a documented non-goal of the eager writer. #340 is the suite's KNOWN GAP: RLE Lossless requires exactly one fragment per frame, but the default write re-fragments frames larger than 20 KB, so that pin is skipped — while the workaround contract, write({ fragmentMultiframe: false }) preserving one fragment per frame, is pinned green. The structural assertions parse the writer's output with an independent byte walker (test/issues/part10Walker.js), so the writer isn't grading its own homework.

test/issues/issue297-latin1-fallback.test.js targets mobile and embedded JS runtimes (react-native, Hermes without full ICU) where new TextDecoder("latin1") throws. dcmjs currently constructs that decoder at module load, so on those runtimes the library fails at import time and never even reaches readFile. That whole scenario is the suite's skipped KNOWN GAP #297; a control test pins that the same file parses fine under a normal TextDecoder.

test/issues/issue487-cs-multivalue-length.test.js pins the length contract for CS (Code String — 16 characters max per backslash-separated component). Some vendors ship private tags declared CS with much longer values, and upstream there was no escape hatch to copy them through. The pinned contract: reads are lenient, the default write throws an error that names the offending value, and { allowInvalidVRLength: true } writes it as-is.

it("default strict write throws a message naming the offending value", () => {
    const d = makeDict();
    d.upsertTag("07A51042", "CS", [...longComponents]); // "GE_TAG_TRIGGER_TIME", ...

    expect(() => d.write()).toThrow(/GE_TAG_TRIGGER_TIME/);
    expect(() => d.write()).toThrow(/max length/);
});

Everything unskipped is green against this branch today; the two skips (#340 and #297) wait on their fixes.

🤖 Generated with Claude Code

@awatson1978
awatson1978 merged commit 25405fc into release/1.0-beta-core Sep 29, 2026
8 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant