Skip to content

Conversation

philippotto
Copy link
Member

@philippotto philippotto commented Sep 26, 2025

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • open some datasets and annotations

Issues:


(Please delete unneeded items, merge only when none are left open)

  • [ ] Added changelog entry irrelevant to end user

Copy link
Contributor

coderabbitai bot commented Sep 26, 2025

📝 Walkthrough

Walkthrough

Rename and reshape magnification fields across the frontend: resolutions: Vector3[]mags: Array<{ mag: Vector3; path?: string }> and update call sites, fixtures, tests, mag utilities (rename convertToDenseMagconvertToDenseMags), AI training/UI code, and rendering/bucket logic to consume the new mags shape.

Changes

Cohort / File(s) Summary
Types
frontend/javascripts/types/api_types.ts
Replace APIDataLayerBase.resolutions: Array<Vector3> with mags: Array<{ mag: Vector3; path?: string }> (field name and shape change).
Core model init & DataLayer
frontend/javascripts/viewer/model_initialization.ts, frontend/javascripts/viewer/model/data_layer.ts
Initialize and store mags (use { mag: [1,1,1] } fallback); update DataLayer.mags type and construction to consume layerInfo.mags.
Mag utilities
frontend/javascripts/viewer/model/helpers/mag_info.ts
Rename export convertToDenseMagconvertToDenseMags and update internal call sites (e.g., getDenseMags).
Accessors & core logic
frontend/javascripts/viewer/model/accessors/*
.../dataset_accessor.ts, .../flycam_accessor.ts, .../volumetracing_accessor.ts
Consume layer.mags (map to .mag) instead of layer.resolutions for MagInfo, unions, active/current mag lookups, and dense/widest mag computations.
Sagas & workflows
frontend/javascripts/viewer/model/sagas/**/*.ts
Replace resolutions with mags when building MagInfo and when intersecting/selecting magnifications across dataset, flycam, volume, quick-select, min-cut, proofreading, and related sagas.
Rendering, bucket & wkstore
frontend/javascripts/viewer/geometries/materials/plane_material_factory.ts, frontend/javascripts/viewer/model/bucket_data_handling/*, frontend/javascripts/viewer/model/bucket_data_handling/wkstore_adapter.ts, frontend/javascripts/viewer/model/bucket_data_handling/layer_rendering_manager.ts
Derive representative mag, maxMagIndex, denseMags and build bucket requests from mags instead of resolutions.
Viewer API
frontend/javascripts/viewer/api/api_latest.ts
Use layer.mags when constructing MagInfo for bounding-box, data retrieval, viewport/download flows.
Viewer UI & components
frontend/javascripts/viewer/view/**, frontend/javascripts/view/action-bar/**, frontend/javascripts/viewer/view/action-bar/create_animation_modal.tsx, frontend/javascripts/viewer/view/action-bar/download_modal_view.tsx
Read magnifications from mags (use .mag) for sliders, bounding-box, export, animation, validation and UI displays.
AI training / admin / dashboard
frontend/javascripts/view/action-bar/ai_job_modals/*, frontend/javascripts/admin/voxelytics/ai_model_list_view.tsx, frontend/javascripts/dashboard/advanced_dataset/create_explorative_modal.tsx
Switch training modal helpers, selection logic and annotation types to use mags; update AnnotationInfoForAITrainingJob.volumeTracingMags shape and fallbacks.
Model orchestration
frontend/javascripts/viewer/model/bucket_data_handling/layer_rendering_manager.ts, frontend/javascripts/viewer/model_initialization.ts
Use mags as the canonical mag source when merging/choosing dataset and volume mags for rendering.
Tests & fixtures
frontend/javascripts/test/fixtures/* (dataset_server_object.ts, hybridtracing_object.ts, volumetracing_object.ts), frontend/javascripts/test/**/*.spec.ts
Replace fixture/test properties from resolutionsmags, wrap triplets as { mag: [...] }, update test names/imports (convertToDenseMags) and mocked layer data.
Small edits / admin components
frontend/javascripts/admin/voxelytics/ai_model_list_view.tsx, frontend/javascripts/view/action-bar/ai_job_modals/components/*
Update fallbacks and indexing to access .mag from mags arrays and adjust TrainNewAiJobModal data shapes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

frontend, enhancement

Suggested reviewers

  • fm3
  • MichaelBuessemeyer
  • frcroth

Poem

I twitched my whiskers, wrapped each mag snug tight,
Triplets tucked in jackets, ready for flight,
I hopped through files and nudged each field to brag,
Now mags march neatly — hooray! — from the rabbit bag 🐰✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive The description provides generic testing steps and a link to a deployed instance but does not summarize the actual changes to the code, making it too vague to convey meaningful information about this pull request’s intent. The author should expand the description to include a brief overview of the resolution-to-mags migration, list key areas affected, and outline expected behavioral changes to guide reviewers.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly captures the pull request’s core change of replacing resolution fields with mags in the data source, is clear and concise, and does not include unnecessary noise or file lists.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch replace-resolutions

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5830bf7 and 7ae64fd.

📒 Files selected for processing (1)
  • frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build-smoketest-push
  • GitHub Check: backend-tests
  • GitHub Check: frontend-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@philippotto philippotto self-assigned this Sep 26, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/javascripts/viewer/view/action-bar/download_modal_view.tsx (1)

310-327: Use fallback layer mags when exporting fallback data.

For traced volumes we export the fallback layer (selectedLayerInfos.layerName), but the magnification info is now taken from selectedLayer.mags. Before the refactor this was acceptable because both tracing and fallback shared resolutions. After the rename, only the fallback layer is guaranteed to expose the correct mags. If a tracing layer no longer carries identical mags, getMagInfo(selectedLayer.mags) will either see an empty array or the wrong values, leading to wrong defaults in the slider and possibly invalid requests. Please derive magnificationInfo from the fallback (selectedLayer.fallbackLayerInfo?.mags ?? selectedLayer.mags) so export continues to use the mags of the actual layer we pass to the backend.

To address it, guard the lookup like this:

-  const selectedLayerMagInfo = getMagInfo(selectedLayer.mags);
+  const sourceMags = selectedLayer.fallbackLayerInfo?.mags ?? selectedLayer.mags;
+  const selectedLayerMagInfo = getMagInfo(sourceMags);
🧹 Nitpick comments (5)
frontend/javascripts/viewer/model/bucket_data_handling/wkstore_adapter.ts (1)

202-202: Confirm mags availability here; add guard or temporary fallback.

Switching to layerInfo.mags is consistent with the PR. Please verify this adapter never receives layers without mags (including old cached state/annotations). If not guaranteed, add a fast‑fail or a temporary back‑compat fallback.

Option A (fail fast):

-  const magInfo = getMagInfo(layerInfo.mags);
+  if (!layerInfo.mags || layerInfo.mags.length === 0) {
+    throw new Error(`Missing mags for layer "${layerInfo.name}"`);
+  }
+  const magInfo = getMagInfo(layerInfo.mags);

Option B (back‑compat until full migration):

-  const magInfo = getMagInfo(layerInfo.mags);
+  const mags = layerInfo.mags ?? (layerInfo as any).resolutions;
+  if (!mags || mags.length === 0) {
+    throw new Error(`Missing mags for layer "${layerInfo.name}"`);
+  }
+  const magInfo = getMagInfo(mags);

Note: Some places intentionally keep resolutions (e.g., specific sagas). Ensure this change doesn’t affect those code paths. Based on learnings

frontend/javascripts/viewer/view/action-bar/create_animation_modal.tsx (1)

258-262: Avoid recomputing MagInfo twice; hoist to a const

Minor perf/readability improvement; keeps memoization effective.

-      const adhocMagIndex = getMagInfo(layer.mags).getClosestExistingIndex(
-        preferredQualityForMeshAdHocComputation,
-      );
-      const adhocMag = getMagInfo(layer.mags).getMagByIndexOrThrow(adhocMagIndex);
+      const magInfo = getMagInfo(layer.mags);
+      const adhocMagIndex = magInfo.getClosestExistingIndex(
+        preferredQualityForMeshAdHocComputation,
+      );
+      const adhocMag = magInfo.getMagByIndexOrThrow(adhocMagIndex);
frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx (1)

1126-1131: Fallback mags source change — verify availability

Using fallbackLayerInfo.mags is semantically correct with the new API. Please verify that fallbackLayerInfo is always populated with mags for legacy datasets; otherwise guard against undefined.

frontend/javascripts/viewer/view/action-bar/ai_job_modals/utils.tsx (1)

50-56: Select best mag across all dims (not only X) for closer match

Currently, selection compares only diff[0]. Consider using the max (or sum) across dimensions to choose the closest match more robustly.

Apply this tweak:

-  let bestDifference = [
-    Number.POSITIVE_INFINITY,
-    Number.POSITIVE_INFINITY,
-    Number.POSITIVE_INFINITY,
-  ];
+  let bestDifference: number[] = [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY];

   for (const mag of colorLayer.mags) {
     const diff = datasetScaleInNm.map((dim, i) =>
       Math.abs(Math.log(dim * mag[i]) - Math.log(modelScale[i])),
     );
-    if (bestDifference[0] > diff[0]) {
+    if (Math.max(...bestDifference) > Math.max(...diff)) {
       bestDifference = diff;
       closestMagOfCurrentDS = mag;
     }
   }

Also applies to: 59-67

frontend/javascripts/viewer/model/sagas/volume/quick_select/quick_select_heuristic_saga.ts (1)

151-152: Validate getMagInfo & getDataForBoundingBox zoomStep semantics

Switching to mags here looks correct, but verify:

  • getMagInfo takes an array of mags (Vector3[])—some code still uses resolutions.
  • The zoomStep returned by MagInfo (from the intersection) matches the _zoomStep parameter of api.data.getDataForBoundingBox.

Run:

rg -nP -C3 'function _getMagInfo\b' --type=ts
rg -nP -C3 'export const getMagInfo\b' --type=ts
rg -nP -C3 'getDataForBoundingBox' --type=ts

Optional: replace

_.intersectionBy(colorLayer.mags, volumeLayer.mags, mag => mag.join("-"))

with

_.intersectionWith(colorLayer.mags, volumeLayer.mags, _.isEqual)

to avoid string allocations.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 634dc16 and 387b78a.

📒 Files selected for processing (36)
  • frontend/javascripts/admin/voxelytics/ai_model_list_view.tsx (1 hunks)
  • frontend/javascripts/dashboard/advanced_dataset/create_explorative_modal.tsx (2 hunks)
  • frontend/javascripts/test/fixtures/dataset_server_object.ts (2 hunks)
  • frontend/javascripts/test/fixtures/hybridtracing_object.ts (1 hunks)
  • frontend/javascripts/test/fixtures/volumetracing_object.ts (1 hunks)
  • frontend/javascripts/test/model/accessors/flycam_accessors.spec.ts (2 hunks)
  • frontend/javascripts/test/model/binary/cube.spec.ts (3 hunks)
  • frontend/javascripts/test/model/binary/pullqueue.spec.ts (1 hunks)
  • frontend/javascripts/test/model/model_resolutions.spec.ts (6 hunks)
  • frontend/javascripts/test/model/volumetracing/volume_annotation_sampling.spec.ts (2 hunks)
  • frontend/javascripts/test/sagas/annotation_tool_disabled_info.spec.ts (2 hunks)
  • frontend/javascripts/types/api_types.ts (1 hunks)
  • frontend/javascripts/viewer/api/api_latest.ts (5 hunks)
  • frontend/javascripts/viewer/geometries/materials/plane_material_factory.ts (1 hunks)
  • frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (4 hunks)
  • frontend/javascripts/viewer/model/accessors/flycam_accessor.ts (3 hunks)
  • frontend/javascripts/viewer/model/accessors/volumetracing_accessor.ts (2 hunks)
  • frontend/javascripts/viewer/model/bucket_data_handling/layer_rendering_manager.ts (2 hunks)
  • frontend/javascripts/viewer/model/bucket_data_handling/wkstore_adapter.ts (1 hunks)
  • frontend/javascripts/viewer/model/data_layer.ts (1 hunks)
  • frontend/javascripts/viewer/model/sagas/dataset_saga.ts (1 hunks)
  • frontend/javascripts/viewer/model/sagas/flycam_info_cache_saga.ts (1 hunks)
  • frontend/javascripts/viewer/model/sagas/volume/min_cut_saga.ts (1 hunks)
  • frontend/javascripts/viewer/model/sagas/volume/proofread_saga.ts (1 hunks)
  • frontend/javascripts/viewer/model/sagas/volume/quick_select/quick_select_heuristic_saga.ts (1 hunks)
  • frontend/javascripts/viewer/model_initialization.ts (1 hunks)
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/components/bounding_box_selection_form_item.tsx (1 hunks)
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/forms/train_ai_model_form.tsx (1 hunks)
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/tabs/train_ai_model_tab.tsx (1 hunks)
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/utils.tsx (2 hunks)
  • frontend/javascripts/viewer/view/action-bar/create_animation_modal.tsx (2 hunks)
  • frontend/javascripts/viewer/view/action-bar/download_modal_view.tsx (1 hunks)
  • frontend/javascripts/viewer/view/context_menu.tsx (1 hunks)
  • frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx (2 hunks)
  • frontend/javascripts/viewer/view/left-border-tabs/modals/add_volume_layer_modal.tsx (1 hunks)
  • frontend/javascripts/viewer/view/right-border-tabs/segments_tab/segment_statistics_modal.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: dieknolle3333
PR: scalableminds/webknossos#8168
File: frontend/javascripts/oxalis/model/sagas/proofread_saga.ts:1039-1039
Timestamp: 2024-11-22T17:18:04.217Z
Learning: In `frontend/javascripts/oxalis/model/sagas/proofread_saga.ts`, when calling `getMagInfo`, the use of `volumeTracingLayer.resolutions` is intentional and should not be changed to `volumeTracingLayer.mags`.
Learnt from: knollengewaechs
PR: scalableminds/webknossos#8266
File: frontend/javascripts/components/mag_selection.tsx:51-60
Timestamp: 2024-12-16T15:48:37.065Z
Learning: In the `MagSelection` component (`frontend/javascripts/components/mag_selection.tsx`), the selected magnification `value` will always be present in `allMags` because only existing values can be selected by the user.
Learnt from: dieknolle3333
PR: scalableminds/webknossos#8168
File: frontend/javascripts/oxalis/model/sagas/volumetracing_saga.tsx:433-434
Timestamp: 2024-11-22T17:19:07.947Z
Learning: In the codebase, certain usages of `segmentationLayer.resolutions` are intentionally retained and should not be changed to `segmentationLayer.mags` during refactoring.
Learnt from: dieknolle3333
PR: scalableminds/webknossos#8168
File: frontend/javascripts/oxalis/model/reducers/skeletontracing_reducer_helpers.ts:125-125
Timestamp: 2024-11-22T17:17:39.914Z
Learning: In the `createNode` function within `skeletontracing_reducer_helpers.ts`, the property `resolution` is intentionally kept even when the parameter is renamed to `mag`.
📚 Learning: 2024-11-22T17:18:04.217Z
Learnt from: dieknolle3333
PR: scalableminds/webknossos#8168
File: frontend/javascripts/oxalis/model/sagas/proofread_saga.ts:1039-1039
Timestamp: 2024-11-22T17:18:04.217Z
Learning: In `frontend/javascripts/oxalis/model/sagas/proofread_saga.ts`, when calling `getMagInfo`, the use of `volumeTracingLayer.resolutions` is intentional and should not be changed to `volumeTracingLayer.mags`.

Applied to files:

  • frontend/javascripts/test/fixtures/volumetracing_object.ts
  • frontend/javascripts/types/api_types.ts
  • frontend/javascripts/viewer/model/sagas/volume/proofread_saga.ts
  • frontend/javascripts/test/model/model_resolutions.spec.ts
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/utils.tsx
  • frontend/javascripts/viewer/model/bucket_data_handling/wkstore_adapter.ts
  • frontend/javascripts/viewer/model/sagas/flycam_info_cache_saga.ts
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/components/bounding_box_selection_form_item.tsx
  • frontend/javascripts/viewer/model/sagas/volume/min_cut_saga.ts
  • frontend/javascripts/test/model/binary/cube.spec.ts
  • frontend/javascripts/viewer/view/action-bar/download_modal_view.tsx
  • frontend/javascripts/test/sagas/annotation_tool_disabled_info.spec.ts
  • frontend/javascripts/viewer/model/sagas/dataset_saga.ts
  • frontend/javascripts/admin/voxelytics/ai_model_list_view.tsx
  • frontend/javascripts/test/fixtures/hybridtracing_object.ts
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/tabs/train_ai_model_tab.tsx
  • frontend/javascripts/viewer/api/api_latest.ts
  • frontend/javascripts/viewer/view/context_menu.tsx
  • frontend/javascripts/viewer/view/left-border-tabs/modals/add_volume_layer_modal.tsx
  • frontend/javascripts/viewer/model/accessors/flycam_accessor.ts
  • frontend/javascripts/test/model/accessors/flycam_accessors.spec.ts
  • frontend/javascripts/viewer/geometries/materials/plane_material_factory.ts
  • frontend/javascripts/viewer/model/accessors/volumetracing_accessor.ts
  • frontend/javascripts/viewer/view/action-bar/create_animation_modal.tsx
  • frontend/javascripts/viewer/model/accessors/dataset_accessor.ts
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/forms/train_ai_model_form.tsx
  • frontend/javascripts/test/fixtures/dataset_server_object.ts
  • frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx
  • frontend/javascripts/viewer/model/data_layer.ts
  • frontend/javascripts/viewer/model_initialization.ts
  • frontend/javascripts/viewer/model/sagas/volume/quick_select/quick_select_heuristic_saga.ts
  • frontend/javascripts/test/model/binary/pullqueue.spec.ts
  • frontend/javascripts/test/model/volumetracing/volume_annotation_sampling.spec.ts
  • frontend/javascripts/viewer/view/right-border-tabs/segments_tab/segment_statistics_modal.tsx
  • frontend/javascripts/dashboard/advanced_dataset/create_explorative_modal.tsx
  • frontend/javascripts/viewer/model/bucket_data_handling/layer_rendering_manager.ts
📚 Learning: 2024-11-22T17:18:43.411Z
Learnt from: dieknolle3333
PR: scalableminds/webknossos#8168
File: frontend/javascripts/oxalis/geometries/materials/plane_material_factory.ts:568-585
Timestamp: 2024-11-22T17:18:43.411Z
Learning: In the file `frontend/javascripts/oxalis/geometries/materials/plane_material_factory.ts`, the uniform name `allResolutions` should remain unchanged to maintain consistency with the shader code.

Applied to files:

  • frontend/javascripts/test/fixtures/volumetracing_object.ts
  • frontend/javascripts/types/api_types.ts
  • frontend/javascripts/test/model/model_resolutions.spec.ts
  • frontend/javascripts/test/fixtures/hybridtracing_object.ts
  • frontend/javascripts/test/model/accessors/flycam_accessors.spec.ts
  • frontend/javascripts/viewer/geometries/materials/plane_material_factory.ts
  • frontend/javascripts/test/fixtures/dataset_server_object.ts
📚 Learning: 2024-11-22T17:17:39.914Z
Learnt from: dieknolle3333
PR: scalableminds/webknossos#8168
File: frontend/javascripts/oxalis/model/reducers/skeletontracing_reducer_helpers.ts:125-125
Timestamp: 2024-11-22T17:17:39.914Z
Learning: In the `createNode` function within `skeletontracing_reducer_helpers.ts`, the property `resolution` is intentionally kept even when the parameter is renamed to `mag`.

Applied to files:

  • frontend/javascripts/test/fixtures/volumetracing_object.ts
  • frontend/javascripts/viewer/model/sagas/volume/proofread_saga.ts
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/utils.tsx
  • frontend/javascripts/viewer/model/sagas/flycam_info_cache_saga.ts
  • frontend/javascripts/viewer/model/sagas/volume/min_cut_saga.ts
  • frontend/javascripts/test/sagas/annotation_tool_disabled_info.spec.ts
  • frontend/javascripts/viewer/model/sagas/dataset_saga.ts
  • frontend/javascripts/test/fixtures/hybridtracing_object.ts
  • frontend/javascripts/viewer/view/context_menu.tsx
  • frontend/javascripts/viewer/model/accessors/flycam_accessor.ts
  • frontend/javascripts/test/model/accessors/flycam_accessors.spec.ts
  • frontend/javascripts/viewer/geometries/materials/plane_material_factory.ts
  • frontend/javascripts/viewer/model/accessors/volumetracing_accessor.ts
  • frontend/javascripts/viewer/view/action-bar/create_animation_modal.tsx
  • frontend/javascripts/test/fixtures/dataset_server_object.ts
  • frontend/javascripts/viewer/model_initialization.ts
  • frontend/javascripts/test/model/volumetracing/volume_annotation_sampling.spec.ts
📚 Learning: 2024-11-22T17:19:07.947Z
Learnt from: dieknolle3333
PR: scalableminds/webknossos#8168
File: frontend/javascripts/oxalis/model/sagas/volumetracing_saga.tsx:433-434
Timestamp: 2024-11-22T17:19:07.947Z
Learning: In the codebase, certain usages of `segmentationLayer.resolutions` are intentionally retained and should not be changed to `segmentationLayer.mags` during refactoring.

Applied to files:

  • frontend/javascripts/test/fixtures/volumetracing_object.ts
  • frontend/javascripts/types/api_types.ts
  • frontend/javascripts/test/model/model_resolutions.spec.ts
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/utils.tsx
  • frontend/javascripts/viewer/model/bucket_data_handling/wkstore_adapter.ts
  • frontend/javascripts/test/sagas/annotation_tool_disabled_info.spec.ts
  • frontend/javascripts/viewer/model/sagas/dataset_saga.ts
  • frontend/javascripts/admin/voxelytics/ai_model_list_view.tsx
  • frontend/javascripts/test/fixtures/hybridtracing_object.ts
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/tabs/train_ai_model_tab.tsx
  • frontend/javascripts/viewer/api/api_latest.ts
  • frontend/javascripts/viewer/view/context_menu.tsx
  • frontend/javascripts/viewer/view/left-border-tabs/modals/add_volume_layer_modal.tsx
  • frontend/javascripts/viewer/model/accessors/flycam_accessor.ts
  • frontend/javascripts/test/model/accessors/flycam_accessors.spec.ts
  • frontend/javascripts/viewer/model/accessors/volumetracing_accessor.ts
  • frontend/javascripts/viewer/model/accessors/dataset_accessor.ts
  • frontend/javascripts/test/fixtures/dataset_server_object.ts
  • frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx
  • frontend/javascripts/viewer/model/data_layer.ts
  • frontend/javascripts/viewer/model_initialization.ts
  • frontend/javascripts/viewer/view/right-border-tabs/segments_tab/segment_statistics_modal.tsx
  • frontend/javascripts/dashboard/advanced_dataset/create_explorative_modal.tsx
  • frontend/javascripts/viewer/model/bucket_data_handling/layer_rendering_manager.ts
📚 Learning: 2024-12-16T15:48:37.065Z
Learnt from: knollengewaechs
PR: scalableminds/webknossos#8266
File: frontend/javascripts/components/mag_selection.tsx:51-60
Timestamp: 2024-12-16T15:48:37.065Z
Learning: In the `MagSelection` component (`frontend/javascripts/components/mag_selection.tsx`), the selected magnification `value` will always be present in `allMags` because only existing values can be selected by the user.

Applied to files:

  • frontend/javascripts/viewer/model/sagas/volume/proofread_saga.ts
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/utils.tsx
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/components/bounding_box_selection_form_item.tsx
  • frontend/javascripts/viewer/model/sagas/volume/min_cut_saga.ts
  • frontend/javascripts/viewer/view/action-bar/download_modal_view.tsx
  • frontend/javascripts/viewer/api/api_latest.ts
  • frontend/javascripts/viewer/view/context_menu.tsx
  • frontend/javascripts/viewer/view/left-border-tabs/modals/add_volume_layer_modal.tsx
  • frontend/javascripts/viewer/model/accessors/flycam_accessor.ts
  • frontend/javascripts/viewer/geometries/materials/plane_material_factory.ts
  • frontend/javascripts/viewer/model/accessors/volumetracing_accessor.ts
  • frontend/javascripts/viewer/view/action-bar/create_animation_modal.tsx
  • frontend/javascripts/viewer/model/sagas/volume/quick_select/quick_select_heuristic_saga.ts
  • frontend/javascripts/viewer/view/right-border-tabs/segments_tab/segment_statistics_modal.tsx
  • frontend/javascripts/dashboard/advanced_dataset/create_explorative_modal.tsx
📚 Learning: 2025-05-12T13:07:29.637Z
Learnt from: frcroth
PR: scalableminds/webknossos#8609
File: app/models/dataset/Dataset.scala:753-775
Timestamp: 2025-05-12T13:07:29.637Z
Learning: In the `updateMags` method of DatasetMagsDAO (Scala), the code handles different dataset types distinctly:
1. Non-WKW datasets have `magsOpt` populated and use the first branch which includes axisOrder, channelIndex, and credentialId.
2. WKW datasets will have `wkwResolutionsOpt` populated and use the second branch which includes cubeLength.
3. The final branch is a fallback for legacy data.
This ensures appropriate fields are populated for each dataset type.

Applied to files:

  • frontend/javascripts/viewer/model/sagas/dataset_saga.ts
  • frontend/javascripts/viewer/model/accessors/dataset_accessor.ts
📚 Learning: 2025-09-08T13:33:47.097Z
Learnt from: MichaelBuessemeyer
PR: scalableminds/webknossos#8824
File: frontend/javascripts/viewer/view/context_menu.tsx:1033-1039
Timestamp: 2025-09-08T13:33:47.097Z
Learning: In frontend/javascripts/viewer/view/context_menu.tsx, the segmentIdLabel intentionally shows the unmapped segment ID (maybeUnmappedSegmentId) in the "within Segment ${id}" text when proofreading is active, as this can be helpful for users. The mapped segment ID (segmentIdAtPosition) is only used as a fallback when the unmapped ID is not available.

Applied to files:

  • frontend/javascripts/viewer/view/context_menu.tsx
🧬 Code graph analysis (26)
frontend/javascripts/types/api_types.ts (1)
frontend/javascripts/viewer/constants.ts (1)
  • Vector3 (14-14)
frontend/javascripts/viewer/model/sagas/volume/proofread_saga.ts (2)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/volume/VolumeTracingService.scala (1)
  • volumeTracingLayer (641-660)
frontend/javascripts/test/model/model_resolutions.spec.ts (1)
frontend/javascripts/viewer/constants.ts (1)
  • Vector3 (14-14)
frontend/javascripts/viewer/view/action-bar/ai_job_modals/utils.tsx (3)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/test/fixtures/hybridtracing_object.ts (1)
  • colorLayer (12-31)
frontend/javascripts/viewer/view/action-bar/ai_job_modals/constants.ts (1)
  • MEAN_VX_SIZE (31-35)
frontend/javascripts/viewer/model/bucket_data_handling/wkstore_adapter.ts (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/model/sagas/flycam_info_cache_saga.ts (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/view/action-bar/ai_job_modals/components/bounding_box_selection_form_item.tsx (1)
frontend/javascripts/test/fixtures/hybridtracing_object.ts (1)
  • colorLayer (12-31)
frontend/javascripts/viewer/model/sagas/volume/min_cut_saga.ts (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/test/model/binary/cube.spec.ts (1)
frontend/javascripts/viewer/constants.ts (1)
  • Vector3 (14-14)
frontend/javascripts/viewer/view/action-bar/download_modal_view.tsx (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/model/sagas/dataset_saga.ts (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/admin/voxelytics/ai_model_list_view.tsx (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/view/action-bar/ai_job_modals/tabs/train_ai_model_tab.tsx (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/api/api_latest.ts (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (2)
  • getMagInfo (39-39)
  • getLayerByName (145-164)
frontend/javascripts/viewer/view/context_menu.tsx (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/view/left-border-tabs/modals/add_volume_layer_modal.tsx (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/model/accessors/flycam_accessor.ts (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (2)
  • getMagInfo (39-39)
  • getLayerByName (145-164)
frontend/javascripts/viewer/geometries/materials/plane_material_factory.ts (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/model/accessors/volumetracing_accessor.ts (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/view/action-bar/create_animation_modal.tsx (2)
frontend/javascripts/test/fixtures/hybridtracing_object.ts (1)
  • colorLayer (12-31)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/view/action-bar/ai_job_modals/forms/train_ai_model_form.tsx (2)
frontend/javascripts/test/fixtures/hybridtracing_object.ts (1)
  • colorLayer (12-31)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/model/sagas/volume/quick_select/quick_select_heuristic_saga.ts (1)
frontend/javascripts/test/fixtures/hybridtracing_object.ts (1)
  • colorLayer (12-31)
frontend/javascripts/viewer/view/right-border-tabs/segments_tab/segment_statistics_modal.tsx (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/dashboard/advanced_dataset/create_explorative_modal.tsx (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/model/bucket_data_handling/layer_rendering_manager.ts (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-smoketest-push
  • GitHub Check: backend-tests
🔇 Additional comments (46)
frontend/javascripts/viewer/view/action-bar/ai_job_modals/components/bounding_box_selection_form_item.tsx (1)

35-35: mags[0] swap looks correct

colorLayer.mags already provides the same triple the validator needs, so pulling the first entry keeps the export-size checks working while aligning with the new naming.

frontend/javascripts/viewer/view/action-bar/ai_job_modals/tabs/train_ai_model_tab.tsx (1)

21-21: Ensure segmentation layers expose mags before swapping from resolutions.

getSegmentationLayerByHumanReadableName still returns layer objects that (as of the previous rollout) only surfaced resolutions. Switching this call to segmentationLayer.mags will hand getMagInfo an undefined argument until the store/backend payload is updated, which would blow up the modal. Please confirm that the layer DTOs in the dataset/tracing store already expose mags, or keep the resolutions fallback until that migration lands. Based on learnings

frontend/javascripts/viewer/model/bucket_data_handling/layer_rendering_manager.ts (3)

193-193: LGTM: Correct migration from resolutions to mags.

The change from layer.resolutions to layer.mags aligns with the broader refactoring effort and maintains the same functionality for calculating maximumMagIndex.


202-202: LGTM: Consistent use of mags for getDenseMags call.

The change from layer.resolutions to layer.mags in the getDenseMags() call is correct and maintains consistency with the previous change on line 193.


193-202: All getMagInfo calls now use layer.mags
Search across the codebase found zero instances of getMagInfo with .resolutions.

frontend/javascripts/viewer/model/sagas/flycam_info_cache_saga.ts (1)

110-110: Switch to layer.mags when computing dense mags — looks good

Change aligns with the repo‑wide migration and the worker’s intent.

Please double‑check that AsyncGetMaximumZoomForAllMags (and _getMagInfo) now uniformly expect mags arrays across viewer modules to avoid mixed inputs.

frontend/javascripts/viewer/view/right-border-tabs/segments_tab/segment_statistics_modal.tsx (1)

102-103: Use mags for finest mag selection — OK

Consistent with API/types migration; no control‑flow changes.

Based on learnings

frontend/javascripts/viewer/view/action-bar/create_animation_modal.tsx (1)

66-70: Use colorLayer.mags in texture mag selection — OK

This keeps the heuristic unchanged while sourcing from the new mags field.

frontend/javascripts/test/sagas/annotation_tool_disabled_info.spec.ts (2)

24-35: Tests: migrate resolutions → mags for layer[0] — OK

Matches the new data shape; comment explains the need for more mags.


38-49: Tests: migrate resolutions → mags for layer[1] — OK

Consistent with the updated fixtures and accessors.

frontend/javascripts/test/model/accessors/flycam_accessors.spec.ts (1)

29-35: LGTM - Test fixture property update aligned with PR objective.

The change from resolutions to mags in the test fixture correctly aligns with the broader codebase migration. The magnification arrays remain identical, ensuring test behavior consistency while updating to the new property naming convention.

Also applies to: 43-47

frontend/javascripts/viewer/model/accessors/volumetracing_accessor.ts (2)

205-205: LGTM - Consistent mag data source update.

The change from segmentationLayer.resolutions to segmentationLayer.mags properly aligns with the project-wide migration while maintaining identical functionality for getMagInfo calls.


539-539: LGTM – Mag data source consistently updated. Change aligns with the broader refactoring and getMagInfo behavior remains unchanged.

frontend/javascripts/test/model/binary/cube.spec.ts (1)

54-63: LGTM - Test mock property renamed consistently.

The change from resolutions to mags in the mocked layer objects correctly reflects the API change while maintaining identical test data and behavior. The MagInfo instantiation properly uses the updated property name.

Also applies to: 278-280

frontend/javascripts/test/fixtures/volumetracing_object.ts (1)

62-66: LGTM - Test fixture updated to match API changes.

The property rename from resolutions to mags in the test fixture data layers correctly aligns with the broader API migration while preserving the same magnification values for test consistency.

frontend/javascripts/viewer/view/context_menu.tsx (1)

1699-1699: LGTM - Context menu mag data source updated.

The change from visibleSegmentationLayer.resolutions to visibleSegmentationLayer.mags correctly updates the magnification data source while maintaining the same getMagInfo functionality for segment volume calculations.

frontend/javascripts/viewer/model/data_layer.ts (1)

40-40: LGTM - Data layer initialization updated for mags property.

The change from layerInfo.resolutions to layerInfo.mags correctly updates the magnification data source during DataLayer construction. The downstream usage through getMagInfo(this.mags) remains consistent.

frontend/javascripts/test/model/volumetracing/volume_annotation_sampling.spec.ts (1)

71-80: LGTM - Test setup updated for mags property.

The change from resolutions to mags in the mocked layer correctly aligns the test with the API migration. The MagInfo instantiation and test behavior remain identical.

frontend/javascripts/dashboard/advanced_dataset/create_explorative_modal.tsx (1)

97-97: LGTM - Modal mag data sources updated consistently.

Both changes from selectedSegmentationLayer.resolutions to selectedSegmentationLayer.mags correctly align with the project-wide migration:

  • Line 97: RestrictMagnificationSlider mag info derivation
  • Line 200: CreateExplorativeModal mag info computation

The magnification functionality and UI behavior remain unchanged.

Also applies to: 200-200

frontend/javascripts/test/model/binary/pullqueue.spec.ts (1)

42-42: LGTM: test mock migrated to mags

The mocked layer now exposes mags, consistent with API types and consumers.

frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx (1)

298-300: Use mags for tooltip mag list — OK

Swapping to getMagInfo(layer.mags) aligns with the type change and downstream helpers.

frontend/javascripts/viewer/model/sagas/dataset_saga.ts (1)

117-120: Switch to mags for downsampling warning — OK

getMagInfo(dataLayer.mags) matches the new layer shape. Ensure all dataLayers now provide mags at runtime (incl. legacy paths) to avoid null/undefined access.

frontend/javascripts/viewer/model/sagas/volume/min_cut_saga.ts (1)

287-289: Use mags for min-cut mag selection — OK

Selecting magInfo from volumeTracingLayer.mags is consistent with the type migration.

frontend/javascripts/viewer/model/sagas/volume/proofread_saga.ts (1)

1239-1247: Proofreading now bases magInfo on mags — double-check intent

Previously, certain proofreading paths intentionally used resolutions. With the global type change, using mags is likely required, but please verify the chosen agglomerateFileMag/zoomstep mirrors prior behavior (finest vs. current mag) and doesn’t regress operations.

Based on learnings

frontend/javascripts/test/model/model_resolutions.spec.ts (5)

7-7: Test suite rename to mags — OK


25-35: Test fixtures use mags — OK

Shapes align with Vector3[] and convertToDenseMag inputs.


59-59: Helper updated to mags — OK


81-94: getMagUnion test data migrated — OK


108-121: Mixed mags union test migrated — OK

frontend/javascripts/viewer/model/accessors/flycam_accessor.ts (3)

418-425: getCurrentMag now reads mags — OK

Matches dataset layer shape and MagInfo API.


631-633: Unrenderable-layer check uses mags — OK

magInfo(layer.mags) keeps logic intact.


679-681: Active mag info derived from mags — OK

Consistent with global migration.

frontend/javascripts/types/api_types.ts (1)

95-101: No .resolutions references remain
Scanning returned zero hits; please confirm parsing/serialization populates mags for WKW, Zarr, and legacy formats before merging.

frontend/javascripts/test/fixtures/hybridtracing_object.ts (1)

21-27: Fixture migrated to mags correctly

Property rename to mags with same triplets looks consistent with APIColorLayer and wider PR.

frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (4)

44-46: Use mags for per-layer MagInfo

Switch to layer.mags for getMagInfoByLayer is correct and consistent with the new API shape.


69-71: Magnification union now based on mags

Iterating over layer.mags and grouping by max axis preserves previous behavior under the new field name.

Also applies to: 86-91


94-96: Widest mags computed from mags

convertToDenseMag(layer.mags) aligns with the refactor; no issues.


139-140: Visible segmentation layer MagInfo via mags

Good use of mags; empty fallback remains handled above.

frontend/javascripts/viewer/geometries/materials/plane_material_factory.ts (1)

920-921: Vertex alignment MagInfo derived from mags

Using getMagInfo(layer.mags) is consistent with dataset_accessor and the PR direction.

frontend/javascripts/viewer/model_initialization.ts (2)

615-617: Robust conversion of tracing mags

Mapping ServerVolumeTracing.mags {x,y,z} -> Vector3[] with fallback [[1,1,1]] covers legacy tracings.


625-633: Tracing layer now exposes mags

Setting mags on the synthesized APISegmentationLayer matches downstream consumers.

frontend/javascripts/viewer/view/action-bar/ai_job_modals/utils.tsx (1)

46-48: Mitochondria infers on finest mag via mags

getMagInfo(colorLayer.mags).getFinestMag() is the right source after the rename.

frontend/javascripts/test/fixtures/dataset_server_object.ts (2)

13-20: Color layer fixture: mags migration LGTM

Triplets retained, unsorted comment preserved.


36-43: Segmentation layer fixture: mags migration LGTM

Property rename aligns with types and other fixture changes.

frontend/javascripts/viewer/api/api_latest.ts (1)

689-696: API paths now consistently source MagInfo from mags

All updated call sites (segment registration, getDataValue, getDataForBoundingBox, getViewportData, raw download URL) correctly use layer.mags.

Also applies to: 1875-1877, 1932-1941, 1978-1983, 2139-2141

frontend/javascripts/viewer/view/left-border-tabs/modals/add_volume_layer_modal.tsx (1)

148-152: Switch to mags is safe. APISegmentationLayer defines only mags (no resolutions), and all calls to getMagInfo already expect a mags array—no interim guard required.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx (1)

1143-1143: Fix type mismatch in _.differenceWith comparison.

possibleMags is Vector3[], but volumeTracingMags is Array<{ mag: Vector3; path?: string }>. Comparing these with _.isEqual will never find matches because the shapes differ. Extract the mag property before comparison.

Apply this diff:

-    const magsToDownsample = _.differenceWith(possibleMags, volumeTracingMags, _.isEqual);
+    const magsToDownsample = _.differenceWith(possibleMags, volumeTracingMags.map(m => m.mag), _.isEqual);
♻️ Duplicate comments (1)
frontend/javascripts/admin/voxelytics/ai_model_list_view.tsx (1)

155-157: Verify mags availability on dataset segmentation layers.

A previous review flagged that getSegmentationLayerByName might return dataset segmentation layers that only expose resolutions, not mags. If the migration is incomplete, accessing segmentationLayer.mags could pass undefined to getMagInfo, causing a runtime failure.

Consider adding a fallback until all dataset layers are confirmed to have the mags field:

-      return getMagInfo(segmentationLayer.mags);
+      return getMagInfo(segmentationLayer.mags ?? segmentationLayer.resolutions ?? []);

Run the following script to check if any dataset segmentation layers in the codebase still use resolutions:

#!/bin/bash
# Search for segmentation layer definitions that might still use resolutions field
rg -nP --type=ts -C3 'category.*segmentation|segmentation.*category' | rg -A10 -B10 'resolutions'
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 869dddf and 2d971d0.

📒 Files selected for processing (18)
  • frontend/javascripts/admin/voxelytics/ai_model_list_view.tsx (1 hunks)
  • frontend/javascripts/test/fixtures/dataset_server_object.ts (2 hunks)
  • frontend/javascripts/test/fixtures/hybridtracing_object.ts (1 hunks)
  • frontend/javascripts/test/fixtures/volumetracing_object.ts (1 hunks)
  • frontend/javascripts/test/model/accessors/flycam_accessors.spec.ts (2 hunks)
  • frontend/javascripts/test/model/model_resolutions.spec.ts (5 hunks)
  • frontend/javascripts/test/sagas/annotation_tool_disabled_info.spec.ts (1 hunks)
  • frontend/javascripts/types/api_types.ts (1 hunks)
  • frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (5 hunks)
  • frontend/javascripts/viewer/model/data_layer.ts (2 hunks)
  • frontend/javascripts/viewer/model/helpers/mag_info.ts (2 hunks)
  • frontend/javascripts/viewer/model/sagas/volume/quick_select/quick_select_heuristic_saga.ts (1 hunks)
  • frontend/javascripts/viewer/model_initialization.ts (1 hunks)
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/components/annotations_csv_input.tsx (1 hunks)
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/components/bounding_box_selection_form_item.tsx (1 hunks)
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/utils.tsx (3 hunks)
  • frontend/javascripts/viewer/view/action-bar/create_animation_modal.tsx (2 hunks)
  • frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • frontend/javascripts/test/model/model_resolutions.spec.ts
  • frontend/javascripts/types/api_types.ts
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/components/bounding_box_selection_form_item.tsx
  • frontend/javascripts/viewer/view/action-bar/create_animation_modal.tsx
  • frontend/javascripts/viewer/model/sagas/volume/quick_select/quick_select_heuristic_saga.ts
  • frontend/javascripts/viewer/model_initialization.ts
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: dieknolle3333
PR: scalableminds/webknossos#8168
File: frontend/javascripts/oxalis/model/reducers/skeletontracing_reducer_helpers.ts:125-125
Timestamp: 2024-11-22T17:17:39.914Z
Learning: In the `createNode` function within `skeletontracing_reducer_helpers.ts`, the property `resolution` is intentionally kept even when the parameter is renamed to `mag`.
📚 Learning: 2024-11-22T17:18:04.217Z
Learnt from: dieknolle3333
PR: scalableminds/webknossos#8168
File: frontend/javascripts/oxalis/model/sagas/proofread_saga.ts:1039-1039
Timestamp: 2024-11-22T17:18:04.217Z
Learning: In `frontend/javascripts/oxalis/model/sagas/proofread_saga.ts`, when calling `getMagInfo`, the use of `volumeTracingLayer.resolutions` is intentional and should not be changed to `volumeTracingLayer.mags`.

Applied to files:

  • frontend/javascripts/test/fixtures/volumetracing_object.ts
  • frontend/javascripts/admin/voxelytics/ai_model_list_view.tsx
  • frontend/javascripts/test/fixtures/hybridtracing_object.ts
  • frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/components/annotations_csv_input.tsx
  • frontend/javascripts/viewer/view/action-bar/ai_job_modals/utils.tsx
  • frontend/javascripts/viewer/model/accessors/dataset_accessor.ts
  • frontend/javascripts/viewer/model/helpers/mag_info.ts
  • frontend/javascripts/test/fixtures/dataset_server_object.ts
  • frontend/javascripts/viewer/model/data_layer.ts
📚 Learning: 2024-11-22T17:19:07.947Z
Learnt from: dieknolle3333
PR: scalableminds/webknossos#8168
File: frontend/javascripts/oxalis/model/sagas/volumetracing_saga.tsx:433-434
Timestamp: 2024-11-22T17:19:07.947Z
Learning: In the codebase, certain usages of `segmentationLayer.resolutions` are intentionally retained and should not be changed to `segmentationLayer.mags` during refactoring.

Applied to files:

  • frontend/javascripts/admin/voxelytics/ai_model_list_view.tsx
  • frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx
  • frontend/javascripts/test/fixtures/dataset_server_object.ts
  • frontend/javascripts/viewer/model/data_layer.ts
📚 Learning: 2024-12-16T15:48:37.065Z
Learnt from: knollengewaechs
PR: scalableminds/webknossos#8266
File: frontend/javascripts/components/mag_selection.tsx:51-60
Timestamp: 2024-12-16T15:48:37.065Z
Learning: In the `MagSelection` component (`frontend/javascripts/components/mag_selection.tsx`), the selected magnification `value` will always be present in `allMags` because only existing values can be selected by the user.

Applied to files:

  • frontend/javascripts/viewer/model/accessors/dataset_accessor.ts
🧬 Code graph analysis (8)
frontend/javascripts/admin/voxelytics/ai_model_list_view.tsx (2)
frontend/javascripts/viewer/constants.ts (1)
  • Vector3 (14-14)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (2)
  • getMagInfo (39-39)
  • getSegmentationLayerByName (167-178)
frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx (1)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/viewer/view/action-bar/ai_job_modals/components/annotations_csv_input.tsx (1)
frontend/javascripts/viewer/constants.ts (1)
  • Vector3 (14-14)
frontend/javascripts/viewer/view/action-bar/ai_job_modals/utils.tsx (4)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (1)
  • getMagInfo (39-39)
frontend/javascripts/test/fixtures/hybridtracing_object.ts (1)
  • colorLayer (12-31)
frontend/javascripts/viewer/view/action-bar/ai_job_modals/constants.ts (1)
  • MEAN_VX_SIZE (31-35)
frontend/javascripts/viewer/constants.ts (1)
  • Vector3 (14-14)
frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (2)
frontend/javascripts/viewer/constants.ts (1)
  • Vector3 (14-14)
frontend/javascripts/viewer/model/helpers/mag_info.ts (2)
  • MagInfo (11-225)
  • convertToDenseMags (227-257)
frontend/javascripts/viewer/model/helpers/mag_info.ts (1)
frontend/javascripts/viewer/constants.ts (1)
  • Vector3 (14-14)
frontend/javascripts/test/model/accessors/flycam_accessors.spec.ts (1)
frontend/javascripts/viewer/constants.ts (1)
  • Vector3 (14-14)
frontend/javascripts/viewer/model/data_layer.ts (1)
frontend/javascripts/viewer/constants.ts (1)
  • Vector3 (14-14)
🔇 Additional comments (26)
frontend/javascripts/test/sagas/annotation_tool_disabled_info.spec.ts (1)

24-47: LGTM! Test fixture correctly updated to mags structure.

The test fixture has been properly updated to use the new mags: [{ mag: Vector3 }] structure instead of the old resolutions: Vector3[] format. The comment on line 24 has also been appropriately updated to reference "mags" instead of "resolutions".

frontend/javascripts/test/fixtures/volumetracing_object.ts (1)

62-62: LGTM! Fixture correctly updated to mags structure.

The test fixture has been properly updated to use the new mags: [{ mag: Vector3 }] structure.

frontend/javascripts/viewer/model/data_layer.ts (2)

19-19: LGTM! Property type correctly updated.

The mags property type has been correctly updated from Array<Vector3> to Array<{ mag: Vector3 }> to match the new data structure.


40-40: LGTM! Initialization source updated correctly.

The initialization has been properly updated to read from layerInfo.mags instead of the old layerInfo.resolutions field.

frontend/javascripts/admin/voxelytics/ai_model_list_view.tsx (1)

152-152: LGTM! Fallback mags structure correctly updated.

The fallback value has been properly updated to use the new mags: [{ mag: Vector3 }] structure.

frontend/javascripts/test/model/accessors/flycam_accessors.spec.ts (3)

11-11: LGTM!

The Vector3 type assertion for topLeft correctly matches the expected type definition.


28-36: LGTM!

The migration from resolutions to mags is consistent with the PR's objective to reshape magnification data. Each magnification is correctly wrapped in an object with a mag property, and the additionalAxes property has been properly added.


42-44: LGTM!

The mags property correctly replaces resolutions with the new object-wrapped structure, and additionalAxes has been appropriately added.

frontend/javascripts/test/fixtures/hybridtracing_object.ts (1)

21-27: LGTM!

The mags property correctly replaces resolutions with each magnification wrapped in an object containing the mag property. The values remain unchanged, ensuring backward compatibility.

frontend/javascripts/test/fixtures/dataset_server_object.ts (2)

13-20: LGTM!

The mags property correctly replaces resolutions with each magnification wrapped in an object. The intentional unsorted ordering (with the "unsorted on purpose" comment) is properly preserved for testing edge cases.


36-43: LGTM!

The mags property correctly replaces resolutions with the same object-wrapped structure as the color layer, maintaining the intentional unsorted ordering for test coverage.

frontend/javascripts/viewer/model/helpers/mag_info.ts (2)

45-45: LGTM!

The call site correctly uses the renamed convertToDenseMags function, maintaining consistency with the plural naming convention.


227-227: LGTM!

The function rename from convertToDenseMag to convertToDenseMags uses the plural form, which better reflects that it operates on an array of magnifications. The function body remains unchanged, preserving the existing logic.

frontend/javascripts/viewer/model/accessors/dataset_accessor.ts (6)

31-31: LGTM!

The import statement correctly references the renamed convertToDenseMags function from the mag_info helper.


33-34: LGTM!

The _getMagInfo function correctly adapts to the new mags data structure by accepting Array<{ mag: Vector3 }> and mapping to extract the mag property for the MagInfo constructor.


45-45: LGTM!

The call site correctly uses layer.mags instead of layer.resolutions, aligning with the new data model.


70-71: LGTM!

The getMagnificationUnion function correctly adapts to the new mags structure by iterating over layer.mags and extracting the mag property from each object.


96-96: LGTM!

The getWidestMags function correctly adapts to use layer.mags and calls the renamed convertToDenseMags function, properly extracting the mag property from each object.


140-140: LGTM!

The _getMagInfoOfVisibleSegmentationLayer function correctly uses segmentationLayer.mags instead of segmentationLayer.resolutions, consistent with the broader data model migration.

frontend/javascripts/viewer/view/left-border-tabs/layer_settings_tab.tsx (2)

298-298: LGTM! Migration to mags correctly applied.

The change from layer.resolutions to layer.mags aligns with the PR's objective to replace resolutions with the new mags structure.


1127-1127: LGTM! Correctly extracts mag values.

The destructuring and mapping correctly adapts to the new mags structure by extracting the mag property.

frontend/javascripts/viewer/view/action-bar/ai_job_modals/utils.tsx (3)

50-67: LGTM! Magnification selection logic correctly migrated.

The loop properly extracts mag from each mags array element and maintains the same selection logic. All accesses to magInfo.mag are consistent throughout the calculation.


128-128: No occurrences of volumeTracingMags found; manually verify that any constructors, consumers, and tests handling AnnotationInfoForAITrainingJob are updated to the new { mag: Vector3 }[][] signature.


46-46: Ensure getMagInfo memoization handles new mags references
Default lodash memoize uses reference equality, so if colorLayer.mags arrays are recreated on each render, the cache will always miss. Verify how and where colorLayer.mags is constructed and consider supplying a custom resolver or stabilizing its reference before calling getMagInfo.

frontend/javascripts/viewer/view/action-bar/ai_job_modals/components/annotations_csv_input.tsx (2)

112-112: LGTM! Improved clarity by extracting the transformation.

Extracting volumeTracingMags into a separate variable improves readability and aligns with the broader migration from resolutions to mags.


103-107: Verify empty mags handling
The current fallback ([{ mag: [1,1,1] }]) only applies when mags is undefined, not when it’s an empty array—so volumeTracingMags may contain empty arrays if mags: []. Confirm whether downstream consumers expect at least one magnification level or if empty arrays are acceptable; adjust the check to treat [] like undefined if needed.

@philippotto philippotto changed the title [WIP] Replace resolutions with mags Replace resolutions with mags Oct 1, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
frontend/javascripts/test/model/model_resolutions.spec.ts (2)

77-102: Minor formatting inconsistency in object literal.

Line 83 has {mag: [4, 4, 1]} without a space after the colon, while lines 84-86, 91-93 use {mag: with a space. Consider consistent spacing for readability.

Apply this diff to fix the spacing:

           mags: [
-            {mag: [4, 4, 1]},
+            {mag: [4, 4, 1]},
             {mag: [8, 8, 1]},
             {mag: [16, 16, 2]},
             {mag: [32, 32, 4]},

104-139: Minor formatting inconsistency in object literal.

Line 110 has {mag: [4, 4, 1]} without a space after the colon, while lines 111-113, 118-120 use {mag: with a space. Consider consistent spacing for readability.

Apply this diff to fix the spacing:

           mags: [
-            {mag: [4, 4, 1]},
+            {mag: [4, 4, 1]},
             {mag: [8, 8, 1]},
             {mag: [16, 16, 2]},
             {mag: [32, 32, 4]},
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b1387f7 and 685e492.

📒 Files selected for processing (1)
  • frontend/javascripts/test/model/model_resolutions.spec.ts (5 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-22T17:18:04.217Z
Learnt from: dieknolle3333
PR: scalableminds/webknossos#8168
File: frontend/javascripts/oxalis/model/sagas/proofread_saga.ts:1039-1039
Timestamp: 2024-11-22T17:18:04.217Z
Learning: In `frontend/javascripts/oxalis/model/sagas/proofread_saga.ts`, when calling `getMagInfo`, the use of `volumeTracingLayer.resolutions` is intentional and should not be changed to `volumeTracingLayer.mags`.

Applied to files:

  • frontend/javascripts/test/model/model_resolutions.spec.ts
🧬 Code graph analysis (1)
frontend/javascripts/test/model/model_resolutions.spec.ts (1)
frontend/javascripts/viewer/constants.ts (1)
  • Vector3 (14-14)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-smoketest-push
  • GitHub Check: backend-tests
🔇 Additional comments (3)
frontend/javascripts/test/model/model_resolutions.spec.ts (3)

1-18: LGTM! Import and test names properly updated.

The import statement and test suite names have been correctly updated to reflect the rename from convertToDenseMag to convertToDenseMags. The simple test case correctly exercises the function with a direct array of Vector3 values.


20-64: LGTM! Data structure correctly updated to new mags format.

The test properly reflects the new data structure where resolutions: Vector3[] becomes mags: { mag: Vector3 }[]. The densify helper correctly extracts the mag property before passing to convertToDenseMags, and test expectations remain accurate.


66-75: LGTM! Empty case test remains valid.

This test correctly verifies the behavior with an empty dataset and requires no changes related to the mags refactoring.

@philippotto philippotto changed the title Replace resolutions with mags Use mags instead of resolutions in datasource Oct 1, 2025
@philippotto philippotto requested a review from daniel-wer October 1, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove "resolutions" from json dataset info route, adapt frontend and libs
1 participant