1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
Commit Graph

1567 Commits

Author SHA1 Message Date
Mateusz Kwasniewski
6d17c3b320
feat: cursor based pagination in search (#5174) 2023-10-27 14:16:29 +02:00
Simon Hornby
c9f9fc7521
fix: flaky test (#5172) 2023-10-27 12:52:49 +02:00
Mateusz Kwasniewski
1c8fab63e2
feat: filter by environment status (#5165) 2023-10-27 08:54:03 +02:00
Mateusz Kwasniewski
46d7cb236d
feat: filter by tags (#5163) 2023-10-26 17:20:57 +02:00
andreas-unleash
66cc526855
feat: add scheduledConfigurationChanges flag (#5161)
add scheduledConfigurationChanges flag

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-10-26 14:00:53 +00:00
Thomas Heartman
acb23e8b87
chore: add CHANGE_REQUEST_SCHEDULED to event types. (#5162)
This is a new event type that will be used to schedule a change
request. It's required in enterprise for the build to work as expected.
2023-10-26 13:41:18 +00:00
Mateusz Kwasniewski
0c8d0704f3
feat: filter features by type (#5160) 2023-10-26 15:29:30 +02:00
Fredrik Strand Oseberg
87fd924be3
refactor: optimize queries (#5158)
This commit will change the join to only get results for either archived
or non-archived features based on the query
2023-10-26 13:38:22 +02:00
Mateusz Kwasniewski
065e588e64
Search by tag (#5156)
add tag search for feature search API
2023-10-26 12:50:02 +02:00
Mateusz Kwasniewski
2c7b7c90e0
refactor: type query params (#5153) 2023-10-26 10:05:47 +02:00
Christopher Kolstad
1bba76413f
feat: make all internal rate limits configurable (#5095)
### What
This PR makes the rate limit for user creation and simple login (our
password based login) configurable in the same way you can do
metricsRateLimiting.

### Worth noting
In addition this PR adds a `rate_limit{endpoint, method}` prometheus
gauge, which gets the data from the UnleashConfig.
2023-10-26 09:20:29 +02:00
David Leek
6fe4740e67
feat: remove feature flag for datadog json template (#5105)
## About the changes

Removes the feature flag for the datadog json template
2023-10-26 09:09:26 +02:00
Mateusz Kwasniewski
de540e09f3
feat: feature search basic functionality (#5150) 2023-10-25 16:12:21 +02:00
Fredrik Strand Oseberg
3ee250ee7d
feat: add feature search service (#5149) 2023-10-25 15:18:52 +02:00
Thomas Heartman
a5d304ca51
1-1531: create db table for cr schedules (#5148)
This PR adds a db table for CR schedules. The table has two columns:
1. `change_request` :: This acts as both a foreign key and as the
primary key for this table.
2. `scheduled_at` :: When the change is scheduled to be applied.

We could use a separate ID column for these rows and put a `unique`
constraint on the `change_request` FK, but I don't think that adds any
more value. However, I'm happy to hear other thoughts around it.
2023-10-25 14:36:03 +02:00
Jaanus Sellin
7039160af0
fix: project mode can not be set to null anymore (#5145) 2023-10-25 14:09:34 +03:00
Mateusz Kwasniewski
705ca1514e
feat: feature search stub (#5143) 2023-10-25 10:50:59 +02:00
Fredrik Strand Oseberg
898c1b4bc7
fix: only get rows for toggles in project (#5141) 2023-10-24 17:26:18 +02:00
Mateusz Kwasniewski
19098808ef
test: speed up the tests (#5140) 2023-10-24 14:31:38 +02:00
Jaanus Sellin
bb136783a3
bug: fix broken links from lychee (#5127)
Fixed https://github.com/Unleash/unleash/issues/5115
2023-10-24 13:22:49 +03:00
Christopher Kolstad
c60bca777f
feat: replace gravatar-url with inline function (#5128)
As #4475 says, MD5 is not available in secure places anymore. This PR
swaps out gravatar-url with an inline function using crypto:sha256 which
is FIPS-140-2 compliant. Since we only used this method for generating
avatar URLs the extra customization wasn't needed and we could hard code
the URL parameters.
 
fixes: Linear
https://linear.app/unleash/issue/SR-112/gh-support-swap-out-gravatar-url-lib
closes: #4475
2023-10-24 10:07:26 +02:00
Mateusz Kwasniewski
ab390dbaab
test: silent migration test (#5131) 2023-10-23 17:14:41 +02:00
Mateusz Kwasniewski
8bc04c59f3
refactor: move metrics service scheduling (#5129) 2023-10-23 16:28:19 +02:00
Mateusz Kwasniewski
8d8a975c6c
Client instance service (#5126) 2023-10-23 15:22:30 +02:00
Mateusz Kwasniewski
1d1aa27ca3
refactor: proxy service scheduler (#5125) 2023-10-23 15:11:38 +02:00
Christopher Kolstad
314a08b4e6
feat: Make multiple roles per group/user GA by removing the flag (#5109)
To prepare for 5.6 GA, 
I've done a find through both Frontend and Backend here to remove the
usages of the flag. Seems like the flag was only in use in the frontend.
@nunogois can you confirm?
2023-10-23 12:32:15 +00:00
Mateusz Kwasniewski
828e463e38
refactor: move version service scheduling to scheduler (#5120) 2023-10-23 09:34:03 +00:00
Fredrik Strand Oseberg
08a1d053dc
feat: add job that cleans last seen every 24 hours (#5114)
This PR adds a cleanup job that removes unknown feature flags from
last_seen_at_metrics table every 24 hours since we no longer have a
foreign key on the name column in the features table.
2023-10-23 11:26:48 +02:00
Jaanus Sellin
ddcd7f47d8
chore: remove invite link flag (#5119) 2023-10-23 12:11:11 +03:00
Gastón Fournier
2aebc8c58e
fix: don't clean up settings when optional data is not present (#5118)
## About the changes
This fixes a bug updating a project, when optional data
(defaultStickiness and featureLimit are not part of the payload).

The problem happens due to:
1. ProjectController does not use the type: UpdateProjectSchema for the
request body (will be addressed in another PR in unleash-enterprise)
2. Project Store interface does not match UpdateProjectSchema (but it
relies on accepting `additional properties: true`, which is what we
agreed on for input)
3. Feature limit is not defined in UpdateProjectSchema (also addressed
in the other PR)
2023-10-23 10:15:25 +02:00
Fredrik Strand Oseberg
71431c7a1d
refactor/last seen at archived (#5102)
Refactor global archive view and project archive view to include last
seen at by environment
2023-10-20 13:17:41 +02:00
Mateusz Kwasniewski
ba758e13c1
test: added tests for has strategies and enabled strategies (#5112) 2023-10-20 12:33:43 +02:00
Mateusz Kwasniewski
433f3e2760
feat: promise timeout on lock (#5108) 2023-10-20 12:10:18 +02:00
Tymoteusz Czech
6fab6633c9
feat: add hasStrategies and hasEnabledStrategies on feature environments (#5012) 2023-10-20 10:50:57 +02:00
Mateusz Kwasniewski
b890df6e12
feat: show warning about dependencies removed on archive (#5104) 2023-10-20 08:58:03 +02:00
Gastón Fournier
b5d9bbaa76
chore: remove ts-ignore and adapt tests (#5103)
## About the changes
Just using proper types and adapting a few tests
2023-10-19 17:17:28 +02:00
Nuno Góis
ba53d392b2
refactor: rename message banners to banners - events (#5100)
https://linear.app/unleash/issue/2-1531/rename-message-banners-to-banners

Follow up to https://github.com/Unleash/unleash/pull/5098
This one adapts the existing events.
2023-10-19 13:53:40 +01:00
andreas-unleash
9cef75d71d
fix/set disableEnvsOnRevive to true (#5101)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-10-19 12:37:17 +00:00
Nuno Góis
957546e305
refactor: rename message banners to banners (#5098)
https://linear.app/unleash/issue/2-1531/rename-message-banners-to-banners

This renames "message banners" to "banners".

I also added support for external banners coming from a `banner` flag
instead of only `messageBanner` flag, so we can eventually migrate to
the new one in the future if we want.
2023-10-19 13:18:25 +01:00
Gastón Fournier
3d9f31f839
feat: ensure at least one owner on remove user/group access (#5085)
## About the changes
This makes sure that projects have at least one owner, either a group or
a user. This is to prevent accidentally losing access to a project.

We check this when removing a user/group or when changing the role of a
user/group

**Note**: We can still leave a group empty as the only owner of the
project, but that's okay because we can still add more users to the
group
2023-10-19 14:14:59 +02:00
andreas-unleash
6760fc0723
fix: add project filter to feature-toggle-list-builder (#5099)
Adds `forProject` filter to FeatureToggleQueryBuilder
Filters playground results for an array of projects

Closes #
[1-1525](https://linear.app/unleash/issue/1-1525/getting-results-for-all-projects-when-defining-a-single-project-in-the)

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-10-19 15:05:56 +03:00
Mateusz Kwasniewski
de237d844d
feat: detect grandchild dependency (#5094) 2023-10-19 13:14:32 +02:00
Mateusz Kwasniewski
56892c54d9
feat: check if child and parent are in the same project (#5093) 2023-10-19 11:11:05 +02:00
Fredrik Strand Oseberg
7195a63e56
Refactor/last seen at ft list (#5089)
Refactor last seen at for the feature toggle list
2023-10-19 10:58:10 +02:00
Simon Hornby
1ca3e8d893
fix: force deletion of archived toggles when deleting a project (#5080) 2023-10-19 10:45:09 +02:00
Mateusz Kwasniewski
f8855f8234
feat: prevent self dependencies (#5090) 2023-10-19 08:57:23 +02:00
Fredrik Strand Oseberg
cd864ed09e
fix: add sort to deep diff (#5084)
Sort array items before running compare. Feature flag certain properties
of strategy that were previously not present in the /api/admin/features
endpoint.
2023-10-18 16:34:42 +02:00
Mateusz Kwasniewski
1f8d12bcdc
feat: default session id in frontend api (#5083) 2023-10-18 16:19:03 +02:00
Christopher Kolstad
f8fba501ae
fix: update failing snapshot 2023-10-18 14:30:55 +02:00
Thomas Heartman
39aa300c05
fix(tests): correctly set baseUriPath in setupAppWithBaseUrl (#5068)
This appears to be a bug. I can confirm that the base path did not take
effect with the previous incarnation, but this should fix that.
2023-10-18 13:17:56 +02:00
Christopher Kolstad
b06613d1b0
feat: Adds rate limiting to metric POST endpoints (#5075)
### What
The heaviest requests we serve are the register and metrics POSTs from
our SDKs/clients.
This PR adds ratelimiting to /api/client/register, /api/client/metrics,
/api/frontend/register and /api/frontend/metrics with a default set to
6000 requests per minute (or 100 rps) for each of the endpoints.

It will be overrideable by the environment variables documented.

### Points of discussion
@kwasniew already suggested using featuretoggles with variants to
control the rate per clientId. I struggled to see if we could
dynamically update the middleware after initialisation, so this attempt
will need a restart of the pod to update the request limit.
2023-10-18 13:00:44 +02:00
Fredrik Strand Oseberg
3ac8ab898a
fix: log diff (#5072)
Add a deep diff function to investigate diff in logs
2023-10-18 09:25:25 +02:00
Mateusz Kwasniewski
75b131162e
feat: dependent features use new transaction mechanism (#5073) 2023-10-18 08:59:26 +02:00
Gastón Fournier
db04a1eaa8
chore: introduce type to prevent potential issues (#5066)
## About the changes
This small improvement aims to help developers when instantiating
services. They need to be constructed without injecting services or
stores created elsewhere so they can be bound to the same transactional
scope.

This suggests that you need to create the services and stores on your
own
2023-10-17 12:30:44 +02:00
andreas-unleash
cf42a829f4
feat: add option to return disabled strategies (#5059)
Adds the option to include disabled strategies (behind the
playgroundImprovements flag

Closes #
[1-1505](https://linear.app/unleash/issue/1-1505/return-disabled-strategies-in-the-playground-features-request)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-10-17 12:35:07 +03:00
Gastón Fournier
08116d008a
chore: GA transactional decorator (#5020)
## About the changes
After testing with the flag enabled and fixing a bug, this is ready to
be GA
2023-10-17 10:47:18 +02:00
Nuno Góis
fd580c9539
fix: extract username from user should not return undefined (#5061)
This fixes a return type error by changing the logic of
`extractUsernameFromUser` to never return undefined.

In the previous code, `user` could be truthy, but that doesn't mean
`email` or `username` were defined. This assumes we always fallback to
"unknown" in those scenarios.
2023-10-17 09:18:44 +01:00
Jaanus Sellin
5619db33ed
feat: import dependencies (#5044) 2023-10-17 08:22:54 +03:00
Mateusz Kwasniewski
e9e110f702
feat: show dependencies only when using pro/enterprise or at least on… (#5052) 2023-10-16 20:56:06 +02:00
Fredrik Strand Oseberg
0064c9e1be
refactor: add tests for /api/client/features (#5057)
add more robust tests for /api/client/features
2023-10-16 16:18:41 +02:00
Gastón Fournier
675ec2e836
chore: add enterprise event (#5056)
This just adds a new event type
2023-10-16 15:37:11 +02:00
Nuno Góis
364e315a3c
feat: add new message banner events (#5055)
https://linear.app/unleash/issue/2-1516/add-new-message-banner-events

Adds new message banner events to help us keep track of changes related
to the new feature.
2023-10-16 14:30:40 +01:00
Fredrik Strand Oseberg
9e493f56a0
refactor: create builder class for converting rows to avoid duplication (#5050)
Create a builder for creating the data structures for feature toggle
list and playground api
2023-10-16 14:19:46 +02:00
Fredrik Strand Oseberg
1a46ab7b12
refactor: add test coverage (#5046)
Adds test coverage for different feature flag paths temporarily
2023-10-16 13:17:26 +02:00
andreas-unleash
8561ba8df7
feat: add playground imrpovements flag (#5045)
Adds the playgroundImprovements flag

Close #
[1-1508](https://linear.app/unleash/issue/1-1508/add-playgroundimprovements-feature-flag)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-10-16 14:08:21 +03:00
Fredrik Strand Oseberg
b58d900c2d
fix: feature flag playground features in new store (#5013)
Have playground use the method in the feature-toggle-service instead of
asking the client-feature-toggle-store
2023-10-16 12:29:31 +02:00
Nuno Góis
6c21ed5f74
feat: make maintenance-related 503s more intuitive (#5018)
This makes maintenance-related 503s more intuitive on our UI by
mentioning that maintenance banner is currently enabled.


![image](https://github.com/Unleash/unleash/assets/14320932/43142c58-6b87-4b2d-9239-50f2bb1409e6)
2023-10-16 09:27:29 +01:00
Mateusz Kwasniewski
c41f23ae54
feat: remove dependency on archive (#5040) 2023-10-16 08:59:34 +02:00
Jaanus Sellin
2263a1f062
feat: dependencies import validation (#5023) 2023-10-13 14:17:54 +03:00
Fredrik Strand Oseberg
b6d945befc
refactor: feature toggle list query (#5022)
Cean up huge query method in feature-toggle-store
2023-10-13 12:29:14 +02:00
Mateusz Kwasniewski
3eeafba5f9
feat: validate archive dependent features (#5019) 2023-10-13 12:09:46 +02:00
andreas-unleash
a9a75d5e82
fix: disable all environments when reviving a feature (#4999)
Disable all environments when reviving a feature

Closes #
[SR-93](https://linear.app/unleash/issue/SR-93/disable-all-environments-when-reviving-a-feature)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-10-13 10:38:18 +03:00
Jaanus Sellin
a7dd0d6c1a
fix: import segment test and fix (#5017) 2023-10-13 09:40:34 +03:00
Fredrik Strand Oseberg
f34d187cd9
Refactor/separate client and admin store (#5006)
This PR is the first step in separating the client and admin stores.
Currently our feature toggle services uses the client store to serve
multiple purposes. 

Admin API uses the feature toggle service to serve both the feature
toggle list and playground features, while the client API uses the
feature toggle service to serve client features. The admin API can
change often and have very different requirements than the client API,
which changes infrequently and generally keeps the same stable structure
for long periods of time. This architecture is error prone, because when
you need to make changes to the admin API, you can very easily affect
the client API.

I aim to put up a stone wall between the two APIs. Complete separation
between the two APIs, at the cost of some duplication.

In this PR I have created a feature oriented architecture for client
features and disconnected the client API from the feature toggle
service. It now goes through it's own service to it's own store. For
feature toggle service I have duplicated and replaced the functionality
that serves /api/admin/features, I have kept a lot of the ugliness in
the code and haven't removed anything in order to avoid breaking
changes.

Next steps: 
* Move playground to admin API
* Remove client-feature-toggle-store from feature-toggle-service
2023-10-12 13:58:23 +02:00
Jaanus Sellin
7b7a2a706c
fix: enable segment importing for oss (#5010) 2023-10-12 13:43:43 +03:00
Nuno Góis
66304cf8e7
feat: message banners table migration (#5009)
https://linear.app/unleash/issue/2-1485/db-create-migration-for-a-new-internal-message-banners-table

Adds a DB migration for a new `message_banners` table.
2023-10-12 11:27:00 +01:00
Jaanus Sellin
2059706e77
feat: export dependent feature toggles (#5007) 2023-10-12 12:56:10 +03:00
Gastón Fournier
7343183f2d
chore: split interfaces for import and export (#5004)
## About the changes
This splits the interfaces for import and export, especially because the
import functionality has to be replaced in enterprise repo.

This is a breaking change because of the service renames, but I'll have
the PR for the other repository ready so we reduce the time to fix. I
intentionally avoided doing it backward compatible because of time.
2023-10-12 11:34:09 +02:00
Mateusz Kwasniewski
cfcf9de65a
feat: Protect archive feature (#5003) 2023-10-12 08:38:03 +02:00
Mateusz Kwasniewski
30e9fb87e9
feat: prevent adding dependency to archived or removed parent (#4987) 2023-10-11 16:21:57 +02:00
andreas-unleash
4e8c0478bf
fix: export NotFoundError and ISegmentService in internals.ts (#4997)
export NotFoundError and ISegmentService in internals.ts

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-10-11 14:31:45 +03:00
Jaanus Sellin
69286339fc
feat: make invite link more visible (#4984) 2023-10-11 14:31:32 +03:00
Nuno Góis
65f424156c
feat: re-order message banners (#4995)
https://linear.app/unleash/issue/2-1494/re-order-message-banners

- Re-orders message banners to fit into this logic:

>1. Maintenance banner
>2. External message banner(s) - Most likely coming from Unleash
>3. Internal message banner(s)

- Renames the feature flag to better reflect the feature behavior;
- Lays a basic skeleton structure for this new feature;
2023-10-11 11:55:54 +01:00
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
Nuno Góis
2222c47d10
feat: add internalMessageBanner feature flag (#4990)
https://linear.app/unleash/issue/2-1487/feature-flag-add-a-new-internalmessagebanner-feature-flag-for-this

Adds a new `internalMessageBanner` feature flag.
2023-10-10 20:03:59 +01: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
Christopher Kolstad
0c069b1385
fix: added await to getActiveUsers tests 2023-10-10 13:23:20 +02:00
Christopher Kolstad
1edd73db45
feat: feature changes counted in new table (#4958)
As part of more telemetry on the usage of Unleash. 

This PR adds a new `stat_` prefixed table as well as a trigger on the
events table trigger on each insert to increment a counter per
environment per day.

The trigger will trigger on every insert into the events base, but will
filter and only increment the counter for events that actually have the
environment set. (there are events, like user-created, that does not
relate to a specific environment).

Bit wary on this, but since we truncate down to row per (day,
environment) combo, finding conflict and incrementing shouldn't take too
long here.

@ivarconr was it something like this you were considering?
2023-10-10 12:32:23 +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
30d8444c80
fix: refactor getProjectOverview store method (#4972)
This PR cleans up and refactors the feature-strategy-store method
getFeatureOverview to join on the new table and attempts to make the
function more readable by extracting some of the logic into separate
functions. Keeping the LastSeenMapper for now in case there is a reason
to use it for the other endpoints.
2023-10-10 07:34:21 +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
Gastón Fournier
34fc17146e
chore: improve type on import service (#4962)
## About the changes
Limit import type to what matters
2023-10-09 10:45:19 +02:00
David Leek
e065e2a455
feat: render segments changes in feature strategy update event messages (#4950)
## About the changes

Segment changes in predata and data columns were both showing the new
segments list

Adds formatting of what's changed with segments to feature strategy
update events, so when a user changes the strategy from using
constraints, to using segments instead, it's communicated in event
updates

results in: 

admin updated
[sample-toggle](http://localhost/projects/default/features/sample-toggle)
in project [default](http://localhost/projects/default) by updating
strategy Sample Strategy in development constraints from [userId is one
of (1,2,3)] to empty set of constraints; segments from empty set of
segments to (1)


Closes #
#4912 

### Important files

- `src/lib/services/feature-toggle-service.ts` - Segment changes in
preData and data
- `src/lib/addons/feature-event-formatter-md.ts` - Formatting segments

## Discussion points

This is an SR least effort PR - we should plan a task where we look at
how to render this list of segments in a more comprehensible way (it's
just rendering ids now)
2023-10-09 09:11:39 +02:00
Nuno Góis
e0faa3e842
fix: typo in enabled event (#4960)
Fixes a typo where we would send `disabled` for `enabled` events.


https://unleash-community.slack.com/archives/C03GWTN7XMG/p1696631381409369
2023-10-08 19:22:12 +02:00
Gastón Fournier
c3e8d743bc
chore: Improve UI Config type (#4959)
Fix link types
2023-10-06 16:31:39 +02:00
Mateusz Kwasniewski
8b0cf8b11d
feat: allow to delete dependencies when no orphans (#4952) 2023-10-06 13:39:16 +02:00
Gastón Fournier
52fa872fe6
chore: handle transactions already started at the controller layer (#4953)
## About the changes
This PR adds a method to safeguard us from opening a new transaction
while inside another transaction, resulting in two isolated transactions
that will not be atomic (if one fails, the other might still complete
successfully).


bbbe4d4637/lib/knex-builder/make-knex.js (L143C5-L144C88)

We're currently opening transactions at the controller layer 

2746bd1517/src/lib/features/export-import-toggles/export-import-controller.ts (L206-L208)

but in some other places, we do it at the store level:

2746bd1517/src/lib/db/access-store.ts (L577)


## Alternative
We can remove store-level transactions and move them to the controller
following this approach:


cb034976b9/src/lib/services/index.ts (L282-L284)


cb034976b9/src/lib/features/export-import-toggles/export-import-controller.ts (L206-L208)

This option is more expensive because we have to:
1. Write the factory methods that propagate the transaction to the
stores (therefore creating the store factory methods as well)
2. Identify the methods for creating the transactions at the store level
and backtrack the calls until the controller layer
2023-10-06 13:38:32 +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
2c7587ba4b
feat: dependent features in playground (#4930) 2023-10-05 13:05:20 +02:00
Gastón Fournier
0da48cc0d1
chore: revamp transactional impl (#4916)
## About the changes
This transactional implementation decorates a service with a
transactional method that removes the need to start transactions in the
method using the service.

This is a gradual rollout with a feature toggle, just because
transactions are not easy.
2023-10-04 15:16:37 +02:00
Mateusz Kwasniewski
bc650ffe3f
feat: flag for clone dependencies (#4922) 2023-10-04 13:29:36 +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
andreas-unleash
b07c032d56
fix: update potentially-stale status dynamically (#4905)
Fixes 2 bugs:

- project-health-service keeping the feature types as an instance
variable and only updating it once was preventing real calculation to
happen if the lifetime value changed for a feature toggle type
- the ui was reading from a predefined map for the lifetime values so
they would never reflect the BE change

Closes #
[SR-66](https://linear.app/unleash/issue/SR-66/slack-question-around-potentially-stale-and-its-uses)

<img width="1680" alt="Screenshot 2023-10-02 at 14 37 17"
src="https://github.com/Unleash/unleash/assets/104830839/7bee8d4a-9054-4214-a1a2-11ad8169c3d5">
<img width="1660" alt="Screenshot 2023-10-02 at 14 37 06"
src="https://github.com/Unleash/unleash/assets/104830839/23bf55c7-a380-4423-a732-205ad81d5c3c">

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-10-04 12:47:16 +03:00
Mateusz Kwasniewski
88305a6388
feat: prevent delete and archive on parent feature (#4913) 2023-10-04 09:27:53 +02:00
Mateusz Kwasniewski
296cc9a9f2
feat: update dependency permission (#4910) 2023-10-04 09:27:14 +02:00
Nuno Góis
4167a60588
feat: biome lint frontend (#4903)
Follows up on https://github.com/Unleash/unleash/pull/4853 to add Biome
to the frontend as well.


![image](https://github.com/Unleash/unleash/assets/14320932/1906faf1-fc29-4172-a4d4-b2716d72cd65)

Added a few `biome-ignore` to speed up the process but we may want to
check and fix them in the future.
2023-10-02 13:25:46 +01:00
Mateusz Kwasniewski
751bc465d6
feat: generate orval types with dependent features (#4902) 2023-10-02 12:35:20 +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
Kamil Zegier
486c174004
fix: Add condition for getting max revision id from store (#4549)
## About the changes
In our staging setup, we create ad-hoc environments and import Unleash
state from production. After unleash is deployed on such environment,
the import job kicks in and feeds Unleash instance with feature flags
from production.

Between Unleash being up and running and the import job running, some
applications start polling Unleash. They get an empty feature toggle
list with `meta.revisionId=0`. Then apps use this as part of `eTag`
header in subsequent requests. Even though after import Unleash server
finally has toggles to serve, it doesn't because it calculates _max
revision id_ based on toggle updates (not null `feature_name` column in
query) or `SEGMENT_UPDATED`.

This change adds an extra condition to query so feature toggles import
is considered something that should invalidate the cache.
2023-09-29 12:59:28 +00: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
Mateusz Kwasniewski
72cca4f450
feat: display dependencies and parents in project details (#4859) 2023-09-28 13:37:52 +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
Gastón Fournier
f9c3259083
fix: partial index on events announced (#4856)
## About the changes
Add partial index on events by announced. This should help avoid `Seq
Scan on events` when the majority of events are announced=true

---
Co-authored-by: Ivar Østhus <ivar@getunleash.io>
Co-authored-by: Gard Rimestad <gard@getunleash.io>
2023-09-28 10:21:16 +02:00
Gastón Fournier
e2ffbee468
chore: limit the amount of unannounced events we announce (#4845)
## About the changes
When the events table is large we might be doing a full table scan
searching for unannounced events. We spotted it due to a performance
alert and confirmed in AWS performance insights

![image](https://github.com/Unleash/unleash/assets/455064/8e815fa3-7a1b-4453-881a-98a148eae119)

The proposal is to limit this operation to 500 events (rule of thumb)
per round
f82ae354eb/src/lib/services/index.ts (L141-L147)
and also ignore the events older than a day (because it seems
reasonable)


## Discussion points
**Idea**: split the `events` table into `recent_events` and
`historical_events`. Recent can be anything from a day/week/month. This
would help with recurrent queries that rely on recent data from the
event's table such as optimal 304 calculation or event this scheduled
task that sends unannounced events.
2023-09-27 15:38:00 +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
a06037625d
refactor: expicit names in queries (#4850) 2023-09-27 15:17:04 +02: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
Fredrik Strand Oseberg
ebb76a5354
Feat/reset pnps (#4841)
This PR resets pnps prompts by removing entries in the user_feedback
table
2023-09-27 12:03:02 +02:00
Mateusz Kwasniewski
76a2ec53f1
feat: Enforce one dependency (#4835) 2023-09-26 14:31:13 +02:00
Mateusz Kwasniewski
e030b67a19
feat: Api to list available parent options (#4833) 2023-09-26 14:03:24 +02:00
David Leek
0938b2e545
docs: improve datadog integration docs (#4802)
## About the changes

Improvement to the description of the datadog integration. Adds 2
missing event types, removes an event type that is deprecated and about
to be completely removed, adds missing description of extra json headers
and source type name, and adds description for the new configuration
option for JSON body support

---------

Co-authored-by: Nuno Góis <github@nunogois.com>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-09-26 11:15:22 +01:00
Mateusz Kwasniewski
d49ff03464
feat: delete all feature dependencies (#4832) 2023-09-26 09:38:34 +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
Mateusz Kwasniewski
a9805b312b
feat: Delete dependency api (#4824) 2023-09-25 15:50:05 +02:00
Jaanus Sellin
2bf995e731
feat: context/segment usage private (#4826) 2023-09-25 15:50:44 +03:00
Jaanus Sellin
c84f39ad7c
fix: project mode count even if no settings exist (#4825) 2023-09-25 12:44:02 +03:00
Jaanus Sellin
f7d87a2339
feat: add project collaboration mode to prometheus (#4819) 2023-09-25 12:07:59 +03:00
Mateusz Kwasniewski
06ea70ef00
feat: enforce no transitive parents (#4818) 2023-09-25 10:12:32 +02:00
Nuno Góis
b9946ee35c
docs: Unleash Slack App integration (#4801)
https://linear.app/unleash/issue/2-1235/docs-slack-app-integration-documentation

This adds a new reference doc for the new Unleash Slack App integration
and marks the previous Slack integration as deprecated.

As a side-effect this PR also fixes an issue where we wouldn't be able
to delete tags with special characters.

---------

Co-authored-by: David Leek <david@getunleash.io>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-09-22 23:19:17 +01:00
Nuno Góis
91edae3ccf
refactor: contract event group deleted after #4816 (#4817)
As mentioned in
https://github.com/Unleash/unleash/pull/4816#discussion_r1334162284
2023-09-22 12:57:09 +01:00
Nuno Góis
b6b0f83e3d
feat: add group-deleted event (#4816)
Adds a missing `group-deleted` event.
2023-09-22 11:04:46 +01:00
Mateusz Kwasniewski
b4742df8be
feat: UI stub for adding dependent features (#4814) 2023-09-22 11:26:45 +02:00
Jaanus Sellin
ac018447f9
feat: optimize private projects for enterprise (#4812) 2023-09-22 11:54:33 +03:00
Nuno Góis
7eae1f8382
fix: datadog addon needs flagResolver (#4806)
Fixes what this breaks: https://github.com/Unleash/unleash/pull/4765 -
The Datadog integration needs a `flagResolver`.
2023-09-21 15:07:24 +02: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
Tymoteusz Czech
18f7d0f9e1
Remove integrationsRework flag (#4770)
https://linear.app/unleash/issue/1-1359/remove-integrationsrework-flag
2023-09-20 16:27:40 +02:00
Mateusz Kwasniewski
85c7f84f8d
feat: Client api dependent features (#4778) 2023-09-20 11:53:43 +02:00
Nuno Góis
39b0c089d1
feat: simpler integration filters (#4766)
https://linear.app/unleash/issue/2-1407/remove-the-all-checkboxes-from-project-and-environment-filters

Simplifies integration event filters by removing the "ALL" checkboxes
from these components. Whether you opted to check the "ALL" checkbox, or
not to filter at all, the result is the same - The selected options
would act as a filter.

Includes some refactoring and clean up.


![image](https://github.com/Unleash/unleash/assets/14320932/2e30c5c5-12e1-4bc6-bd4a-8be4226d625d)
2023-09-20 09:21:30 +01:00
Jaanus Sellin
e4f8e1692a
feat: make application usage private through project (#4786) 2023-09-20 10:35:30 +03:00
Jaanus Sellin
e4577362bc
feat: move middleware to enterprise (#4767) 2023-09-20 08:37:52 +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
David Leek
bff1bd1026
feat: implement optional json payload and template (#4752)
## About the changes

Adds optional support for specifying JSON templates for datadog message
payload


![image](https://github.com/Unleash/unleash/assets/707867/eb7c838a-7abf-441e-972e-ddd7ada07efa)


### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->

`frontend/src/component/integrations/IntegrationForm/IntegrationParameters/IntegrationParameter/IntegrationParameterEnableWithDropdown.tsx`
- a new component comprising of a text field and a dropdown menu
`src/lib/addons/datadog.ts` - Where the integration is taking place

## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

- Should I have implemented the new component type as a specifiable
addon parameter type in definitions? Felt a bit YAGNI/Premature
- Would like input on naming and the new component etc
2023-09-19 13:08:10 +02:00