1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
Commit Graph

671 Commits

Author SHA1 Message Date
Fredrik Strand Oseberg
bc96216daa
Refactor/move features to feature oriented architecture (#4994)
This PR gathers feature related files in the same folder.
2023-10-11 09:38:57 +02:00
Fredrik Strand Oseberg
a2ca7b0d35
Refactor/last seen at read feature overview (#4986)
Refactor feature overview to use the last seen store
2023-10-10 14:40:36 +02:00
Fredrik Strand Oseberg
c97bcc65e6
Refactor/project overview last seen at test (#4979)
Increase test coverage of last seen in project overview
2023-10-10 10:43:45 +02:00
Mateusz Kwasniewski
b4c8f92a26
feat: do not allow to manage dependencies directly with cr enabled (#4971) 2023-10-10 09:25:03 +02:00
Fredrik Strand Oseberg
d896dbd0c7
Fix/last seen at by environment (#4939)
Initial architecture for last seen at by environment.
2023-10-09 10:54:00 +02:00
Mateusz Kwasniewski
8b0cf8b11d
feat: allow to delete dependencies when no orphans (#4952) 2023-10-06 13:39:16 +02:00
Jonas Strømsodd
80c4a8277c
feat: allow defining initial admin user as env variable (#4927)
Closes #4560
2023-10-06 09:07:06 +02:00
David Leek
40ebb7ef95
fix: only delete SSO-synced group membership where membership was added by SSO sync (#4929)
Fixes an issue where SSO group sync would delete a syncable group that a
user was manually added to

## Discussion points

Is this the longterm fix for this? Or would we want another column in
the mapping table for future-proofing this?
2023-10-05 13:22:46 +02:00
Mateusz Kwasniewski
257414424d
feat: copy feature with parent (#4918) 2023-10-04 12:20:27 +02:00
Mateusz Kwasniewski
5141d9db67
feat: change project with feature dependencies (#4915) 2023-10-04 12:16:52 +02:00
Mateusz Kwasniewski
88305a6388
feat: prevent delete and archive on parent feature (#4913) 2023-10-04 09:27:53 +02:00
Nuno Góis
521cc24a22
feat: add more events in integrations (#4815)
https://linear.app/unleash/issue/2-1253/add-support-for-more-events-in-the-slack-app-integration

Adds support for a lot more events in our integrations. Here is how the
full list looks like:

- ADDON_CONFIG_CREATED
- ADDON_CONFIG_DELETED
- ADDON_CONFIG_UPDATED
- API_TOKEN_CREATED
- API_TOKEN_DELETED
- CHANGE_ADDED
- CHANGE_DISCARDED
- CHANGE_EDITED
- CHANGE_REQUEST_APPLIED
- CHANGE_REQUEST_APPROVAL_ADDED
- CHANGE_REQUEST_APPROVED
- CHANGE_REQUEST_CANCELLED
- CHANGE_REQUEST_CREATED
- CHANGE_REQUEST_DISCARDED
- CHANGE_REQUEST_REJECTED
- CHANGE_REQUEST_SENT_TO_REVIEW
- CONTEXT_FIELD_CREATED
- CONTEXT_FIELD_DELETED
- CONTEXT_FIELD_UPDATED
- FEATURE_ARCHIVED
- FEATURE_CREATED
- FEATURE_DELETED
- FEATURE_ENVIRONMENT_DISABLED
- FEATURE_ENVIRONMENT_ENABLED
- FEATURE_ENVIRONMENT_VARIANTS_UPDATED
- FEATURE_METADATA_UPDATED
- FEATURE_POTENTIALLY_STALE_ON
- FEATURE_PROJECT_CHANGE
- FEATURE_REVIVED
- FEATURE_STALE_OFF
- FEATURE_STALE_ON
- FEATURE_STRATEGY_ADD
- FEATURE_STRATEGY_REMOVE
- FEATURE_STRATEGY_UPDATE
- FEATURE_TAGGED
- FEATURE_UNTAGGED
- GROUP_CREATED
- GROUP_DELETED
- GROUP_UPDATED
- PROJECT_CREATED
- PROJECT_DELETED
- SEGMENT_CREATED
- SEGMENT_DELETED
- SEGMENT_UPDATED
- SERVICE_ACCOUNT_CREATED
- SERVICE_ACCOUNT_DELETED
- SERVICE_ACCOUNT_UPDATED
- USER_CREATED
- USER_DELETED
- USER_UPDATED

I added the events that I thought were relevant based on my own
discretion. Know of any event we should add? Let me know and I'll add it
🙂

For now I only added these events to the new Slack App integration, but
we can add them to the other integrations as well since they are now
supported.

The event formatter was refactored and changed quite a bit in order to
make it easier to maintain and add new events in the future. As a
result, events are now posted with different text. Do we consider this a
breaking change? If so, I can keep the old event formatter around,
create a new one and only use it for the new Slack App integration.

I noticed we don't have good 404 behaviors in the UI for things that are
deleted in the meantime, that's why I avoided some links to specific
resources (like feature strategies, integration configurations, etc),
but we could add them later if we improve this.

This PR also tries to add some consistency to the the way we log events.
2023-09-29 16:11:59 +01:00
Christopher Kolstad
6673d131fe
feat: biome lint (#4853)
This commit changes our linter/formatter to biome (https://biomejs.dev/)
Causing our prehook to run almost instantly, and our "yarn lint" task to
run in sub 100ms.

Some trade-offs:
* Biome isn't quite as well established as ESLint
* Are we ready to install a different vscode plugin (the biome plugin)
instead of the prettier plugin


The configuration set for biome also has a set of recommended rules,
this is turned on by default, in order to get to something that was
mergeable I have turned off a couple the rules we seemed to violate the
most, that we also explicitly told eslint to ignore.
2023-09-29 14:18:21 +02:00
Mateusz Kwasniewski
fbc571dffc
feat: events for dependencies (#4864) 2023-09-29 14:02:15 +02:00
Gastón Fournier
93da4a1217
Fix open handles in tests (#4858)
## About the changes
This fixes a bunch of openHandles from our tests

I've used this script to find out the ones that leave them:
`find src -name "*.test.ts" -printf "%f\n" | xargs -i sh -c "echo =====
{} && yarn test {}"`

If there's an issue, the script will halt and the last filename will be
the one that has to be fixed.

Each commit fixes one problem so it's easy to review
2023-09-28 12:13:51 +02:00
Nuno Góis
87d9497be9
refactor: prefer eventService.storeEvent methods (#4830)
https://linear.app/unleash/issue/2-1403/consider-refactoring-the-way-tags-are-fetched-for-the-events

This adds 2 methods to `EventService`:
 - `storeEvent`;
 - `storeEvents`;

This allows us to run event-specific logic inside these methods. In the
case of this PR, this means fetching the feature tags in case the event
contains a `featureName` and there are no tags specified in the event.

This prevents us from having to remember to fetch the tags in order to
store feature-related events except for very specific cases, like the
deletion of a feature - You can't fetch tags for a feature that no
longer exists, so in that case we need to pre-fetch the tags before
deleting the feature.

This also allows us to do any event-specific post-processing to the
event before reaching the DB layer.
In general I think it's also nicer that we reference the event service
instead of the event store directly.

There's a lot of changes and a lot of files touched, but most of it is
boilerplate to inject the `eventService` where needed instead of using
the `eventStore` directly.

Hopefully this will be a better approach than
https://github.com/Unleash/unleash/pull/4729

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2023-09-27 14:23:05 +01:00
Mateusz Kwasniewski
87a81120d2
feat: feature admin API returns dependencies and children (#4848) 2023-09-27 15:07:20 +02:00
Mateusz Kwasniewski
fd8775f13d
feat: read model for dependent features (#4846) 2023-09-27 14:33:51 +02:00
Jaanus Sellin
960bc110ce
feat: enterprise project settings (#4844) 2023-09-27 13:10:10 +03:00
Mateusz Kwasniewski
76a2ec53f1
feat: Enforce one dependency (#4835) 2023-09-26 14:31:13 +02:00
Fredrik Strand Oseberg
b919c445b4
feat: add kill switch for client metrics (#4829)
This PR adds a killswitch for client metrics that we can use to disable
metrics in our cloud offering.
2023-09-26 09:37:42 +02:00
Jaanus Sellin
2bf995e731
feat: context/segment usage private (#4826) 2023-09-25 15:50:44 +03:00
Jaanus Sellin
f7d87a2339
feat: add project collaboration mode to prometheus (#4819) 2023-09-25 12:07:59 +03:00
Nuno Góis
ea9901c968
chore: GA (remove flag) for Slack App integration (#4765)
https://linear.app/unleash/issue/2-1405/remove-slackappaddon-feature-flag-and-make-this-ga

GA's the new Slack App integration by removing the feature flag 🚀
2023-09-21 13:55:58 +01:00
Jaanus Sellin
5e6ed0baac
feat: private projects handle in playground (#4791) 2023-09-21 11:22:29 +03:00
Mateusz Kwasniewski
85c7f84f8d
feat: Client api dependent features (#4778) 2023-09-20 11:53:43 +02:00
Jaanus Sellin
e4f8e1692a
feat: make application usage private through project (#4786) 2023-09-20 10:35:30 +03:00
Gastón Fournier
bed0a2962f
chore: Improve access service iter 2 (#4779)
## About the changes
In https://github.com/Unleash/unleash/pull/4689 I forgot to add backward
compatibility for a public method that was being used in Enterprise.
2023-09-19 16:15:27 +02:00
Ivar Conradi Østhus
013efac46b
feat: open-source segments 🚀 (#4690)
We love all open-source Unleash users. in 2022 we built the [segment
capability](https://docs.getunleash.io/reference/segments) (v4.13) as an
enterprise feature, simplify life for our customers.

Now it is time to contribute it to the world 🌏

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2023-09-19 11:24:26 +00:00
Mateusz Kwasniewski
be7f0d8b4e
feat: Persist dependent features (#4772) 2023-09-19 13:01:38 +02:00
Gastón Fournier
12d9297f68
Revert "chore: improve access service" (#4773)
Reverts Unleash/unleash#4689 temporarily to figure out what's the
problem with the failing test
2023-09-19 11:03:16 +01:00
Gastón Fournier
2186e2b568
chore: improve access service (#4689)
## About the changes
This enables us to use names instead of permission ids across all our
APIs at the computational cost of searching for the ids in the DB but
improving the API user experience

## Open topics
We're using methods that are test-only and circumvent our business
logic. This makes our test to rely on assumptions that are not always
true because these assumptions are not validated frequently.

i.e. We are expecting that after removing a permission it's no longer
there, but to test this, the permission has to be there before:

78273e4ff3/src/test/e2e/services/access-service.e2e.test.ts (L367-L375)

But it seems that's not the case.

We'll look into improving this later.
2023-09-19 11:36:29 +02:00
Mateusz Kwasniewski
2843388673
refactor: feature oriented architecture for feature dependencies (#4771) 2023-09-19 11:23:21 +02:00
Mateusz Kwasniewski
59f2ae435e
feat: stub for create dependent features (#4769) 2023-09-19 10:04:05 +02:00
Tymoteusz Czech
2c826bdbba
feat: Add active users statistics to metrics (#4674)
## About the changes
- `getActiveUsers` is using multiple stores, so it is refactored into
read-model
- Refactored Instance stats service into `features` to co-locate related
code

Closes https://linear.app/unleash/issue/UNL-230/active-users-prometheus

### Important files
`src/lib/features/instance-stats/getActiveUsers.ts`


## Discussion points
`getActiveUsers` is coded less _class-based_ then previous similar
read-models. In one file instead of 3 (read-model interface, fake read
model, sql read model). I find types and functions way more readable,
but I'm ready to refactor it to interfaces and classes if consistency is
more important.
2023-09-18 15:05:17 +02:00
Jaanus Sellin
39d2d065cd
feat: private project filtering and store implementation (#4758) 2023-09-18 11:06:26 +03:00
Jaanus Sellin
15baea1d25
feat: walking skeleton of private projects (#4753) 2023-09-15 15:52:54 +03:00
Simon Hornby
aa5afad502
feat: patch user access query to return projects provided by groups (#4750) 2023-09-15 12:10:16 +02:00
andreas-unleash
f9bca20c78
Feat/project private mode (#4743)
Adds `private` option to project mode
Update schemas and models to accept and persist

Closes #
[1-1366](https://linear.app/unleash/issue/1-1366/introduce-private-in-collaboration-mode)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-09-15 11:01:25 +03:00
Mateusz Kwasniewski
c2b068e28f
fix: include strategy variants in the event log (#4716) 2023-09-14 13:23:11 +02:00
Simon Hornby
10afbc8a9e
feat: add service method to retrieve group and project access for all users (#4708) 2023-09-14 11:43:39 +02:00
Thomas Heartman
bf451f6549
test: enforce behavior via test (#4701)
This test enforces that descriptions and examples are cleared if they
are not present in the feature naming data.

This behavior is already present, but it hasn't been encoded in any
tests before.
2023-09-14 09:50:20 +02:00
Thomas Heartman
392beee114
feat: add implicit surrounding ^ and $ to patterns (#4664)
This PR updates the back-end handling of feature naming patterns to add
implicit leading `^`s and trailing `$`s to the regexes when comparing
them.

It also adds tests for the new behavior, both for new flag names and for
examples.

## Discussion points

Regarding stripping incoming ^ and $: We don't actually need to strip
incoming `^`s and `$`s: it appears that `^^^^^x$$$$$` is just as valid
as `^x$`. As such, we can leave that in. However, if we think it's
better to strip, we can do that too.

Second, I'm considering moving the flag naming validation into a
dedicated module to encapsulate everything a little better. Not sure if
this is the time or where it would live, but open to hearing
suggestions.
2023-09-13 10:50:37 +02:00
Gastón Fournier
c39d815516
fix: API improvements aligning the types to our schemas (#4650)
Some of our types in OSS have drifted apart from our OpenAPI schemas.
This will help them be aligned again
2023-09-12 15:40:57 +02:00
Thomas Heartman
9114969869
feat: make import/export work with project patterns (#4652)
This PR adds feature name pattern validation to the import validation
step. When errors occur, they are rendered with all the offending
features, the pattern to match, plus the pattern's description and
example if available.


![image](https://github.com/Unleash/unleash/assets/17786332/69956090-afc6-41c8-8f6e-fb45dfaf0a9d)

To achieve this I've added an extra method to the feature toggle service
that checks feature names without throwing errors (because catching `n`
async errors in a loop became tricky and hard to grasp). This method is
also reused in the existing feature name validation method and handles
the feature enabled chcek.

In doing so, I've also added tests to check that the pattern is applied.
2023-09-12 10:19:40 +02:00
Jaanus Sellin
77fbac01e4
feat: remove newApplicationsList feature flag (#4653) 2023-09-11 12:28:43 +02:00
Fredrik Strand Oseberg
26ade79d66
Fix/dora polish (#4645)
This PR includes:
* Tests for retrieving lead time per feature toggle and project average
* Feedback component
2023-09-08 14:18:58 +02:00
David Leek
10a62642d7
chore: return 404 when adding environment to project that doesnt exist (#4635)
## About the changes

Returns a 404 response instead of 500 when trying to set an environment
on a project that doesn't exist
2023-09-08 12:36:13 +02:00
Jaanus Sellin
bc0c6fcb62
fix: fix failing group service test (#4642) 2023-09-08 11:32:21 +03:00
Nuno Góis
c3216ac941
fix: group roles assumption, refactor group types (#4576)
Does what it says on the tin, should help with cleaning up
https://github.com/Unleash/unleash/pull/4512 and respective schema
changes.

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2023-09-05 20:30:20 +01:00