Skip to content

refactor(Versioning): Publish a feature version with an AuthorData - #8310

Open
khvn26 wants to merge 2 commits into
mainfrom
refactor/publish-author
Open

refactor(Versioning): Publish a feature version with an AuthorData#8310
khvn26 wants to merge 2 commits into
mainfrom
refactor/publish-author

Conversation

@khvn26

@khvn26 khvn26 commented Aug 16, 2026

Copy link
Copy Markdown
Member
  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Stacked on #8308.

In this PR, we accommodate EnvironmentFeatureVersion.publish() to the AuthorData dataclass.

EnvironmentFeatureVersion.publish() took published_by and published_by_api_key, so every caller had to categorise a request user. That split was written four ways across the codebase, and one of them was wrong: EnvironmentFeatureVersionCreateSerializer only handled FFAdminUser, so a version created with publish_immediately by a master API key recorded no publisher at all. Fixed here, with a test.

publish() now takes an AuthorData, which callers construct directly, or via AuthorData.from_request(request) where a request is available.

We also drop a dead serializer.save(published_by=request.user) kwarg in EnvironmentFeatureVersionViewSet.publish — the serializer reads the author from the request context and ignored it.

No behaviour change beyond the attribution fix.

How did you test this code?

Added unit tests, and modified existing tests asserting EnvironmentFeatureVersion.publish().

@khvn26
khvn26 requested review from a team as code owners August 16, 2026 12:18
@khvn26
khvn26 requested review from emyller and removed request for a team August 16, 2026 12:18
@vercel

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

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

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Aug 17, 2026 11:31am
flagsmith-frontend-preview Ignored Ignored Preview Aug 17, 2026 11:31am
flagsmith-frontend-staging Ignored Ignored Preview Aug 17, 2026 11:31am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 14411d1e-6c13-4ba2-ac3c-f987b37e3df2

📥 Commits

Reviewing files that changed from the base of the PR and between a35dcd1 and e831228.

📒 Files selected for processing (22)
  • api/core/dataclasses.py
  • api/core/workflows_services.py
  • api/features/future/services.py
  • api/features/future/views.py
  • api/features/versioning/models.py
  • api/features/versioning/serializers.py
  • api/features/versioning/tasks.py
  • api/features/versioning/versioning_service.py
  • api/features/versioning/views.py
  • api/tests/unit/audit/test_unit_audit_signals.py
  • api/tests/unit/audit/test_unit_audit_views.py
  • api/tests/unit/core/test_unit_core_dataclasses.py
  • api/tests/unit/environments/test_unit_environments_views.py
  • api/tests/unit/features/feature_segments/test_unit_feature_segments_views.py
  • api/tests/unit/features/test_unit_features_models.py
  • api/tests/unit/features/test_unit_features_views.py
  • api/tests/unit/features/versioning/test_unit_versioning_models.py
  • api/tests/unit/features/versioning/test_unit_versioning_tasks.py
  • api/tests/unit/features/versioning/test_unit_versioning_versioning_service.py
  • api/tests/unit/features/versioning/test_unit_versioning_views.py
  • api/tests/unit/util/mappers/test_unit_mappers_engine.py
  • docs/docs/deployment-self-hosting/observability/_events-catalogue.md

Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change introduces AuthorData validation and uses AuthorData as the single publication-attribution value. Versioning entry points, workflow services, tasks, and future-feature services now pass user or API-key data through this object. Tests update publication calls and add API-key attribution coverage. Observability documentation updates source-code line references.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to e8312

This change standardizes feature-version publisher attribution and fixes missing attribution for master API key publishing; no actionable merge-blocking risk remains beyond normal checks and review.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added api Issue related to the REST API docs Documentation updates labels Aug 16, 2026
@github-actions github-actions Bot added refactor and removed docs Documentation updates labels Aug 16, 2026
@github-actions

github-actions Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-8310 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-8310 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-8310 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-8310 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-8310 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-8310 Finished ✅ Results

@github-actions

github-actions Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19460 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  37.2 seconds
commit  e831228
info  🔄 Run: #19460 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-16 — run #19460 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  32 seconds
commit  e831228
info  🔄 Run: #19460 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19460 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  46.3 seconds
commit  e831228
info  🔄 Run: #19460 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19460 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  33.5 seconds
commit  e831228
info  🔄 Run: #19460 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19450 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 1 second
commit  187c818
info  🔄 Run: #19450 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #19450 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  33.1 seconds
commit  187c818
info  🔄 Run: #19450 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19450 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  44.7 seconds
commit  187c818
info  🔄 Run: #19450 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19450 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  33.7 seconds
commit  187c818
info  🔄 Run: #19450 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #19447 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  55.2 seconds
commit  3e25f55
info  🔄 Run: #19447 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19447 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  37.1 seconds
commit  3e25f55
info  🔄 Run: #19447 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #19446 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  56.4 seconds
commit  3e25f55
info  🔄 Run: #19446 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19446 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  35.1 seconds
commit  3e25f55
info  🔄 Run: #19446 (attempt 1)

@github-actions

github-actions Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.64%. Comparing base (a35dcd1) to head (e831228).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8310      +/-   ##
==========================================
- Coverage   98.78%   98.64%   -0.14%     
==========================================
  Files        1605     1606       +1     
  Lines       64417    64434      +17     
==========================================
- Hits        63633    63560      -73     
- Misses        784      874      +90     

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

@khvn26
khvn26 force-pushed the refactor/publish-author branch from 6b7b050 to 12ffc67 Compare August 16, 2026 12:28
@github-actions github-actions Bot added the docs Documentation updates label Aug 16, 2026
@github-actions github-actions Bot added refactor docs Documentation updates and removed docs Documentation updates refactor labels Aug 16, 2026
@khvn26
khvn26 force-pushed the refactor/publish-author branch from 49778de to 574087f Compare August 16, 2026 13:32
@khvn26
khvn26 force-pushed the refactor/publish-author branch from 574087f to 10650cb Compare August 16, 2026 14:02
@github-actions github-actions Bot added docs Documentation updates refactor and removed docs Documentation updates refactor labels Aug 16, 2026
@khvn26
khvn26 force-pushed the refactor/publish-author branch from 10650cb to 3e25f55 Compare August 16, 2026 14:37
@github-actions github-actions Bot added docs Documentation updates refactor and removed docs Documentation updates refactor labels Aug 16, 2026
@khvn26
khvn26 force-pushed the refactor/publish-author branch from 3e25f55 to 187c818 Compare August 16, 2026 15:38
@github-actions github-actions Bot added docs Documentation updates refactor and removed docs Documentation updates refactor labels Aug 16, 2026
Base automatically changed from chore/update-flag-cleanup to main August 17, 2026 11:31
@khvn26
khvn26 force-pushed the refactor/publish-author branch from 187c818 to e831228 Compare August 17, 2026 11:31
@github-actions github-actions Bot added docs Documentation updates refactor and removed docs Documentation updates refactor labels Aug 17, 2026
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 refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant