Skip to content

feat: Add created_by to MasterAPIKey model#6845

Open
matthewelwell wants to merge 3 commits intomainfrom
feat/add-creator-field-to-master-api-keys
Open

feat: Add created_by to MasterAPIKey model#6845
matthewelwell wants to merge 3 commits intomainfrom
feat/add-creator-field-to-master-api-keys

Conversation

@matthewelwell
Copy link
Contributor

@matthewelwell matthewelwell commented Mar 4, 2026

Changes

Add 'created by' to Organisation API keys for better auditing.

How did you test this code?

Updated existing unit test and tested frontend changes locally.

@vercel
Copy link

vercel bot commented Mar 4, 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 Mar 4, 2026 9:26pm
flagsmith-frontend-staging Ready Ready Preview, Comment Mar 4, 2026 9:26pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Mar 4, 2026 9:26pm

Request Review

@github-actions github-actions bot added api Issue related to the REST API feature New feature or request and removed feature New feature or request labels Mar 4, 2026
@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.33%. Comparing base (877c321) to head (6f2f9ec).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6845   +/-   ##
=======================================
  Coverage   98.33%   98.33%           
=======================================
  Files        1336     1337    +1     
  Lines       49615    49628   +13     
=======================================
+ Hits        48790    48803   +13     
  Misses        825      825           

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

@matthewelwell matthewelwell marked this pull request as ready for review March 4, 2026 19:47
@matthewelwell matthewelwell requested a review from a team as a code owner March 4, 2026 19:47
@matthewelwell matthewelwell requested review from khvn26 and removed request for a team March 4, 2026 19:47
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Mar 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Docker builds report

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

@matthewelwell matthewelwell requested a review from a team as a code owner March 4, 2026 21:24
@matthewelwell matthewelwell requested review from kyle-ssg and removed request for a team March 4, 2026 21:24
@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard feature New feature or request and removed feature New feature or request labels Mar 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

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

passed  10 passed

Details

stats  10 tests across 7 suites
duration  24 seconds
commit  6f2f9ec
info  🔄 Run: #15125 (attempt 1)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

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

passed  10 passed

Details

stats  10 tests across 7 suites
duration  49.3 seconds
commit  6f2f9ec
info  🔄 Run: #15125 (attempt 1)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

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

passed  16 passed

Details

stats  16 tests across 13 suites
duration  1 minute, 5 seconds
commit  6f2f9ec
info  🔄 Run: #15125 (attempt 1)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  45.7 seconds
commit  6f2f9ec
info  🔄 Run: #15125 (attempt 1)

Copy link
Contributor

@Zaimwa9 Zaimwa9 left a comment

Choose a reason for hiding this comment

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

Code looks good and safe to me, haven't tested it yet, will do but approving to not block

Copy link
Contributor

@Zaimwa9 Zaimwa9 left a comment

Choose a reason for hiding this comment

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

Sorry, old store pattern required to get the users.

NIT: Columns are slightly misaligned

Image

<Row className='table-header'>
<Flex className='table-column px-3'>API Keys</Flex>
<Flex className='table-column'>Created</Flex>
{Utils.getFlagsmithHasFeature(
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually the organisation store is empty on this page. It needs to be dispatched the old way (hello ClassComponents).

You'll need something like this otherwise organisationStore.model?.users is empty and fallbacks on -

import AppActions from 'common/dispatcher/app-actions'

  componentDidMount() {
    this.fetch()
    AppActions.getOrganisation(this.props.organisationId)
    OrganisationStore.on('change', this.handleOrgStoreChange)
  }

  componentDidUpdate() {
    if (this.props.organisationId === this.state.organisationId) return

    this.fetch()
    AppActions.getOrganisation(this.props.organisationId)
    this.setState({ organisationId: this.props.organisationId })
  }

  componentWillUnmount() {
    OrganisationStore.off('change', this.handleOrgStoreChange)
  }

  handleOrgStoreChange = () => {
    this.forceUpdate()
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a bit confused by this comment for a couple of reasons:

  1. The comment is attached to a line related to the flagsmith SDK, and determining if the flag is enabled or not.
  2. If the organisation store was empty, wouldn't we not see any names populated in the list? Doesn't your screenshot prove that's not the case?

I'm sure there's something I'm missing here, but I'd like to understand a little more about what the issue is before I blindly fix it with your suggestion 😃

Copy link
Contributor

@Zaimwa9 Zaimwa9 Mar 9, 2026

Choose a reason for hiding this comment

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

Yes my bad, I don't know how I ended up on this line:

  1. Wrong comment line from my side
  2. I wasn't clear on this part but the screenshot comes from trying the fix locally to get to the root cause. The response payload was correct but defaulting to - because of the empty store

Copy link
Contributor

@Zaimwa9 Zaimwa9 left a comment

Choose a reason for hiding this comment

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

Approving following offline discussion unless we have a stable way to reproduce the fallback behavior I experienced

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 feature New feature or request front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants