Skip to content

fix(tests): patch the legacy status to a status different from the current one (#18325) - #18327

Merged
Xavier Fournet (xfournet) merged 1 commit into
masterfrom
issue/18325-raw-stream-status-tie
Sep 17, 2026
Merged

Xavier Fournet (xfournet) merged 1 commit into
masterfrom
issue/18325-raw-stream-status-tie

Conversation

@xfournet

Copy link
Copy Markdown
Member

Proposed changes

  • In workflow-test.ts, the legacy-status test patches the report to a status explicitly different from its current one, read through the API, instead of the positional statuses[1]. Since feat(workflow): Make workflow publish create/resolve Status #17898 the Report statuses hold two entries with the same order (the legacy NEW and the workflow's validated), the status cache sorts by order only, and the positional pick landed on the current status or not depending on the Elasticsearch tie-break: no write and no stream event in one case, one event in the other.
  • In syncCountHelper.ts, the expected count of report update events goes back to 16: the patch now always changes the status and always emits its event. The 15 recorded by feat(workflow): Make workflow publish create/resolve Status #17898 came from a run where the coin had landed on NEW.

Related issues

How to test this PR

The failure showed on roughly one backend integration run out of three since 2026-09-16 (c46f7b4405, 8e8fd7058e, 35809ac25f on master, #18236, #18316, #18267, #18323 on pull requests), always as:

FAIL tests/10-streams/00-Raw/raw-test.js > Raw streams tests > Should stream correctly formatted
AssertionError: Updated report count should be 15 but got 16

with the extra event being the workflow_id replace on Legacy Status Patch Test Report. With this change the event is emitted on every run, so the CI integration job is the test: several green runs in a row, where the previous state gave a red one every three.

Nothing runs locally for this: the raw stream test needs the full CI stack (platform, worker, Redis stream).

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

Further comments

  • The test's previous comment claimed findByType reads Elasticsearch directly; it reads the status cache of the test-runner process. Replaced by the explanation of the pick.
  • Not addressed here, noted on the issue: the order values computed at publication (0, 1, 2, …) collide with those of the legacy statuses of the same type (1, 2, 3, 4), and the status cache sort has no secondary key, so the relative order of two statuses with the same order is undefined in the product as well.

🤖 Generated with Claude Code

…rrent one (#18325)

Since the workflow publication creates a Status per state, the Report
statuses hold two entries with the same `order` (the legacy NEW and the
workflow's `validated`), and the status cache sorts by `order` only. The
positional pick `statuses[1]` therefore landed on the report's current
status or not depending on the Elasticsearch tie-break: no write and no
stream event in the first case, one event in the second, and the raw
stream test failed on one run out of three with 16 report updates
instead of the 15 that had been recorded from a run of the first kind.

Pick a status explicitly different from the report's current one, so the
patch always changes the status and always emits its event, and record
the deterministic count of 16.
Copilot AI lite review requested due to automatic review settings September 17, 2026 12:38
@github-actions github-actions Bot added the filigran team Item from the Filigran team. label Sep 17, 2026

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.

🟢 Approval recommended

No blocking issues were identified.

Pull request overview

This pull request stabilizes workflow integration tests by ensuring the legacy status patch always changes the report status.

Changes:

  • Selects a status different from the current status.
  • Restores the expected report update count to 16.
File summaries
File Summary
opencti-platform/opencti-graphql/tests/utils/syncCountHelper.ts Updates the expected report event count.
opencti-platform/opencti-graphql/tests/03-integration/02-resolvers/workflow-test.ts Ensures the legacy status patch uses a non-current status.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 36.37%. Comparing base (ed4c793) to head (af2dd57).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #18327      +/-   ##
==========================================
+ Coverage   28.13%   36.37%   +8.23%     
==========================================
  Files        3467     3467              
  Lines      141015   141015              
  Branches    38072    38072              
==========================================
+ Hits        39679    51294   +11615     
+ Misses     101336    89721   -11615     
Flag Coverage Δ
opencti-client-python 49.85% <ø> (ø)
opencti-front 12.68% <ø> (ø)
opencti-graphql 71.43% <ø> (+23.50%) ⬆️

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.

@xfournet
Xavier Fournet (xfournet) merged commit 9c1c2e0 into master Sep 17, 2026
58 checks passed
@xfournet
Xavier Fournet (xfournet) deleted the issue/18325-raw-stream-status-tie branch September 17, 2026 18:38
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(tests): the raw stream test flips between 15 and 16 report updates since workflow publish creates statuses

2 participants