Skip to content

Refresh flags/segments on non-error live stream events#5889

Open
Copilot wants to merge 5 commits into
v2from
copilot/fix-flag-list-update-issue
Open

Refresh flags/segments on non-error live stream events#5889
Copilot wants to merge 5 commits into
v2from
copilot/fix-flag-list-update-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

Live Updates was receiving SSE events in the UI, but flag list state was not refreshing unless the event payload matched a single hardcoded type. As a result, users could see incoming stream activity while still seeing stale flag values in the list.

  • Streaming invalidation logic

    • Replaced strict type === 'refetchEvaluation' gating with a shared guard that invalidates cache for any non-null, non-error stream payload.
    • Kept explicit error events out of invalidation to avoid unnecessary refetch churn.
    • Updated log messaging to reflect intentional skip behavior rather than “unexpected event” semantics.
  • Shared stream-event guard

    • Added shouldInvalidateFromStreamEvent in ui/src/app/flags/streamingUtils.ts to centralize and clarify invalidation eligibility.
  • Focused coverage

    • Added unit tests for invalidation gating behavior:
      • refetchEvaluation payload → invalidate
      • payload without type → invalidate
      • error payload → do not invalidate
      • null payload → do not invalidate
// ui/src/app/flags/streamingUtils.ts
export const shouldInvalidateFromStreamEvent = (
  eventData: { type?: string; etag?: string } | null
) => eventData !== null && eventData.type !== 'error';

Copilot AI changed the title [WIP] Fix flag list not updating upon new stream event Refresh flags/segments on non-error live stream events May 21, 2026
Copilot AI requested a review from markphelps May 21, 2026 22:40
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.05%. Comparing base (e7645db) to head (8d7e0cc).

Additional details and impacted files
@@           Coverage Diff           @@
##               v2    #5889   +/-   ##
=======================================
  Coverage   61.05%   61.05%           
=======================================
  Files         141      141           
  Lines       14211    14211           
=======================================
  Hits         8676     8676           
  Misses       4809     4809           
  Partials      726      726           
Flag Coverage Δ
integrationtests 34.21% <ø> (ø)
unittests 52.38% <ø> (ø)

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.

@markphelps markphelps marked this pull request as ready for review May 25, 2026 19:22
@markphelps markphelps requested a review from a team as a code owner May 25, 2026 19:22
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 25, 2026
@markphelps markphelps requested a review from erka May 26, 2026 13:38
Copy link
Copy Markdown
Contributor

@erka erka left a comment

Choose a reason for hiding this comment

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

It's nice, but I'm not sure it solves the root cause of the issue. I suspect there is some async issue involved, like multiple pods running without sessionAffinity. @markphelps

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Verdict: approve

Clean, targeted improvement to live streaming invalidation logic: the new shared guard in streamingUtils.ts centralizes behavior and makes invalidation robust for all non-error events. Test coverage is present and specific, and no issues found across the diff. Approving as-is.

🤖 Automated review by the Flipt PR review agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flag list does not update upon new stream event

3 participants