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
renovate[bot]
c7498dcac6
chore(deps): update dependency @biomejs/biome to v1.4.0 (#5288)
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@biomejs/biome](https://biomejs.dev)
([source](https://togithub.com/biomejs/biome)) | [`1.3.3` ->
`1.4.0`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/1.3.3/1.4.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@biomejs%2fbiome/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@biomejs%2fbiome/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@biomejs%2fbiome/1.3.3/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@biomejs%2fbiome/1.3.3/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>biomejs/biome (@&#8203;biomejs/biome)</summary>

###
[`v1.4.0`](https://togithub.com/biomejs/biome/blob/HEAD/CHANGELOG.md#140-2023-11-27)

[Compare
Source](af24597c18...889593e3f9)

##### CLI

- Remove the CLI options from the `lsp-proxy`, as they were never meant
to be passed to that command. Contributed by
[@&#8203;ematipico](https://togithub.com/ematipico)

- Add option `--config-path` to `lsp-proxy` and `start` commands. It's
now possible to tell the Daemon server to load `biome.json` from a
custom path. Contributed by
[@&#8203;ematipico](https://togithub.com/ematipico)

- Add new `--diagnostic-level` option to let users control the level of
diagnostics printed by the CLI. Possible values are: `"info"`, `"warn"`,
`"hint"`. Contributed by
[@&#8203;simonxabris](https://togithub.com/simonxabris)

- Add option `--line-feed` to the `format` command. Contributed by
[@&#8203;SuperchupuDev](https://togithub.com/SuperchupuDev)

- Add option `--bracket-same-line` to the `format` command. Contributed
by [@&#8203;faultyserve](https://togithub.com/faultyserve)

- Add option `--bracket-spacing` to the `format` command. Contributed by
[@&#8203;faultyserve](https://togithub.com/faultyserve)

##### Bug fixes

- Fix the command `format`, now it returns a non-zero exit code when if
there pending diffs. Contributed by
[@&#8203;ematipico](https://togithub.com/ematipico)

##### Configuration

- Add option `formatter.lineFeed`. Contributed by
[@&#8203;SuperchupuDev](https://togithub.com/SuperchupuDev)
- Add option `javascript.formatter.bracketSameLine`. Contributed by
[@&#8203;faultyserve](https://togithub.com/faultyserve)
- Add option `javascript.formatter.bracketSpacing`. Contributed by
[@&#8203;faultyserve](https://togithub.com/faultyserve)

##### Formatter

##### New features

- Add a new option
[`--line-ending`](https://biomejs.dev/reference/configuration/#formatterlineending).
This option allows changing the type of line endings. Contributed by
[@&#8203;SuperchupuDev](https://togithub.com/SuperchupuDev)
- Added a new option called `--bracket-spacing` to the formatter. This
option allows you to control whether spaces are inserted around the
brackets of object literals.
[#&#8203;627](https://togithub.com/biomejs/biome/issues/627).
Contributed by [@&#8203;faultyserver](https://togithub.com/faultyserver)
- Added a new option called `--bracket-same-line` to the formatter. This
option allows you to control whether spaces are inserted around the
brackets of object literals.
[#&#8203;627](https://togithub.com/biomejs/biome/issues/627).
Contributed by [@&#8203;faultyserver](https://togithub.com/faultyserver)

##### Bug fixes

- Fix [#&#8203;832](https://togithub.com/biomejs/biome/issues/832), the
formatter no longer keeps an unnecessary trailing comma in type
parameter lists. Contributed by
[@&#8203;Conaclos](https://togithub.com/Conaclos)

- Fix [#&#8203;301](https://togithub.com/biomejs/biome/issues/301), the
formatter should not break before the `in` keyword. Contributed by
[@&#8203;ematipico](https://togithub.com/ematipico)

##### Linter

##### Promoted rules

-
[a11y/noInteractiveElementToNoninteractiveRole](https://biomejs.dev/linter/rules/no-interactive-element-to-noninteractive-role)
-
[complexity/noThisInStatic](https://biomejs.dev/linter/rules/no-this-in-static)
-
[complexity/useArrowFunction](https://biomejs.dev/linter/rules/use-arrow-function)
-
[correctness/noEmptyCharacterClassInRegex](https://biomejs.dev/linter/rules/no-empty-character-class-in-regex)
-
[correctness/noInvalidNewBuiltin](https://biomejs.dev/linter/rules/no-invalid-new-builtin)
-
[style/noUselessElse](https://biomejs.dev/linter/rules/no-useless-else)
-
[style/useAsConstAssertion](https://biomejs.dev/linter/rules/use-as-const-assertion)
-
[style/useShorthandAssign](https://biomejs.dev/linter/rules/use-shorthand-assign)
-
[suspicious/noApproximativeNumericConstant](https://biomejs.dev/linter/rules/no-approximative-numeric-constant)
-
[suspicious/noMisleadingInstantiator](https://biomejs.dev/linter/rules/no-misleading-instantiator)
-
[suspicious/noMisrefactoredShorthandAssign](https://biomejs.dev/linter/rules/no-misrefactored-shorthand-assign)

The following rules are now recommended:

-   [a11y/noAccessKey](https://biomejs.dev/linter/rules/no-access-key)
-
[a11y/useHeadingContent](https://biomejs.dev/linter/rules/use-heading-content)
-
[complexity/useSimpleNumberKeys](https://biomejs.dev/linter/use-simple-number-keys)

The following rules are now deprecated:

-
[correctness/noNewSymbol](https://biomejs.dev/linter/rules/no-new-symbol)
The rule is replaced by
[correctness/noInvalidNewBuiltin](https://biomejs.dev/linter/rules/no-invalid-new-builtin)

##### New features

- Add
[noDefaultExport](https://biomejs.dev/linter/rules/no-default-export)
which disallows `export default`. Contributed by
[@&#8203;Conaclos](https://togithub.com/Conaclos)

- Add
[noAriaHiddenOnFocusable](https://biomejs.dev/linter/rules/no-aria-hidden-on-focusable)
which reports hidden and focusable elements. Contributed by
[@&#8203;vasucp1207](https://togithub.com/vasucp1207)

- Add
[noImplicitAnyLet](https://biomejs.dev/linter/rules/no-implicit-any-let)
that reports variables declared with `let` and without initialization
and type annotation. Contributed by
[@&#8203;TaKO8Ki](https://togithub.com/TaKO8Ki) and
[@&#8203;b4s36t4](https://togithub.com/b4s36t4)

- Add [useAwait](https://biomejs.dev/linter/rules/use-await) that
reports `async` functions that don't use an `await` expression.

- Add
[useValidAriaRole](https://biomejs.dev/linter/rules/use-valid-aria-role).
Contributed by [@&#8203;vasucp1207](https://togithub.com/vasucp1207)

- Add [useRegexLiterals](https://biomejs.dev/linter/use-regex-literals)
that suggests turning call to the regex constructor into regex literals.
COntributed by [@&#8203;Yuiki](https://togithub.com/Yuiki)

##### Enhancements

- Add an unsafe code fix for
[a11y/useAriaActivedescendantWithTabindex](https://biomejs.dev/linter/rules/use-aria-activedescendant-with-tabindex)

##### Bug fixes

- Fix [#&#8203;639](https://togithub.com/biomejs/biome/issues/639) by
ignoring unused TypeScript's mapped key. Contributed by
[@&#8203;Conaclos](https://togithub.com/Conaclos)

- Fix [#&#8203;565](https://togithub.com/biomejs/biome/issues/565) by
handling several `infer` with the same name in extends clauses of
TypeScript's conditional types. Contributed by
[@&#8203;Conaclos](https://togithub.com/Conaclos)

- Fix [#&#8203;653](https://togithub.com/biomejs/biome/issues/653).
[noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports)
now correctly removes the entire line where the unused `import` is.
Contributed by [@&#8203;Conaclos](https://togithub.com/Conaclos)

- Fix [#&#8203;607](https://togithub.com/biomejs/biome/issues/609)
`useExhaustiveDependencies`, ignore optional chaining, Contributed by
[@&#8203;msdlisper](https://togithub.com/msdlisper)

- Fix [#&#8203;676](https://togithub.com/biomejs/biome/issues/676), by
using the correct node for the `"noreferrer"` when applying the code
action. Contributed by
[@&#8203;ematipico](https://togithub.com/ematipico)

- Fix [#&#8203;455](https://togithub.com/biomejs/biome/issues/455). The
CLI can now print complex emojis to the console correctly.

- Fix [#&#8203;727](https://togithub.com/biomejs/biome/issues/727).
[noInferrableTypes](https://biomejs.dev/linter/rules/no-inferrable-types)
now correctly keeps type annotations when the initialization expression
is `null`. Contributed by
[@&#8203;Conaclos](https://togithub.com/Conaclos)

- Fix [#&#8203;784](https://togithub.com/biomejs/biome/issues/784),
[noSvgWithoutTitle](https://biomejs.dev/linter/rules/no-svg-without-title)
fixes false-positives to `aria-label` and reports svg's role attribute
is implicit. Contributed by
[@&#8203;unvalley](https://togithub.com/unvalley)

- Fix [#&#8203;834](https://togithub.com/biomejs/biome/issues/834) that
made
[noUselessLoneBlockStatements](https://biomejs.dev/linter/rules/no-useless-lone-block-statements)
reports block statements of switch clauses. Contributed by
[@&#8203;vasucp1207](https://togithub.com/vasucp1207)

- Fix [#&#8203;783](https://togithub.com/biomejs/biome/issues/834) that
made
[noUselessLoneBlockStatements](https://biomejs.dev/linter/rules/no-useless-lone-block-statements)
reports block statements of `try-catch` structures. Contributed by
[@&#8203;hougesen](https://togithub.com/hougesen)

- Fix [#&#8203;69](https://togithub.com/biomejs/biome/issues/69) that
made
[correctness/noUnnecessaryContinue](https://biomejs.dev/linter/rules/no-unnecessary-continue)
incorrectly reports a `continue` used to break a switch clause.
Contributed by [@&#8203;TaKO8Ki](https://togithub.com/TaKO8Ki)

- Fix [#&#8203;664](https://togithub.com/biomejs/biome/issues/664) by
improving the diagnostic of
[style/useNamingConvention](https://biomejs.dev/linter/use-naming-convention)
when double capital are detected in strict camel case mode. Contributed
by [@&#8203;vasucp1207](https://togithub.com/vasucp1207)

- Fix [#&#8203;643](https://togithub.com/biomejs/biome/issues/643) that
erroneously parsed the option of
[complexity/useExhaustiveDependencies](https://biomejs.dev/linter/use-naming-convention).
Contributed by [@&#8203;arendjr](https://togithub.com/arendjr)

##### Parser

##### Bug fixes

- Fix [#&#8203;846](https://togithub.com/biomejs/biome/issues/846) that
erroneously parsed `<const T,>() => {}` as a JSX tag instead of an arrow
function when both TypeScript and JSX are enabled.

##### VSCode

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/Unleash/unleash).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40Ni4wIiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Kolstad <chriswk@getunleash.io>
2023-11-28 09:32:00 +00:00
andreas-unleash
473741a65e
chore: Add environment mutation events (c.u.d) (#5455)
Adds the events for create, update and delete environment

Relates to:
[CTO-41](https://linear.app/unleash/issue/CTO-41/environment-mutation-not-in-event-log)

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-28 10:39:08 +02:00
Mateusz Kwasniewski
c6f878682f
fix: naming pattern update event should keep old project settings (#5443) 2023-11-28 08:25:07 +01:00
Mateusz Kwasniewski
d6483a5f22
fix: format after biome update (#5439) 2023-11-27 15:05:03 +01:00
Mateusz Kwasniewski
de287a75fe
chore: remove dependent feature flags (#5419) 2023-11-27 14:54:40 +01:00
Mateusz Kwasniewski
581b238378
fix: tag type deleted should indicate data deletion (#5437) 2023-11-27 14:49:33 +01:00
Jaanus Sellin
abf57d1c70
feat: tag operators for search api (#5425)
Added new operators INCLUDE, DO NOT INCLUDE, INCLUDE ALL OF, INCLUDE ANY
OF, EXCLUDE IF ANY OF, and EXCLUDE ALL and now support filtering by
tags.
2023-11-27 15:48:41 +02:00
Thomas Heartman
1a754325de
chore: move enterprise check further left, prevent OSS from seeing CR usage (#5431)
This PR checks that the unleash instance is an enterprise instance
before fetching change request data. This is to prevent Change Request
usage from preventing OSS users from deleting segments (when they don't
have access to change requests).

This PR also does a little bit of refactoring (which we can remove if
you want)
2023-11-27 14:16:06 +01:00
Christopher Kolstad
c179c8ad5e
chore(update): Updates biome config to 1.3 format (#5421)
Does what it says on the tin, update to 1.3.x format for biome config
2023-11-27 13:42:58 +01:00
Nuno Góis
023db4e2c9
refactor: favor permission name over id (#5409)
https://linear.app/unleash/issue/2-1664/create-db-migration-that-favors-the-name-column-over-id-for

Similar to https://github.com/Unleash/unleash/pull/5398, but
non-breaking (semver).
This keeps the permissions `id` column intact, however favors the
permission name whenever possible.
2023-11-27 11:12:09 +00:00
Thomas Heartman
f46d5a9269
chore: update segment cr return values (#5405)
This PR updates the returned value about segments to also include the CR
title and to be one list item per strategy per change request. This
means that if the same strategy is used multiple times in multiple
change requests, they each get their own line (as has been discussed
with Nicolae).

Because of this, this pr removes a collection step in the query and
fixes some test cases.
2023-11-27 11:20:39 +01:00
Thomas Heartman
0a43d341c0
fix: check whether a usage data is defined (#5393)
The previous check would return `false` if the value was 0, causing a
bug where the usage data wouldn't be included.

This also adds tests to ensure that usage data for CR segments is
propagated correctly because that's where I first encountered the issue.

Before this fix, if the values were 0, the data would display like the
bottom element in the screenshot:


![image](https://github.com/Unleash/unleash/assets/17786332/9642b945-12c4-4217-aec9-7fef4a88e9af)
2023-11-27 11:20:25 +01:00
Gard Rimestad
eb42246ce2
feat: add accessLogs feature flag (#5417)
This is a feature flag in unleash-enterprise
2023-11-27 08:07:42 +01:00
Ivar Conradi Østhus
f00eac0881
fix: User audit events (create, update, delete) should include rootRole. (#5399)
Audit events for USER_CREATE, USER_UPDATE and USER_DELETE did not
include the users rootRole.


![image](https://github.com/Unleash/unleash/assets/158948/fcbc1407-e4f0-438f-86cf-7073205cd8c2)

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2023-11-24 16:06:37 +01:00
Mateusz Kwasniewski
2e96ace14e
feat: feature type updated audit log (#5415) 2023-11-24 14:24:31 +01:00
Gastón Fournier
d680e50055
feat: audit roles (#5408)
## About the changes
Audit changes to roles both root and project roles.
2023-11-24 14:22:31 +01:00
Mateusz Kwasniewski
295b0c073e
fix: missing user id in segment update (#5414) 2023-11-24 11:17:36 +01:00
Mateusz Kwasniewski
ce382a4bf9
fix: prevent concurrent queries from running out of transaction (#5412) 2023-11-24 11:11:26 +01:00
Jaanus Sellin
b0c05111c6
feat: allow filtering projects with operators (#5400)
This is first iteration. When we add more fields to be filterable with
operators, we can have more reusable components for this.
2023-11-24 10:45:44 +02:00
andreas-unleash
2e1790985c
feat: Handle scheduled request events in addons (#5403)
- Create 2 new events to replace the SCHEDULED_CHANGE_REQUEST_EXECUTED
event
- Handle the 3 events in slack-app and webhook addon definitions

3 events handled:
- CHANGE_REQUEST_SCHEDULED
- CHANGE_REQUEST_SCHEDULED_APPLICATION_SUCCESS
- CHANGE_REQUEST_SCHEDULED_APPLICATION_FAILURE

Closes #
[1-1555](https://linear.app/unleash/issue/1-1555/update-change-request-scheduled-and-scheduled-change-request-executed)

Note: SCHEDULED_CHANGE_REQUEST_EXECUTED will be removed in follow up PR
not to break current enterprise build

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-11-23 15:00:24 +02:00
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
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
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
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
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
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
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
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