`-BundleToResources` silently loses resources (duplicate ids, id-less entries, unparseable bundles), then `-db=true` deletes the source
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start with tooling/src/main/java/org/opencds/cqf/tooling/operation/BundleToResources.java and trace bundle discovery, resource naming and writing, extraction counts, and the -db=true deletion path. Reproduce the reported cases with the sample command and inspect the output and exit status. Done means duplicate and id-less entries cannot be silently overwritten, parse failures are reported, counts reflect written and skipped resources, and source bundles are deleted only after successful extraction.
Written by the indexing model from the issue text.
Description
-BundleToResources (tooling/src/main/java/org/opencds/cqf/tooling/operation/BundleToResources.java, unchanged
on master e50dc913) can lose resources without any error, report a count that includes them, and then, with
-db=true, delete the only copy. The IG template's _extractBundleResources.sh runs it with -db=true, so this
affects the standard test-case workflow in content IGs.
Reproduced with tooling-cli-3.9.1.jar, the version the template scripts pin.
- Resources with the same
resourceType/idoverwrite each other. The output file name is
<resourceType>-<idPart>.json, written with a plainFileOutputStream, so the last entry wins. The extraction
count still counts every entry. A bundle with twoEncounter/e1entries reports "4 resources extracted" and
writes 3 files; only the second Encounter survives. Output tasks run in parallel, so collisions across bundles
in the same output folder are also last-writer-wins, in no defined order. - Entries without an
idare named from the entry and overwrite each other. An entry with aurn:uuid
fullUrland noidis written asnull-urn:uuid:<uuid>.json. That's not a valid file name on Windows. With no
fullUrl, every id-less entry is written tonull-null.json. In a bundle with an id-less Observation and an
id-less Condition, only the Condition survives. - Files that fail to parse are skipped silently.
discoverBundlesRecursivelycatches every exception and
returnsnull. A bundle with an invalid value (for example"birthDate": "not-a-date") is never counted or
reported. The run ends "Process complete." with no mention of it. -db=truedeletes the source bundle regardless of 1–3. After a lossy extraction, the bundle, which is the
only copy of the lost resources, is deleted.
Steps to reproduce:
mkdir -p t/c
echo '{"resourceType":"Bundle","type":"collection","entry":[
{"fullUrl":"urn:uuid:a","resource":{"resourceType":"Patient","id":"p1"}},
{"fullUrl":"urn:uuid:b","resource":{"resourceType":"Encounter","id":"e1","status":"finished","class":{"code":"AMB"}}},
{"fullUrl":"urn:uuid:c","resource":{"resourceType":"Encounter","id":"e1","status":"finished","class":{"code":"IMP"}}},
{"fullUrl":"urn:uuid:d","resource":{"resourceType":"Observation","status":"final","code":{"text":"x"}}}]}' > t/c/bundle.json
java -jar tooling-cli-3.9.1.jar -BundleToResources -p=t -v=r4 -op=t -db=true
# "4 resources extracted"; files: Encounter-e1.json (IMP only), Patient-p1.json, null-urn:uuid:d.json; bundle.json deleted
Expected behaviour:
- Fail the bundle, with a clear message, when two entries share a
resourceType/id. Name the bundle and the id.
Never overwrite silently. - Fail an entry with no
id, or offer an explicit option to assign one. Never writenull-*files. - Report every file that couldn't be parsed, with the parser's message, and end with a non-zero exit code.
- Make the count report what was written and what was skipped.
- With
-db=true, delete a bundle only when all of its entries were written.
🤖 Generated with Claude Code
- Dominant language
- Java
- Stars
- 22
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cqframework/cqf-tooling
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
cqframework/cqf-tooling#575 · 1 comment ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 38/100
cqframework/cqf-tooling#567 ·
-
Updated RefreshIG to utilize HttpClientUtils, and restore multithreading and verbose console loggingOpen
Difficulty 5/5 Over a week Newbie friendliness 25/100
cqframework/cqf-tooling#564 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
cqframework/cqf-tooling#540 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
cqframework/cqf-tooling#532 ·
All issues in cqframework/cqf-tooling
Similar issues
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eclipse-edc/IdentityHub#1296 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
cloudfoundry/uaa#4194 ·
Maintainers usually reply within 1 day
-
area: ui priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
tetsuji16/microProject#1721 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
The engine's "loaded, but had errors" message leaves out which library and line each error is inOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
cqframework/clinical_quality_language#1980 ·
Maintainers usually reply within 3 days