Skip to content

test: pin private tag handling, undefined value writes, and element ordering - #527

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

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

Conversation

@awatson1978

@awatson1978 awatson1978 commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

This batch of the regression bank pins three areas of writer and naturalizer behavior that already work on this branch, and files the parts that don't as it.skip entries named after their issues. The suites land green; the skips are the record of what the later fix PRs need to flip.

test/issues/issue365-tag-order.test.js covers two writer basics. For #365: after editing a naturalized dataset — adding keywords whose tags sort before ones already present — the written output must still emit top-level tags in strictly ascending order (upstream, dciodvfy flagged "Tags out of order" on a written SEG). The assertion walks the raw output bytes with the independent walker in test/issues/part10Walker.js rather than trusting the library's own reader. For #196: upserting much longer values (the issue's PatientName pattern) must grow the write buffer instead of throwing "Request more than currently allocated buffer". Both are green, no skips.

test/issues/issue388-private-tags.test.js covers private tags — vendor-specific elements that aren't in the standard dictionary — going through naturalize and denaturalize. In 0.19.x, a sequence item holding private tags got their numeric-string keys defined on the sequence array itself, which extended the array to millions of undefined entries and crashed denaturalization (#388). The 1.0 Proxy-based accessors keep those keys on the item, which this test pins:

const dataset = DicomMetaDictionary.naturalizeDataset(
    DicomMessage.readFile(makeBuffer()).dict
);
const seq = dataset.ReferencedSeriesSequence;

// The 0.19.x failure mode was seq.length exploding to 20051404+
expect(Array.isArray(seq)).toBe(true);
expect(seq.length).toBe(1);
expect(seq[0]["00091001"]).toBe("private-in-sq");
expect(seq[0].SeriesInstanceUID).toBe("1.2.3.4");

For #215, the supported custom-dictionary path is pinned green: new DicomMetaDictionary(customDictionary).denaturalizeDataset(ds) preserves private elements whose naturalized key matches a custom entry's name. Three KNOWN GAPs are skipped in this file: static denaturalize drops private elements inside sequence items (#388), static denaturalize drops unregistered top-level private tags entirely (#215), and registerTag() is asymmetric — registered names naturalize but never denaturalize, because the lazy name map is built only from the standard dictionary (#215 again).

test/issues/issue417-undefined-values.test.js covers elements whose Value is [undefined], a shape real reads have produced (the issue saw it on Pregnancy Status). Today write() dies deep in the buffer layer with a bare "Not a number: undefined" and no hint of which tag caused it. The desired contract — skip the element or fail with an error that names the tag — is the skipped KNOWN GAP #417. A companion green test pins today's observed failure mode through the reporter's exact write({ allowInvalidVRLength: true }) call, so the fix flips both together. The naturalized side is pinned green: a field explicitly set to undefined is omitted by denaturalize, and the subsequent write and re-read succeed.

🤖 Generated with Claude Code

@awatson1978
awatson1978 merged commit 8fc74c1 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