Skip to content

Commit aa68c90

Browse files
wayfarer3130sedghiohif-botclaudejbocce
authored
feat: Cornerstone3D 5.0 (#2748)
* bump version * bump beta (#2638) * bump beta [BUMP BETA MAJOR] (#2639) * bump version * bump version [BUMP BETA MAJOR] * chore(version): Update package versions to 5.0.0-beta.1 [skip ci] * Update to use feat/use-beta-5.0-cs3d for downstream test * Revert to earlier bun/node * fix: Dependencies * feat: Add metadata module to single-source metadata (#2625) * feat: Add metadata module to single-source metadata * Revert some of hte changes to dicom image loader in favour of deprecation * Undo change * Move unit tests to metadata package * Revert changes to adapters * Revert unneeded changes * Update metadata module to use AsyncDicomListener format * fix: Add unit test * Add metadata provider and init for the new metadata function * Split module lists * update metadata versoin * Move audit to end so build steps are viewable * fix: Audit last * fix lock file mismatch * fix: metadata reference * fix: Link to metadata * fix: Move audit to a single build to allow overall PR status Previously the audit happened early and multiple times, causing issues when the audit failures were unrelated to other changes. * fix: Unused components, add ecg module * Remove subdirectory import * fix: ecg module * Remove unused lower camel case reader * Switch new/old flag to be useLegacyMetadataProvider * Add metadata module for github builds * useLegacyMetadataProvider for the karma tests needing it * Add legacy module name * PR comments * fix: Wado URI test * Update version * Missing PR rename issue * Fix init/register options to allow registering new provider This explains the differences between the legacy/default metadata provider and the data loaders themselves, which still need registering. * Add rebuild:canvas command to fix missing canvas * fix: Update way that loadImage functions with naturalized data * Cleaner listener design/setup and pas (more) tests * fix: loadImage with metadata module * fix: Transfer syntax return as string * fix: Wrong load image was getting used * Update the register to clear data * Store worker log to loglevel * fix: Various karma tests * fix: Remaining karma issues * fix: Scaling data unit tests weren't running correctly * Use fixed page size to make tests run consistently. * Set size for consistency * docusaurus build issues * Build fixes * Version fix * Update to include metadata module * Include metadata module in circleci config * fix: Build when linked * fix: workspace dependency to allow yarn 1.x * Update package module for adapters build * Try to fix adapters build issue * Export suv scaling factor * Update bun version to push an update * Link suv module specifically * fix: Merge issues * bun lock * Make node directory if it doesn't exist * fix: Add migration guide and remove prebuild:esm * Rename natural to naturalizedMetadata * More renames natural => naturalized * PR review comments * Push test versoin * Run against master instead of beta * Rerun tests * fix: Allow lower ohif_ref for reference * Invalid image position for PT and some positions with parent position * Kick updated build * PR comments to use a separate pipeline for the add handling * fix: Aspect ratio - merge had gone bad and undo missed changes * fix: Unintended merge * Only remove imageId prefix if there are at least two schemes * PR review comment fixes * Create @corenrstonejs/utils package with initial contents * fix: install * Use load local instead of upload * Fix karma tests * fix: Build issues * fix: Types on toNumber * fix: ohif-downstream to use build:esm * toNumber * Force retest * Change to allow 120 minutes for CS3D playwright tests * Update retries to match OHIF * Upload playwright results on failure * fix: Add utils path * Rename addPart10Instance * Remove cache warm up in utils * Fix function rename * PR comments - use enum values instead of literals. * fix: Resolutions so that beta installs again * Remove bom * lock * Fix docusaurus and docs build warnings/errors * tmp vuln * cornerstone3d redo viewports (#2666) * feat: Update to use pnpm and remove bun/yarn usage (#2635) * feat: pnpm 11 build/install for cs3d * Format check runs at root level rather than in each package * Enable corepack detection of pnpm version * Fix audit issue * ohif-downstream build issue * Update to beta.3 for pnpm * Update beta 3 in pnpm lock * Re-run test on updated OHIF * Fix pnpm build based on merge commit * Fix link/unlik * Fixes for linking * fix cs3d link with ohif * ci: pin Node 24 and bump pnpm to 11.4.0 playwright.yml's matrix had regressed to Node 20 during the beta merge, but pnpm 11 requires Node >=22.13 (uses node:sqlite), so installs crashed with ERR_UNKNOWN_BUILTIN_MODULE. Restore Node 24 everywhere and move pnpm 11.1.1 -> 11.4.0 across all workflows and packageManager. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: drop exact packageManager pin, rely on engines pnpm>=11 The packageManager: pnpm@11.4.0 pin forced pnpm's precise-version auto-switch, which broke commits for anyone whose local pnpm couldn't fetch that exact build. engines.pnpm ">=11" is sufficient; CI still pins 11.4.0 via pnpm/action-setup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: restore packageManager pnpm pin for nested-repo corepack CS3D lives inside the OHIF repo, whose package.json pins packageManager: yarn. With corepack enabled, dropping CS3D's own packageManager field makes corepack walk up and resolve yarn for CS3D, breaking the pnpm-based husky hook. Pin pnpm here so corepack uses (and auto-fetches) pnpm for this workspace. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ohif-downstream): install OHIF with bun, not pnpm OHIF is a bun/yarn project checked out inside this pnpm workspace. Installing it with pnpm walks up to this repo's pnpm-workspace.yaml (node-linker: hoisted) and produces a mixed node_modules where OHIF's jest and CS3D's jest copies get tangled, so jest-runner resolves to a different instance than @jest/core -> "Cannot read properties of undefined (reading 'leakDetector')". Install/run the OHIF side with bun (its native package manager) so it gets a self-contained node_modules. Adds a Set up Bun step; CS3D's own install/build stay on pnpm. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Update bun lock * frozen workfiles * Move frozen lockfile flag to pnpm-workspace.yaml * lock * Rerun build, resetting ohif-downstream to default * fix: unit test run * Fix chrome headless run for karma tests * Update tmp 0.2.6 to resolve the high severity issue --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Joe Boccanfuso <joe.boccanfuso@radicalimaging.com> * fix tests beta (#2749) * feat: Preserve originally-requested viewport type in rendering engines (#2751) * feat: Migrate to pnpm and update workflows for codemods package (#2752) * fix: resolve CI failures from audit and CodeQL alerts Bump vitest and @vitest/browser-playwright to 4.1.8 to clear the critical GHSA-2h32-95rg-cppp advisory blocking the CircleCI checkout job's security audit. Also address CodeQL findings introduced by the viewport refactor diff: switch example RNGs to crypto APIs, guard the annotation manager against prototype-polluting keys, and run rspack via spawnSync with an args array instead of a shell-interpolated string. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ci: add manual approval gate before npm publish Insert a HOLD_FOR_APPROVAL job between BUILD and NPM_PUBLISH in the TEST_AND_RELEASE workflow so the computed version can be reviewed and approved in the CircleCI UI before any release is published. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Rebuild to check overall build status --------- Co-authored-by: Alireza <ar.sedghi@gmail.com> Co-authored-by: ohif-bot <contact@ohif.org> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Joe Boccanfuso <joe.boccanfuso@radicalimaging.com>
1 parent 6f7ce81 commit aa68c90

1,163 files changed

Lines changed: 102405 additions & 21646 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: metadata-migration
3+
description: Migrate codebases from legacy CS3D metadata flows to the metadata branch model with required init/provider updates and recommended provider/cache/imageId changes.
4+
---
5+
6+
# Metadata Migration Skill (`origin/main` -> `metadata`)
7+
8+
Use this skill to migrate codebases from the legacy CS3D metadata flow in
9+
`origin/main` to the `metadata` branch model.
10+
11+
## Mandated changes
12+
13+
1. Add the metadata module.
14+
2. Re-add required providers after each CS3D init call.
15+
16+
### Required checklist
17+
18+
- Add and initialize the metadata module in bootstrap/startup.
19+
- Ensure provider registration runs after CS3D init.
20+
- Re-register all providers needed by your workflows after init.
21+
- Confirm provider priority/ordering where providers overlap.
22+
23+
## Recommended changes
24+
25+
1. Use metadata module imports instead of legacy import paths.
26+
2. Switch to new metadata providers and deprecate old providers.
27+
3. Adopt the new caching model.
28+
4. Adopt the `imageId` / `frameImageId` storage model.
29+
30+
## Compatibility notes
31+
32+
- Some providers are not yet available in both old and new schemes.
33+
- Do not block migration on full parity.
34+
- Keep temporary fallback providers only where required.
35+
- Track and remove fallbacks as equivalent providers become available.
36+
37+
## Suggested migration sequence
38+
39+
1. Add metadata module and initialize it.
40+
2. Move provider registration to post-init and re-add required providers.
41+
3. Validate key metadata workflows and provider lookups.
42+
4. Replace old imports with metadata module imports.
43+
5. Migrate providers to new implementations where available.
44+
6. Incrementally adopt new cache and `imageId`/`frameImageId` storage.

.circleci/config.yml

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,27 @@ defaults: &defaults
55
working_directory: ~/repo
66
# https://circleci.com/docs/2.0/circleci-images/#language-image-variants
77
docker:
8-
- image: cimg/node:20.18.1-browsers
8+
- image: cimg/node:24.0.0-browsers
99
environment:
1010
TERM: xterm # Enable colors in term
1111

1212
commands:
13-
install_bun:
13+
install_pnpm:
1414
steps:
1515
- run:
16-
name: Install Bun
16+
name: Install pnpm
1717
command: |
18-
curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.23"
19-
echo 'export BUN_INSTALL="$HOME/.bun"' >> $BASH_ENV
20-
echo 'export PATH="$BUN_INSTALL/bin:$PATH"' >> $BASH_ENV
21-
source $BASH_ENV
18+
sudo corepack enable
19+
pnpm --version
2220
2321
jobs:
2422
CHECKOUT:
2523
<<: *defaults
2624
steps:
2725
- checkout
2826
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/repo/.npmrc
29-
- install_bun
30-
# SECURITY AUDIT - only when bun.lock has changed
27+
- install_pnpm
28+
# SECURITY AUDIT - only when pnpm-lock.yaml has changed
3129
- run:
3230
name: 'Security Audit - High Risk Vulnerabilities'
3331
command: |
@@ -38,30 +36,14 @@ jobs:
3836
exit 0
3937
fi
4038
CHANGED_FILES=$(git diff --name-only origin/main...HEAD 2>/dev/null || echo "")
41-
if ! echo "$CHANGED_FILES" | grep -qx 'bun.lock'; then
42-
echo "⏭️ bun.lock unchanged - skipping security audit."
39+
if ! echo "$CHANGED_FILES" | grep -qx 'pnpm-lock.yaml'; then
40+
echo "⏭️ pnpm-lock.yaml unchanged - skipping security audit."
4341
exit 0
4442
fi
45-
echo "🔍 bun.lock changed - running bun audit for security vulnerabilities..."
43+
echo "🔍 pnpm-lock.yaml changed - running pnpm audit for security vulnerabilities..."
4644
echo "Checking for HIGH-RISK vulnerabilities..."
4745
48-
# Define ignored vulnerabilities with comments
49-
IGNORED_VULNS=(
50-
"GHSA-5j98-mcp5-4vw2" # CVE-2025-64756 - glob is strictly for building and CI/CD purposes
51-
"GHSA-3ppc-4f35-3m26" # CVE-2026-26996 - minimatch via itk-wasm and glob is safe because it does NOT use the CLI
52-
# CVE-2026-26996 - minimatch via other packages are strictly for building and CI/CD purposes; no user supplied expressions are passed to minimatch
53-
"GHSA-7r86-cg39-jmmj" # CVE-2026-27903 - minimatch same as above
54-
"GHSA-23c5-xmqv-rm74" # CVE-2026-27904 - minimatch same as above
55-
"GHSA-c2c7-rcm5-vvqj" # CVE-2026-33671 - picomatch is generally used for development and CI/CD purposes
56-
)
57-
58-
# Build ignore flags
59-
IGNORE_FLAGS=""
60-
for vuln in "${IGNORED_VULNS[@]}"; do
61-
IGNORE_FLAGS="$IGNORE_FLAGS --ignore=$vuln"
62-
done
63-
64-
if bun audit $IGNORE_FLAGS --audit-level high; then
46+
if pnpm audit --audit-level high; then
6547
echo "✅ No high-risk vulnerabilities found"
6648
echo "🎉 Security audit passed!"
6749
else
@@ -70,21 +52,21 @@ jobs:
7052
echo "======================================"
7153
echo ""
7254
echo "🔧 To fix these issues:"
73-
echo " 1. Run: bun audit"
55+
echo " 1. Run: pnpm audit"
7456
echo " 2. Review the vulnerability details"
7557
echo " 3. Update affected packages to secure versions"
7658
echo " 4. Test your changes"
77-
echo " 5. Re-run: bun audit --audit-level high"
59+
echo " 5. Re-run: pnpm audit --audit-level high"
7860
echo ""
7961
echo "📋 Full audit report:"
8062
81-
bun audit $IGNORE_FLAGS --audit-level low || true
63+
pnpm audit || true
8264
8365
echo ""
8466
echo "❌ This build cannot proceed until high-risk vulnerabilities are resolved."
8567
exit 1
8668
fi
87-
- run: bun install
69+
- run: pnpm install --frozen-lockfile
8870
- persist_to_workspace:
8971
root: ~/repo
9072
paths:
@@ -95,14 +77,15 @@ jobs:
9577
steps:
9678
- attach_workspace:
9779
at: ~/repo
98-
- install_bun
80+
- install_pnpm
9981
- run:
10082
name: 'Perform the versioning before build'
101-
command: bun ./version.mjs
102-
- run: bun run build
83+
command: node ./version.mjs
84+
- run: pnpm run build
10385
- persist_to_workspace:
10486
root: ~/repo
10587
paths:
88+
- packages/metadata/dist
10689
- packages/core/dist
10790
- packages/tools/dist
10891
- packages/adapters/dist
@@ -118,7 +101,7 @@ jobs:
118101
steps:
119102
- attach_workspace:
120103
at: ~/repo
121-
- install_bun
104+
- install_pnpm
122105
- run:
123106
name: Avoid hosts unknown for github
124107
command:
@@ -133,14 +116,14 @@ jobs:
133116
- run:
134117
name: publish package versions
135118
command: |
136-
bun ./publish-version.mjs
119+
node ./publish-version.mjs
137120
- run:
138121
name: Again set the NPM registry (was deleted in the version script)
139122
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
140123
- run:
141124
name: publish package dist
142125
command: |
143-
bun ./publish-package.mjs
126+
node ./publish-package.mjs
144127
145128
workflows:
146129
version: 2
@@ -171,7 +154,11 @@ workflows:
171154
- BUILD:
172155
requires:
173156
- CHECKOUT
174-
- NPM_PUBLISH:
157+
- HOLD_FOR_APPROVAL:
158+
type: approval
175159
requires:
176160
- BUILD
161+
- NPM_PUBLISH:
162+
requires:
163+
- HOLD_FOR_APPROVAL
177164
# VS Code Extension Version: 1.5.1

.github/workflows/build-docs.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ jobs:
2323
pull-requests: read
2424
steps:
2525
- uses: actions/checkout@v4
26-
- uses: oven-sh/setup-bun@v2
26+
- uses: pnpm/action-setup@v4
2727
with:
28-
bun-version: 1.2.23
28+
version: 11.4.0
2929
- uses: actions/setup-node@v4
3030
with:
31-
node-version: 20 # Or your desired Node version
31+
node-version: '24'
32+
cache: 'pnpm'
3233

3334
- name: Install root dependencies
34-
run: bun install --frozen-lockfile
35+
run: pnpm install --frozen-lockfile
3536

3637
# Removed Playwright tests and coverage generation steps
3738

@@ -83,7 +84,7 @@ jobs:
8384
echo "Artifact downloaded successfully."
8485
8586
- name: Install docs dependencies
86-
run: cd packages/docs && bun install
87+
run: pnpm install --frozen-lockfile
8788

8889
- name: Copy coverage to docs static directory
8990
run: |
@@ -100,7 +101,7 @@ jobs:
100101
cp ./coverage-artifact/sorter.js packages/docs/static/
101102
102103
- name: Build docs
103-
run: cd packages/docs && bun run build:docs
104+
run: pnpm --filter docs run build:docs
104105
# This runs
105106
# 1. prepare-markdown-files.js - which copies markdown files to /docs/llm directory
106107
# making them available at cornerstonejs.org/docs/llm/[folder]/[filename.md]
@@ -110,7 +111,7 @@ jobs:
110111
# the concatenated content of all documentation files
111112

112113
- name: Install Netlify CLI
113-
run: bun add -g netlify-cli
114+
run: pnpm add -g netlify-cli
114115

115116
- name: Deploy to Netlify
116117
run: |

.github/workflows/docusaurus-build.yml

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,25 @@ jobs:
2222
- name: Checkout repository
2323
uses: actions/checkout@v4
2424

25-
- name: Setup Node.js
26-
uses: actions/setup-node@v4
25+
- name: Setup pnpm
26+
uses: pnpm/action-setup@v4
2727
with:
28-
node-version: '20.18.1'
29-
cache: 'npm'
28+
version: 11.4.0
3029

31-
- name: Setup Bun
32-
uses: oven-sh/setup-bun@v2
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v4
3332
with:
34-
bun-version: 1.2.23
33+
node-version: '24'
34+
cache: 'pnpm'
3535

3636
- name: Install root dependencies
37-
run: bun install --frozen-lockfile
38-
39-
- name: reset nx cache
40-
run: rm -rf .nx/cache
41-
42-
- name: reset nx cache
43-
run: bun nx reset
37+
run: pnpm install --frozen-lockfile
4438

4539
- name: Build packages in ESM format
46-
run: bun run build:esm
47-
env:
48-
NX_CACHE_DIRECTORY: ${{ runner.temp }}/nx-cache
49-
NX_DAEMON: false
50-
51-
- name: Install docs dependencies
52-
run: cd packages/docs && bun install
40+
run: pnpm run build:esm
5341

5442
- name: Build Docusaurus documentation
55-
run: cd packages/docs && bun run build:ci
43+
run: pnpm --filter docs run build:ci
5644
env:
5745
NODE_OPTIONS: --max_old_space_size=32384
5846

.github/workflows/format-check.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ jobs:
1919
- name: Checkout code
2020
uses: actions/checkout@v4
2121

22-
- name: Setup Node.js
23-
uses: actions/setup-node@v4
22+
- name: Setup pnpm
23+
uses: pnpm/action-setup@v4
2424
with:
25-
node-version: '20.18.1'
26-
cache: 'npm'
25+
version: 11.4.0
2726

28-
- name: Setup Bun
29-
uses: oven-sh/setup-bun@v2
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
3029
with:
31-
bun-version: 1.2.23
30+
node-version: '24'
31+
cache: 'pnpm'
3232

3333
- name: Install dependencies
34-
run: bun install
34+
run: pnpm install --frozen-lockfile
3535

3636
- name: Run lint
37-
run: bun run lint
37+
run: pnpm run lint
3838

3939
- name: Run format check
40-
run: bun run format-check
40+
run: pnpm run format-check

.github/workflows/ohif-downstream.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ jobs:
2828
runs-on: self-hosted
2929
timeout-minutes: 120
3030
env:
31-
BUN_VERSION: 1.3.11
31+
PNPM_VERSION: 11.4.0
32+
BUN_VERSION: 1.2.23
3233
NODE_VERSION: 24
34+
OHIF_REF: master
3335
OHIF_DIR: ohif
3436
# Update to force a rebuild of the OHIF integration
35-
BUILD_INDEX: 0
37+
BUILD_INDEX: 1
3638
steps:
3739
- name: Checkout Cornerstone
3840
uses: actions/checkout@v4
@@ -60,6 +62,14 @@ jobs:
6062
echo "[build-context] OHIF ref: ${{ env.OHIF_REF }}"
6163
echo "[build-context] ═══════════════════════════════════════════════════════════════"
6264
65+
- name: Set up pnpm
66+
uses: pnpm/action-setup@v4
67+
with:
68+
version: ${{ env.PNPM_VERSION }}
69+
70+
# OHIF (a bun/yarn project) is installed with bun so it gets an isolated
71+
# node_modules instead of being pulled into this repo's pnpm workspace,
72+
# which mixes jest copies and breaks jest-runner (leakDetector error).
6373
- name: Set up Bun
6474
uses: oven-sh/setup-bun@v2
6575
with:
@@ -69,12 +79,13 @@ jobs:
6979
uses: actions/setup-node@v4
7080
with:
7181
node-version: ${{ env.NODE_VERSION }}
82+
cache: 'pnpm'
7283

7384
- name: Install Cornerstone dependencies
74-
run: bun install --frozen-lockfile
85+
run: pnpm install --frozen-lockfile
7586

76-
- name: Build local Cornerstone packages for OHIF
77-
run: bun run build:esm
87+
- name: Build local Cornerstone packages for OHIF (includes metadata)
88+
run: pnpm run build:esm
7889

7990
- name: Checkout OHIF
8091
uses: actions/checkout@v4
@@ -99,7 +110,7 @@ jobs:
99110
100111
- name: Install OHIF dependencies
101112
working-directory: ${{ env.OHIF_DIR }}
102-
run: bun install --frozen-lockfile
113+
run: bun install
103114

104115
- name: Link local Cornerstone packages into OHIF node_modules
105116
run: node scripts/link-ohif-cornerstone-node-modules.mjs ${{ env.OHIF_DIR }}
@@ -110,7 +121,7 @@ jobs:
110121

111122
- name: Install Playwright browsers
112123
working-directory: ${{ env.OHIF_DIR }}
113-
run: npx playwright install
124+
run: npx playwright install --with-deps chromium
114125

115126
- name: Run OHIF e2e tests
116127
working-directory: ${{ env.OHIF_DIR }}

0 commit comments

Comments
 (0)