Skip to content

fix(Platform Hub): Use STALE tag for stale flags count#6716

Draft
talissoncosta wants to merge 1 commit intomainfrom
fix/stale-flags-use-stale-tag
Draft

fix(Platform Hub): Use STALE tag for stale flags count#6716
talissoncosta wants to merge 1 commit intomainfrom
fix/stale-flags-use-stale-tag

Conversation

@talissoncosta
Copy link
Contributor

Summary

  • Replace timestamp-based stale flags query with STALE tag-based counting in get_stale_flags_per_project and _get_stale_flag_counts_by_org
  • Remove the frontend inversion workaround added in fix(Platform Hub): Invert stale flags count in admin dashboard #6711, since the backend now returns the correct stale count
  • Eliminates N+1 per-project queries (both functions now use a single batched query)

Supersedes #6715.

Context

The backend was using FeatureState.updated_at timestamps to determine staleness, which was inconsistent with the Feature Lifecycle page that uses the STALE tag assigned by workflows_logic.stale_flags. The timestamp query was also affected by identity/segment override timestamps, producing incorrect counts.

Test plan

  • Run tests/unit/platform_hub/test_services.py — updated tests use STALE tags instead of timestamp manipulation
  • Verify the Platform Hub dashboard stale flags numbers match the Feature Lifecycle page
  • Verify sorting and pagination still work correctly

🤖 Generated with Claude Code

…oard

The backend was using timestamp-based queries on FeatureState.updated_at
to count stale flags, which was inconsistent with the Feature Lifecycle
page that uses the STALE tag. Replace with tag-based queries to match
the workflows_logic.stale_flags auto-tagging logic, and remove the
frontend inversion workaround that was compensating for the wrong data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Feb 12, 2026 11:22am
flagsmith-frontend-staging Ready Ready Preview, Comment Feb 12, 2026 11:22am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Feb 12, 2026 11:22am

Request Review

@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.23%. Comparing base (220ee58) to head (b6fdce1).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6716      +/-   ##
==========================================
- Coverage   98.23%   98.23%   -0.01%     
==========================================
  Files        1311     1311              
  Lines       48480    48474       -6     
==========================================
- Hits        47623    47617       -6     
  Misses        857      857              

☔ 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.

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

Labels

api Issue related to the REST API fix front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant