Skip to content

[backend] Fix dashboard export failing with dynamicRegardingOf filters (#14539, #14527)#14858

Merged
SamuelHassine merged 1 commit intomasterfrom
fix/dashboard-export-dynamic-regarding-of
Mar 8, 2026
Merged

[backend] Fix dashboard export failing with dynamicRegardingOf filters (#14539, #14527)#14858
SamuelHassine merged 1 commit intomasterfrom
fix/dashboard-export-dynamic-regarding-of

Conversation

@SamuelHassine
Copy link
Member

@SamuelHassine SamuelHassine commented Mar 8, 2026

Summary

Root Cause

The extractFiltersIds and replaceFiltersIds functions in workspace-utils.ts only handled the regardingOf filter key when processing nested subfilter objects (whose values are { key, values } objects rather than plain strings). The dynamicRegardingOf filter has the same nested structure but was not handled, causing the code to pass these objects directly to isInternalId() / isUUID(), which expects a string - resulting in TypeError: Expected a string but received a Object.

Changes

workspace-utils.ts:

  • Added import for INSTANCE_DYNAMIC_REGARDING_OF
  • Introduced isRegardingOfKey() helper to check for both regardingOf and dynamicRegardingOf filter keys
  • Updated extractFiltersIds to handle dynamicRegardingOf subfilters (including recursive extraction from the dynamic subfilter's nested FilterGroup values)
  • Updated replaceFiltersIds to handle dynamicRegardingOf subfilters (including recursive ID replacement in nested FilterGroup values and preservation of the dynamic subfilter)

workspace-utils-test.ts:

  • Added test for dynamicRegardingOf with ID subfilter + dynamic nested FilterGroup (verifies both ID remapping layers)
  • Added test for dynamicRegardingOf without ID subfilter (edge case where only relationship_type + dynamic are present)

Test plan

  • Existing test should convert widget filters ids still passes (no regression on regardingOf)
  • New test should convert widget filters ids with dynamicRegardingOf passes
  • New test should convert widget filters ids with dynamicRegardingOf without id subfilter passes
  • Manual: Create dashboard with In regard of (dynamic) widget filter, export dashboard -> JSON file downloads
  • Manual: Export individual widget with In regard of (dynamic) filter -> JSON file downloads
  • Manual: Import the exported dashboard on another instance -> filter structure preserved

#14527, #14539)

The export serializer (extractFiltersIds / replaceFiltersIds) only handled the regardingOf nested subfilter structure but not dynamicRegardingOf, causing isInternalId to receive an Object instead of a string and silently crashing the export.

Made-with: Cursor
@SamuelHassine SamuelHassine changed the title [backend] Fix dashboard export failing with dynamicRegardingOf filters [backend] Fix dashboard export failing with dynamicRegardingOf filters (#14539, #14527) Mar 8, 2026
@codecov
Copy link

codecov bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 32.38%. Comparing base (15b4e5a) to head (2d83e2e).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #14858   +/-   ##
=======================================
  Coverage   32.37%   32.38%           
=======================================
  Files        3111     3111           
  Lines      211860   211882   +22     
  Branches    38414    38421    +7     
=======================================
+ Hits        68594    68613   +19     
- Misses     143266   143269    +3     
Flag Coverage Δ
opencti-client-python 45.53% <ø> (ø)
opencti-front 2.82% <ø> (ø)
opencti-graphql 67.60% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@SamuelHassine SamuelHassine merged commit 0d5a15b into master Mar 8, 2026
40 of 44 checks passed
@SamuelHassine SamuelHassine deleted the fix/dashboard-export-dynamic-regarding-of branch March 8, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant