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

10172 Commits

Author SHA1 Message Date
Fredrik Strand Oseberg
a8ea8d3fbe
Fix/clean last seen environments (#5402)
This PR addresses some cleanup related to removing the
useLastSeenRefactor flag:

* Added fallback last seen to the feature table last_seen_at column 
* Remove foreign key on environment since we can not guarantee that we
will get valid data in this field
* Add environments to cleanup function
* Add test for cleanup environments
2023-11-23 12:12:58 +01:00
Nuno Góis
88a034d066
fix: dedupe any duplicate permissions (#5397)
https://linear.app/unleash/issue/2-1656/create-db-migration-that-ensures-correct-state-of-permissions

This adds a migration that dedupes any duplicate permissions.
2023-11-23 10:23:21 +00:00
Nuno Góis
7d2fd172a5
fix: role permissions UI improvements (#5388)
https://linear.app/unleash/issue/2-1657/role-permissions-improvements

This PR includes 3 improvements:
 - Sort permissions alphabetically
 - Ensure we don't display duplicate permissions
 - Improve alignment of columns by using a proper grid


![image](https://github.com/Unleash/unleash/assets/14320932/7cb4a70e-8e39-4077-95a0-66f29b3c2e55)
2023-11-23 09:43:15 +00:00
Ivar Conradi Østhus
ce01687e3b
fix: Audit events for segments should include project id (#5401) 2023-11-23 10:32:49 +01:00
andreas-unleash
937a605888
chore: remove variantTypeNumber flag (#5382)
Closes #
[1-1648](https://linear.app/unleash/issue/1-1648/clean-varianttypenumber-flag-for-release)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-23 11:12:56 +02:00
andreas-unleash
1dafc85eaa
chore: remove playgroundImprovements flag (#5384)
Closes #:

[1-1647](https://linear.app/unleash/issue/1-1647/clean-playgroundimprovements-flag-for-release)

[1-1665](https://linear.app/unleash/issue/1-1665/flaky-test-playgroundconnectionfieldsettesttsx)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-23 10:50:19 +02:00
andreas-unleash
3e12c2b5b6
Chore: remove disableEnvsOnRevive flag (#5391)
Closes #
[1-1646](https://linear.app/unleash/issue/1-1646/clean-disableenvsonrevive-flag-for-release)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-23 10:10:37 +02:00
Thomas Heartman
b211345a44
fix: if a strategy both uses a segment actively and in CRs, list it twice (#5390)
This PR changes the behavior of the API a little bit. Instead of
removing any strategies from `changeRequestStrategies` that are also
in `strategies`, we keep them in instead.

The reason for this is that the overview of where a segment is used is
incomplete if it shows only strategies but not CRs. Imagine this:

You want to delete a segment, but you're told it's only used in strategy
S.
So you go and remove it from strategy S, but then you're told it's
suddenly used in CRs A, B, and C. This is now a two-step operation
with a bad surprise. Instead, we could show you immediately that this
segment is used in strategy S and CRs A, B, and C.
2023-11-22 14:13:18 +01:00
Jaanus Sellin
432aed3034
feat: support multiple terms in search, remove tag support in search (#5395)
1. Removing tag support in search
2. Adding multi keyword support for search
2023-11-22 15:06:07 +02:00
Fredrik Strand Oseberg
5414fa6663
Refactor/remove last seen at flag (#5394)
This PR removes the feature flag for displaying the new last seen by
environments component.
2023-11-22 13:32:38 +01:00
Thomas Heartman
dc1aaf6d99
chore: only return change request data if the unleash instance is an enterprise instance (#5331)
Otherwise, we might accidentally display CR data to open source users.
But more importantly, it might keep them from being able to delete a
segment that's in use by a CR in their database that they can't touch.

So by checking that they're on an enterprise instance, we avoid this
potential blocker.

I've added the `includeChangeRequestUsageData` parameter as a boolean
now, but I'm open to other suggestions.
2023-11-22 12:15:29 +00:00
Jaanus Sellin
68558fc774
feat: able to search by description (#5392) 2023-11-22 14:08:52 +02:00
Nuno Góis
5dc3e830a8
feat: add CREATE_TAG_TYPE permission (#5386)
https://linear.app/unleash/issue/2-1164/update-tag-type-covers-both-creation-and-update

Adds a new `CREATE_TAG_TYPE` permission instead of using
`UPDATE_TAG_TYPE` for both actions.
2023-11-22 10:20:19 +00:00
Thomas Heartman
fac2578922
chore: avoid duplicates (#5381)
This PR handles the case where a single strategy is used in multiple
change requests. Instead of listing the strategy several times in the
output, we consolidate the entries and add a new `changeRequestIds`
property. This is a non-empty list that points to all the change
requests it is used in.

This is required for us to be able to link back to the change requests
from the UI overview.
2023-11-22 10:26:35 +01:00
andreas-unleash
8ffc92af5b
fix: Only show strategy variant changes if there is a diff in the variants (#5353)
What it says on the box

Closes #
[1-1652](https://linear.app/unleash/issue/1-1652/remove-the-variants-from-change-request-page-when-not-modified)

![Screenshot 2023-11-16 at 11 26
05](https://github.com/Unleash/unleash/assets/104830839/8f25b82c-4dbc-46fb-bdd6-0e0049659c72)

![Screenshot 2023-11-16 at 11 25
46](https://github.com/Unleash/unleash/assets/104830839/e6366622-3a50-4a0e-bba2-6c1d34e64077)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-22 09:50:03 +02:00
Thomas Heartman
9ac3d7511a
chore: use query to get strategies instead of whether a segment is in use (#5375)
This change is just a refactor, removing code that's no longer used. Instead of
checking just whether a segment is in use, we now extract the list of
strategies that use this segment. This is slightly more costly,
perhaps, but it will be necessary for the upcoming implementation.
2023-11-22 06:54:28 +00:00
Thomas Heartman
8337885e47
feat: return CR uses of segments when flag is active (#5378)
This PR changes the payload of the strategiesBySegment endpoint when the
flag is active. In addition to returning just the strategies, the object
will also contain a new property, called `changeRequestStrategies`
containing the strategies that are used in change requests.

This PR does not update the schema. That can be done later when the
changes go into beta. This also allows us some time to iterate on the
payload without changing the public API.

## Discussion points:

Should `strategies` and `changeRequestStrategies` ever contain
duplicates? Take this scenario:
- Strategy S uses segment T.
- There is an open change request that updates the list of segments for
S to T and a new segment U.
- In this case, strategy S would show up both in `strategies` _and_ in
`changeRequestStrategies`.

We have two options: 
1. Filter the list of change request strategies, so that they don't
contain any duplicates (this is currently how it's implemented)
2. Ignore the duplicates and just send both lists as is.

We're doing option 2 for now.
2023-11-22 07:51:04 +01:00
Gastón Fournier
7ddcceed8a
fix: remove user from project (#5383)
Removing a user from a project was impossible if you only had 1 owner.
It worked fine when having more than an owner. This should fix it and
we'll add tests later
2023-11-21 15:44:12 +01:00
Jaanus Sellin
1429b54957
feat: sorting by last seen, environments now working properly (#5376)
Now calculates final ranks also, if there are some ranks missing from
duplicates.
2023-11-21 15:19:06 +02:00
Nuno Góis
a137275e16
chore: unpin node version in build (#5379)
https://linear.app/unleash/issue/2-1434/unpin-node-18-when-a-fix-is-out

Unpins the node version in our build step.
Continues the work of https://github.com/Unleash/unleash/pull/5146
2023-11-21 12:58:34 +00:00
Jaanus Sellin
62dbf8d12f
fix: last seen is now using last seen values from new table (#5380)
In short the issue is that after our last seen improvements, we did not
update where we are getting last_seen field. It was still using features
table, which is not the source of last seen anymore.
2023-11-21 14:44:41 +02:00
Fredrik Strand Oseberg
fe4bb4f227
feat: scheduled functions observability (#5377)
See linear issue:
https://linear.app/unleash/issue/1-1656/add-scheduler-observability

As per post mortem actions, we are adding observability to scheduled
functions.

This PR adds prometheus observability to our scheduled functions via a
summary. In addition to timing these functions with the more accurate
process.hrtime, we are getting a counter for free per scheduled job id.

Prometheus example: 

<img width="731" alt="Skjermbilde 2023-11-21 kl 13 36 33"
src="https://github.com/Unleash/unleash/assets/16081982/08a2064d-5152-4b4f-8a08-eb06e726757a">
2023-11-21 13:42:38 +01:00
Thomas Heartman
f8db9098fc
Revert "Fix: add the right change"
This reverts commit 9dc64659b7.

Wasn't intended to push to main.
2023-11-21 12:54:45 +01:00
Thomas Heartman
9dc64659b7
Fix: add the right change 2023-11-21 12:53:35 +01:00
Fredrik Strand Oseberg
83fe430a14
Feat/private project badge (#5373)
Adds an icon with tooltip for private projects in ProjectCard and
Project header:

<img width="528" alt="Skjermbilde 2023-11-21 kl 10 58 13"
src="https://github.com/Unleash/unleash/assets/16081982/28004c11-a20d-4740-98f4-127f41639896">
2023-11-21 11:49:50 +01:00
Tymoteusz Czech
d5049e6197
feat: useTableState hook (#5362)
Simplified logic for handling interaction between URL (query), table state and localstorage.
2023-11-21 11:25:31 +01:00
Nuno Góis
ae375703d2
fix: scheduler job runtime control (#5363)
## PR Description


https://linear.app/unleash/issue/2-1645/address-post-mortem-action-point-all-flags-should-be-runtime

Refactor with the goal of ensuring that flags are runtime controllable,
mostly focused on the current scheduler logic.

This includes the following changes:
 - Moves scheduler into its own "scheduler" feature folder
- Reverts dependency: SchedulerService takes in the MaintenanceService,
not the other way around
- Scheduler now evaluates maintenance mode at runtime instead of relying
only on its mode state (active / paused)
- Favors flag checks to happen inside the scheduled methods, instead of
controlling whether the method is scheduled at all (favor runtime over
startup)
 - Moves "account last seen update" to scheduler
 - Updates tests accordingly
 - Boyscouting

Here's a manual test showing this behavior, where my local instance was
controlled by a remote instance. Whenever I toggle `maintenanceMode`
through a flag remotely, my scheduled functions stop running:


https://github.com/Unleash/unleash/assets/14320932/ae0a7fa9-5165-4c0b-9b0b-53b9fb20de72


Had a look through all of our current flags and it *seems to me* that
they are all used in a runtime controllable way, but would still feel
more comfortable if this was double checked, since it can be complex to
ensure this.

The only exception to this was `migrationLock`, which I believe is OK,
since the migration only happens at the start anyways.

## Discussion / Questions

~~Scheduler `mode` (active / paused) is currently not *really* being
used, along with its respective methods, except in tests. I think this
could be a potential footgun. Should we remove it in favor of only
controlling the scheduler state through maintenance mode?~~ Addressed in
7c52e3f638

~~The config property `disableScheduler` is still a startup
configuration, but perhaps that makes sense to leave as is?~~
[Answered](https://github.com/Unleash/unleash/pull/5363#issuecomment-1819005445)
by @FredrikOseberg, leaving as is.

Are there any other tests we should add?

Is there anything I missed?

Identified some `setInterval` and `setTimeout` that may make sense to
leave as is instead of moving over to the scheduler service:
- ~~`src/lib/metrics` - This is currently considered a `MetricsMonitor`.
Should this be refactored to a service instead and adapt these
setIntervals to use the scheduler instead? Is there anything special
with this we need to take into account? @chriswk @ivarconr~~
[Answered](https://github.com/Unleash/unleash/pull/5363#issuecomment-1820501511)
by @ivarconr, leaving as is.
- ~~`src/lib/proxy/proxy-repository.ts` - This seems to have a complex
and specific logic currently. Perhaps we should leave it alone for now?
@FredrikOseberg~~
[Answered](https://github.com/Unleash/unleash/pull/5363#issuecomment-1819005445)
by @FredrikOseberg, leaving as is.
- `src/lib/services/user-service.ts` - This one also seems to be a bit
more specific, where we generate new timeouts for each receiver id.
Might not belong in the scheduler service. @Tymek
2023-11-21 10:06:38 +00:00
Thomas Heartman
27252f7728
chore: find segment strategies in CRs (#5365)
This PR adds the ability to detect which strategies use a specific
segment in active change requests.

It does not wire this functionality up to anything just yet. Follow-up
PRs will integrate this with the segment service and eventually with the
front end.
2023-11-21 10:29:43 +01:00
Mateusz Kwasniewski
7a8c8c8d29
docs: variants reassignment (#5372) 2023-11-21 10:24:35 +01:00
Jaanus Sellin
e79e30de96
fix: total number should be correct now in search (#5355)
The issue was that we all features were created exactly in same time,
and our feature counter waas expecting time to be unique to feature,
which was not the case.
2023-11-21 09:08:20 +01:00
Fredrik Strand Oseberg
11533bf97a
refactor: remove feature flag for Dora (#5367) 2023-11-21 08:18:00 +01:00
Thomas Heartman
0ba99a6162
fix: handle check against non existing projects (#5368)
Instead of throwing an error when the project doesn't exist, we say that
the names are valid, because we have nothing to say that they're not.
Presumably there is already something in place to prevent you from
importing into a non-existent project.
2023-11-20 16:02:41 +00:00
Thomas Heartman
90d6c7c0ba
chore: remove usage of feature naming pattern flag (#5364)
In preparation for this feature going GA
2023-11-20 12:42:24 +01:00
Drew Gorton
fd099e242e
Add redirects from 404 logs (#5356)
Add more redirects from the docs refactor
2023-11-17 09:38:33 -06:00
Gastón Fournier
9ef78a5a18
fix: Banners ga (#5361)
It looks like auto-merge is merging before all checks are green.... Fixing the snapshot from https://github.com/Unleash/unleash/pull/5348
2023-11-17 15:09:18 +01:00
Gastón Fournier
4801b64824
feat(banners): enable customer banners (#5348)
## About the changes
This feature allows our Enterprise customers to configure banners to be
displayed on their Unleash instance for all their users to see and
interact with. Previously known as "internal message banners".
2023-11-17 13:56:09 +00:00
Thomas Heartman
be699962b1
chore: remove segments oss splash (#5359)
This change removes the oss segments splash screen that was introduced
in https://github.com/Unleash/unleash/pull/5053.
2023-11-17 13:39:43 +00:00
Thomas Heartman
dab3dca1e1
chore: Update strategy-constraints.md (#5360)
Fix a typo: explored -> explore
2023-11-17 13:01:48 +00:00
Fredrik Strand Oseberg
fd453f5af7
fix: hardcoded stickiness and mode fields (#5342)
This PR fixes an issue where project overview would return hardcoded
project mode and stickiness fields.
2023-11-17 12:32:13 +01:00
Gastón Fournier
572610a0d8
chore: remove tsc when running tests (we do in GHA) (#5357)
Not needed for tests
2023-11-17 11:42:32 +01:00
andreas-unleash
0dc5f306cc
Feat: change request scheduled timeline (#5346)
Adds the scheduled state to the timeline

Closes #
[1-1632](https://linear.app/unleash/issue/1-1632/update-the-progress-bar-for-scheduled-changes)

![Screenshot 2023-11-16 at 10 51
03](https://github.com/Unleash/unleash/assets/104830839/6267299e-d5c3-4cbf-9ab2-25da53f2d526)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-17 11:20:14 +02:00
Nuno Góis
f8a9d7f355
fix: take into account project segments permission in form (#5352)
https://linear.app/unleash/issue/SR-184/ticket-1106-users-with-createedit-project-segment-dont-see-all-the

https://github.com/Unleash/unleash/pull/5304 did not take into account
permissions further into the Segment form.

This PR fixes the remaining permission checks to take into consideration
the project-level permission: `UPDATE_PROJECT_SEGMENT`.
2023-11-16 11:54:56 +00:00
Fredrik Strand Oseberg
2dd2d520e3
Feat/exp project features (#5351)
This PR adds feature toggle list on the project on a separate page as an
experiment
2023-11-16 12:41:31 +01:00
Gastón Fournier
02da9b1d34
fix: handle concurrent service account updates (#5349) 2023-11-16 11:03:27 +00:00
Jaanus Sellin
f3df3a31bf
feat: fix paging in sql by using common table expressions (#5343)
Optimizations:

1. Removed extra round trip to database  to count environments
2. Removed extra round trip to database to count features

Fixes:

Currently, we were using a very optimistic query to set correct limit
and offset. This breaks as soon we we join tags.

` query = query
            .select(selectColumns)
            .limit(limit * environmentCount)
            .offset(offset * environmentCount);` 

The solution was to use common table expressions, so we could count and
rank features.
2023-11-16 10:34:44 +02:00
Jaanus Sellin
4e1040c849
feat: connect sort table to backend (#5338)
Now FE sorting is done in backend.
2023-11-15 16:01:02 +02:00
Fredrik Strand Oseberg
db77962a72
fix/usefeaturesearch cache (#5340)
Fixes a bug where the closure over the useFeatureSearch hook would not
account for projectId and return the wrong total/initial load
2023-11-15 11:09:13 +01:00
Gastón Fournier
142e322589
docs: POST and PUT body handling (#5319)
## About the changes
While working on Terraform I identified some issues with how our backend
handled some requests. This happened because the Terraform client was
unaware of new fields and was not sending them. This resulted in bad
behavior as some of those missing fields were treated in the backend as
`null` and removed existing data from the DB.

This ADR aims to shed some light on the problem and specifies how our
server should handle these requests.

---------

Co-authored-by: Nuno Góis <github@nunogois.com>
2023-11-14 07:56:58 -06:00
Dawit Beyene
80e893fc1d
docs minimal edit into the desc (#5245)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### 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? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->
2023-11-14 07:56:25 -06:00
andreas-unleash
7281e8b2d3
fix: new SCHEDULED_CHANGE_REQUEST_EXECUTED on scheduled cr execution (#5330)
Rename event to SCHEDULED_CHANGE_REQUEST_EXECUTED

This event will be triggered when the executor runs a scheduled change
request.
The ChangeRequestApplied event will remain as is (going out to project
members - but will have a scheduled = true property in the data if it
scheduled.
This new event will fire on execution of the schedule and have a result
= "failed" | "succeeded" property.
Because notifications are tied to events, this notification will go out
to the creator and the applier

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-14 14:58:48 +02:00