twenty
twenty copied to clipboard
fix(workflow): UUID filter in "Search Records" action
Summary
- add a regression test that reproduces the workflow "Search Records → ID is <UUID>" failure (issue #15067 / #15746)
- adjust
turnRecordFilterIntoRecordGqlOperationFilterso UUID filters fall back to the literal value when norecordIdsForUuidcontext is provided, always emitting aninclause
Testing
- npx nx test twenty-shared -- --testPathPattern=computeRecordGqlOperationFilter.test.ts --coverage=false
- Manual: workflow "Search Records" with filter "ID is <UUID>" now returns the correct record
Fixes #15067 Fixes #15746
Greptile Overview
Greptile Summary
Fixes a critical workflow bug where "Search Records" action with filter "ID is {UUID}" was returning all records instead of the single matching record. The fix adds a fallback mechanism in the UUID filter case to use the literal UUID value when no recordIdsForUuid context is provided (workflow scenario), ensuring the filter always emits a proper in clause.
Key changes:
- Updated
turnRecordFilterIntoRecordGqlOperationFilterto check ifrecordIdsForUuidexists and has length > 0 before using it - Falls back to parsing
recordFilter.valueviaarrayOfUuidOrVariableSchemawhen no context is provided - Added regression test that validates the fix for workflow UUID filtering without context
The fix is minimal, targeted, and properly tested. The logic correctly handles both scenarios: when recordIdsForUuid context is provided (existing behavior) and when it's not (new workflow behavior).
Confidence Score: 5/5
- This PR is safe to merge with no identified risks
- The fix is minimal, well-targeted, and addresses a specific bug without affecting other functionality. It adds proper fallback logic with validation via the existing
arrayOfUuidOrVariableSchema, includes a regression test, and maintains backward compatibility by checking ifrecordIdsForUuidexists before falling back to the literal value. - No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| packages/twenty-shared/src/utils/filter/tests/computeRecordGqlOperationFilter.test.ts | 5/5 | New regression test for UUID filter without recordIdsForUuid context - properly validates fix |
| packages/twenty-shared/src/utils/filter/turnRecordFilterIntoGqlOperationFilter.ts | 5/5 | Fixes UUID filter to fallback to literal value when no recordIdsForUuid context provided |
Sequence Diagram
sequenceDiagram
participant WF as Workflow Action<br/>(Search Records)
participant CF as computeRecordGqlOperationFilter
participant TRF as turnRecordFilterIntoRecordGqlOperationFilter
participant VS as arrayOfUuidOrVariableSchema
participant GQL as GraphQL Query
WF->>CF: Filter: ID is {UUID}
Note over WF,CF: recordIdsForUuid = undefined<br/>(no context provided)
CF->>TRF: recordFilter, fields, filterValueDependencies
Note over TRF: Case 'UUID'
alt recordIdsForUuid exists and length > 0
TRF->>TRF: Use recordIdsForUuid
else No recordIdsForUuid context
TRF->>VS: Parse recordFilter.value
VS-->>TRF: [UUID]
Note over TRF: NEW FIX: Falls back to<br/>literal UUID value
end
TRF-->>CF: {id: {in: [UUID]}}
CF-->>WF: Complete filter object
WF->>GQL: Query with proper UUID filter
GQL-->>WF: Returns single matching record
Thanks @rdelassus for your contribution! This marks your 1st PR on the repo. You're top 39% of all our contributors 🎉 See contributor page - Share on LinkedIn - Share on Twitter
