Skip to content

feat(draftworkflow): display metadata columns in restricted drafts (#16758)#16761

Merged
frapuks merged 3 commits into
masterfrom
issue/16758
Jun 24, 2026
Merged

feat(draftworkflow): display metadata columns in restricted drafts (#16758)#16761
frapuks merged 3 commits into
masterfrom
issue/16758

Conversation

@frapuks

@frapuks frapuks commented Jun 23, 2026

Copy link
Copy Markdown
Member

Proposed changes

  • Display metadata columns in restricted drafts

Related issues

How to test this PR

  • Go to data / restriction / restricted draft
  • See metadata colums
  • Deactivate FF
  • See old columns

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant use cases (coverage and e2e)
  • I added/updated the relevant documentation (either on GitHub or on Notion)
  • Where necessary, I refactored code to improve the overall quality

@frapuks frapuks self-assigned this Jun 23, 2026
Copilot AI review requested due to automatic review settings June 23, 2026 09:25
@frapuks frapuks added the filigran team Item from the Filigran team. label Jun 23, 2026
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.68966% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 24.35%. Comparing base (1927917) to head (3b52cf2).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
...e/components/data/restriction/RestrictedDrafts.tsx 0.00% 11 Missing ⚠️
...rivate/components/common/draft/DraftStatusChip.tsx 12.50% 7 Missing ⚠️
...cti-front/src/private/components/drafts/Drafts.tsx 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #16761      +/-   ##
==========================================
+ Coverage   24.10%   24.35%   +0.24%     
==========================================
  Files        3271     3273       +2     
  Lines      173270   174726    +1456     
  Branches    42959    43594     +635     
==========================================
+ Hits        41767    42554     +787     
- Misses     131503   132172     +669     
Flag Coverage Δ
opencti-client-python 46.30% <ø> (ø)
opencti-front 5.71% <20.68%> (+0.09%) ⬆️
opencti-graphql 66.70% <ø> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Restricted Drafts page (opencti-front) to show the same “metadata” columns as the main Drafts page when the DRAFT_WORKFLOW feature flag is enabled, while preserving the previous column set when the flag is disabled.

Changes:

  • Extend the Relay fragment for restricted drafts to fetch metadata fields (createdBy, assignee/participant, workflow status, etc.).
  • Add a feature-flag-driven switch between the legacy columns and the metadata column set.
  • Add runtime-sorting awareness (OpenSearch vs Elasticsearch) and a guard hook to mitigate persisted runtime-only sort fields.

@Archidoit

Copy link
Copy Markdown
Member

Working well :)

@frapuks

frapuks commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

Ready for 2nd review.
I fix Kevin comments and copilot comments.

🧩 Column alignment
RestrictedDrafts now displays the same columns as Drafts:
• Without DRAFT_WORKFLOW FF: name, creator, created_at, status, validation progress
• With DRAFT_WORKFLOW FF: adds createdBy, objectAssignee, objectParticipant + ItemStatus for workflow
The GraphQL fragment was updated accordingly to fetch the new fields.

♻️ DraftStatusChip extraction
The Chip + ItemStatus render logic for draft status was duplicated in both pages. It's now extracted into a shared component: src/private/components/common/draft/DraftStatusChip.tsx
Both pages use it, keeping the visual behaviour identical.

🐛 Race condition fix — OpenSearch UnsupportedError
useRuntimeSortGuard ran in a useEffect, but useQueryLoading also fires its first query in a useEffect. On first render, both effects flush in the same batch: the first (bad) query could be sent with a runtime-only orderBy (e.g. createdBy) before the guard had a chance to correct it — triggering an UnsupportedError on OpenSearch instances.
Fix: useRuntimeSortGuard now returns a safeSortBy value computed synchronously during render. Both Drafts and RestrictedDrafts use it directly in queryPaginationOptions. The useEffect is kept to repair the persisted localStorage state for subsequent reloads.

🧹 Minor cleanup
isDraftWorkflowEnabled extracted as a named boolean in both components (single source of truth for FF check)
Explicit RestrictedDrafts_node$data type annotations removed from render callbacks (inferred, consistent with Drafts.tsx)

@frapuks frapuks merged commit 7b03269 into master Jun 24, 2026
43 checks passed
@frapuks frapuks deleted the issue/16758 branch June 24, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(draft): Restricted drafts page don't show the new metadata columns

4 participants