1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-26 13:48:33 +02:00
Commit Graph

2961 Commits

Author SHA1 Message Date
Melinda Fekete
b354c4dda3
docs: update OpenAPI Edge name (#10415)
Change the tag of Edge to Unleash Edge in the OpenAPI spec to help with
search relevance in the docs
2025-07-25 12:41:06 +02:00
Nuno Góis
d278185228
feat: GitHub auth (#10406)
https://linear.app/unleash/issue/2-3713/show-sign-in-with-github-auth-option-in-unleash

Adds support for a "Sign-in with GitHub" auth option.

Also took this opportunity to slightly improve the design of these
options on our log in screen.

<img width="485" height="429" alt="image"
src="https://github.com/user-attachments/assets/540cb4d5-f5bc-44a0-a7d7-d895d0f22393"
/>
2025-07-24 15:25:25 +01:00
Thomas Heartman
64050121db
Add timestampsInChangeRequestTimeline flag (#10399)
Adds flag to OSS for the new timestamps in CR timeline capability.

We might not need them in the UI, but might as well add it in case.
2025-07-23 15:33:40 +02:00
Gastón Fournier
57ec5ce876
chore: remove unkonwn flags (#10389)
We're iterating over the keys of experimental and checking if they're
enabled:
e140ab63e1/src/lib/util/flag-resolver.ts (L26)
which leads to this big list of unknown flags

This comes from our report:
<img width="1461" height="1042" alt="image"
src="https://github.com/user-attachments/assets/9579f351-e5e9-42ad-a141-b5cde83a41b8"
/>
2025-07-22 16:49:42 +02:00
Mateusz Kwasniewski
d7f98945a3
chore: Lifecycle graphs flag (#10390) 2025-07-22 14:34:27 +02:00
Gastón Fournier
020e9a49ef
chore: don't fail if array is not ordered properly (#10391)
Spotted it here:
https://github.com/Unleash/unleash/actions/runs/16443263365/job/46468801248
<img width="928" height="584" alt="image"
src="https://github.com/user-attachments/assets/5e430b91-2664-4a79-9f13-cf6da4640046"
/>

where the sort order is different.
2025-07-22 14:30:56 +02:00
Gastón Fournier
e140ab63e1
fix: flaky delete stale session (#10387)
When deleting stale sessions, we sort them by createdAt. If both
sessions are created with the same createdAt, there's a chance we get a
different sort order and we end up with the wrong order:
https://github.com/Unleash/unleash/actions/runs/16438565746/job/46453700977

I think adding 10ms between inserts should be enough (1ms should do,
but this gives me more confidence and doesn't hurt that much)

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2025-07-22 11:42:14 +00:00
Nuno Góis
51f8244a5d
chore: emit CLIENT_METRICS event after sifting (#10376)
https://linear.app/unleash/issue/2-3705/only-emit-client-metrics-after-sifting-metrics

Only emits the `CLIENT_METRICS` event after metric sifting.

This ensures the event is emitted only for valid metrics tied to known
flags, instead of all flags included in the metrics payload.

See:
https://github.com/Unleash/unleash/pull/10375#discussion_r2218974109
2025-07-21 15:40:02 +01:00
Nuno Góis
8f0c0ccef3
chore: sift metrics on both endpoints (#10375)
https://linear.app/unleash/issue/2-3696/report-unknown-flags-when-sent-to-the-bulk-metrics-endpoint

Unifies metrics sifting logic across both metrics endpoints:
- `/metrics`
- `/metrics/bulk`

This PR improves consistency between the `/metrics` and `/metrics/bulk`
endpoints by introducing a shared `siftMetrics` method, now used within
`registerBulkMetrics`. Both endpoints already call this method at the
end of their respective logic flows, ensuring that metrics are sifted in
the same way regardless of the path taken.

While the primary goal was to enable reporting of unknown flags via the
`/metrics/bulk` endpoint, this change also improves bulk processing by
consistently dropping invalid or unknown flags before insertion, just
like in the regular `/metrics` endpoint.
2025-07-21 12:40:41 +01:00
Mateusz Kwasniewski
f04dd454d9
feat: sanitize impact metrics (#10364) 2025-07-17 12:59:50 +02:00
Mateusz Kwasniewski
1ab8275996
feat: default origin for impact metrics (#10362) 2025-07-16 14:45:44 +02:00
Thomas Heartman
e125c0f072
fix(1-3928): prevent overwriting existing values in instance store (#10360)
Fixes a bug in the instance store where insert and bulkUpsert would
overwrite existing properties if there was a row there already. Now
it'll ignore any properties that are undefined.

The implementation is lifted directly from
`src/lib/db/client-applications-store.ts` (line 107 atm).

Additionally, I've renamed the `insert` method to `upsert` to make it
clearer what it does (and because we already have `bulkUpsert`). The
method seems to only be used in tests, anyway. I do not anticipate any
changes to be required in enterprise (I've checked).

## Discussion points:

This implementation uses `delete` to remove properties from the object.
Why didn't I do it some other way? Two main reasons:
1. We've had this implementation for 4 years in the client applications
store. If there were serious issues with it, we'd probably know by know.
(Probably.)
2. The only way I can think of without deleting, would be to use
`Object.fromEntries` and `Object.toEntries` and either map or reduce.
That'll double the amount of property iterations we'll need to do.

So naively, this strikes me as being more efficient. If you know better
solutions, I will of course be happy to take them. If not, I'd like to
leave this as is and then change it if we see that it's causing issues.
2025-07-16 12:10:15 +00:00
Thomas Heartman
642b209b9d
fix: don't overwrite seenClients in instance-service; merge if same client appears again (#10357)
Fixes a bug where `registerInstance` and
`register{Frontend|Backend}Client` would overwrite each other's data in
the instance service, leading to the bulk update being made with partial
data, often missing SDK version. There's a different issue in the actual
store that causes sdk version and type to be overwritten when it's
updated (because we don't use `setLastSeen` anymore), but I'll handle
that in a different PR.

This PR adds tests for the changes I've made. Additionally, I've made
these semi-related bonus changes:
- In registerInstance, don't expect a partial `IClientApp`. We used to
validate that it was actual a metrics object instead. Instead, update
the signature to expect the actual properties we need from the cilent
metrics schema and set a default for instanceId the way Joi did.
- In `metrics.ts`, use the `ClientMetricsSchema` type in the function
signature, so that the request body is correctly typed in the function
(instead of being `any`).
- Delete two unused properties from the`createApplicationSchema`. They
would get ignored and were never used as far as I can tell. (`appName`
is taken from the URL, and applications don't store `sdkVersion`
information).
- Add `sdkVersion` to `IClientApp` because it's used in instance
service.

I've been very confused about all the weird type shenanigans we do in
the instance service (expecting `IClientApp`, then validating with a
different Joi schema etc). I think this makes it a little bit better and
updates the bits I'm touching, but I'm happy to take input if you
disagree.
2025-07-16 14:02:25 +02:00
Nuno Góis
7910aa9130
chore: add flag paygInstanceStatsEvents (#10356)
https://linear.app/unleash/issue/2-3697/add-flag-payginstancestatsevents

Adds a new flag: `paygInstanceStatsEvents`

This controls sending the daily PAYG instance stats events.
2025-07-15 09:35:55 +01:00
Nuno Góis
3d78fbea7f
chore: prevent unknown flag deadlocks by sorting and batching inserts (#10348)
https://linear.app/unleash/issue/2-3692/prevent-deadlocks-by-sorting-and-batching-inserts

Tries to prevent deadlocks by sorting and batching unknown flag inserts
when flushing.
2025-07-15 08:58:42 +01:00
Mateusz Kwasniewski
998834245c
feat: Using impact metrics with flags (#10355) 2025-07-15 08:42:38 +02:00
Thomas Heartman
34feef990e
chore: Export IClientInstance from server-impl. (#10354)
This type wasn't available in enterprise, so I'm adding it to serer-impl
to make it available.

I was a little unsure whether this would be an implementation detail
that we shouldn't expose in server-impl, but comparing it with the other
things we export (`applyGenericQueryParams`, `flattenPayload`,
`basePaginationParameters`), that seems to be fine. I'm guessing this
isn't the main public export? Or it is, and we just don't care 🤷
2025-07-14 15:36:18 +02:00
Nuno Góis
e51b3bb6c2
chore: allow bulk metrics with empty flag names (#10353)
https://linear.app/unleash/issue/2-3695/allow-empty-flag-names-to-be-reported-in-bulk-metrics

Accepts metrics with empty flag names in the `/api/client/metrics/bulk`
endpoint.

When testing unknown flags through Edge, which uses the `/bulk`
endpoint, we noticed that there's a slight difference in validation
behavior compared to the regular metrics endpoint. While the regular
endpoint allows empty flag names, this one does not.

We can argue that we don't care about empty flag names in the first
place, which is true, but this inconsistency between the metric
endpoints can be confusing, and it also means that a single empty flag
name evaluation would break metrics being reported for that entire Edge
instance, for example.

This way we still accept it, just like we currently do if we point to
Unleash directly instead of going through Edge.

**Note**: We noticed that, due to the slightly different logic branch,
the bulk metrics endpoint does not report unknown flags. We'll take a
look at this at a later point.
2025-07-14 14:30:06 +01:00
Mateusz Kwasniewski
187d24db1f
chore: impact metrics resolver signature update (#10352) 2025-07-14 13:16:25 +02:00
Thomas Heartman
ed9eccd743
chore: add application_created event type (#10351)
This is primarily to facilitate reading and processing these events in
the payg cloud section of Unleash. We only emit these in one place, so I
added the types in there.
2025-07-14 11:02:29 +00:00
Mateusz Kwasniewski
ca485959b0
feat: prefix unleash impact metrics labels (#10350) 2025-07-14 11:47:45 +02:00
unleash-bot[bot]
96f59bccfa
chore(AI): healthToTechDebt flag cleanup (#10346)
Co-authored-by: unleash-bot <194219037+unleash-bot[bot]@users.noreply.github.com>
Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2025-07-11 14:15:55 +02:00
Saulius Astromskis
64f7004721
chore: reduced log level of metrics log statements (#10343)
## About the changes
Reducing the log level of metrics log statements.
2025-07-11 11:55:54 +03:00
Thomas Heartman
d5ecf04043
chore: remove unused method (#10335)
I found this method when running through the environment store that has
0 references. I also can't find any references to it in enterprise and
it's not in the interface. I think it's safe to remove.
2025-07-10 12:07:36 +02:00
Thomas Heartman
e27bd74dcc
chore: Add PAYG trial events flag to Unleash (#10336)
Pretty much what it says on the tin: add PAYG trial events flag to
control the upcoming trial events
2025-07-09 14:56:01 +01:00
Mateusz Kwasniewski
3ea30eb7a1
feat: impact metrics total requests (#10334) 2025-07-09 14:45:51 +02:00
Gastón Fournier
902845bf82
chore: amend user-created-missing events (#10333)
## About the changes
Users could have been created in Unleash without a corresponding event
(a.k.a. audit log), due to a non transactional user insert
([fix](https://github.com/Unleash/unleash/pull/10327)). This could have
happened because of providing the wrong role id or some other causes
we're not aware of.

This amends the situation by inserting an event for each user that
exists in the instance (not deleted) and doesn't have it's corresponding
user-created event.

The event is inserted as already announced because this happened in the
past.

The event log will look like this (simulated the situation in local
dev):
```json
{
  "id": 11,
  "type": "user-created",
  "createdBy": "unleash_system_user",
  "createdAt": "2025-07-08T16:06:17.428Z",
  "createdByUserId": null,
  "data": {
    "id": "6",
    "email": "xyz@three.com"
  },
  "preData": null,
  "tags": [],
  "featureName": null,
  "project": null,
  "environment": null,
  "label": "User created",
  "summary": "**unleash_system_user** created user ****"
}
```

The main problem is we can't create the event in the past, so this will
have to do it
2025-07-09 07:19:25 +00:00
Mateusz Kwasniewski
d7be47609d
feat: prefix impact metrics with unleash and type (#10331) 2025-07-09 09:09:44 +02:00
Nuno Góis
3b6613360c
chore: unknown flags UI (#10332)
https://linear.app/unleash/issue/2-3682/add-unknown-flags-page-with-table-and-description

Adds a `/unknown-flags` page with a table of unknown flag reports and a
short description of what this is.

It’s only accessible via direct URL for now (if the flag is enabled),
but it allows us to share the list with some customers.

<img width="1026" alt="image"
src="https://github.com/user-attachments/assets/feee88bb-bbce-4871-98d7-f76f95076ee2"
/>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-08 17:51:03 +01:00
Mateusz Kwasniewski
9d2df8aa75
chore: Export impact register (#10330) 2025-07-08 13:39:04 +02:00
Mateusz Kwasniewski
925724ca92
chore: expose impact register (#10329) 2025-07-08 13:13:09 +02:00
Gastón Fournier
2d83f297a1
fix: make user creation transactional (#10327)
## About the changes
When inserting a user with an invalid role id, the user creation will
succeed but there will be no record in the audit log.

The API call returns a 400 misleading you to believe the user was not
created, but it actually was.

This makes the whole user creation transactional, so if something fails,
data will be in the right state.

## Testing
The e2e test was split in 2 scenarios, one with smtp and another one
without.

This test was added, and it was failing before adding the transaction,
because when fetching the users, the user was there, despite having
returned a 400 error in the API call:

80a2e65b6f/src/test/e2e/api/admin/user-admin.e2e.test.ts (L181-L204)
2025-07-08 10:17:16 +00:00
Nuno Góis
43a6166673
chore: unknown flags with environment (#10325)
https://linear.app/unleash/issue/2-3681/add-environment-to-unknown-flag-reports

This does a few things:
 - Adds environment to our unknown flag reports
 - Increases our max unknown flag reports from 10 to 100
 - Reduces our clean up interval from 24 to 2 hours
- Flattens our response (easier to get started with and display in a
table, we can later decide if we want to group this data)

<img width="496" alt="image"
src="https://github.com/user-attachments/assets/11350639-9f7f-4011-8b39-b135c820ca21"
/>
2025-07-08 10:56:33 +01:00
Gastón Fournier
5901475c9e
fix: audit scim user deleted events (#10322)
SCIM users deleted in bulk are not captured in the event log. We just
add an event like this:

![image](https://github.com/user-attachments/assets/2d7078b2-61d6-475e-8151-63b5b5ed7449)

This prevents partial user sync because we don't get an event when the
user was deleted.
2025-07-07 12:17:37 +02:00
Tymoteusz Czech
965e817d79
fix: health to technical debt flag (#10320)
Flag was now working properly because of our flag resolver
2025-07-07 10:41:58 +02:00
Tymoteusz Czech
212c538a75
fix: health-technical debt trends in emails (#10308) 2025-07-04 16:46:59 +02:00
Mateusz Kwasniewski
3bb7426392
feat: decouple error impact metrics from logger (#10311) 2025-07-04 13:41:19 +02:00
Mateusz Kwasniewski
35db1b761e
fix: frontend API CORS (#10301) 2025-07-04 10:47:11 +02:00
Jaanus Sellin
f789378cab
feat: add query timer to event store (#10306)
I noticed event search, as it is doing `ILIKE` search, is slow
sometimes. Lets get some statistics about it.

Meanwhile added timers for other interesting queries.
2025-07-03 15:32:56 +03:00
Mateusz Kwasniewski
4dc73dd7f6
chore: remove impact metrics scrape endpoint guard (#10300) 2025-07-03 12:05:38 +02:00
Jaanus Sellin
89cff9d533
fix: tear down also event handlers in addon service (#10295) 2025-07-03 12:09:35 +03:00
unleash-bot[bot]
f7fcd1c4df
chore(AI): registerFrontendClient flag cleanup (#10297) 2025-07-03 10:52:48 +02:00
Jaanus Sellin
48efcefba7
fix: remove console log from tests (#10292)
One thing that can make tests fail is console.out, as it produces IO.
2025-07-03 10:07:53 +03:00
Jaanus Sellin
778fb2ee17
feat: now also sorting by id if in same transaction/date (#10290)
Also sort events by id, so they will be in correct order if done inside
transaction.
2025-07-03 09:26:38 +03:00
Jaanus Sellin
7e85de8f65
feat: now it is possible to search events by group id (#10275)
Now when you put group ID as query param, it will filter based on
transaction id.

I am not sure if its best naming, whether it should be groupId or
transactionId, I will leave as group for now, but its simple change
later.


![image](https://github.com/user-attachments/assets/e0caaf57-f93f-40ee-a332-d3aed249c4ca)
2025-07-02 10:16:13 +03:00
Nuno Góis
a251a9808a
fix: private projects visibility for users in editor and admin groups (#10265)
https://linear.app/unleash/issue/2-3665/viewer-role-in-admin-group-cannot-access-private-projects

Fixes a bug where private projects were not visible for viewers that
belonged to Editor or Admin groups.
2025-07-01 17:16:52 +01:00
David Leek
a748502f7d
chore(email): improve the approve request email message (#10264) 2025-07-01 15:23:39 +02:00
Jaanus Sellin
0e5080fac5
feat: start showing CR id in UI and make it clickable (#10259)
![image](https://github.com/user-attachments/assets/72c631aa-0b60-42c1-b546-870962a3e885)
2025-07-01 12:50:49 +03:00
Mateusz Kwasniewski
661fd6febf
feat: bulk impact metrics (#10251) 2025-07-01 09:50:44 +02:00
Jaanus Sellin
681ce3bfd9
feat: start storing every transaction id in events table (#10236)
Every time an event gets inserted, we check if there is transaction
data, that we can include.
2025-06-30 16:00:57 +03:00