- Notifications
You must be signed in to change notification settings - Fork925
Commitac88c9b
authored
fix: ensure the web UI doesn't break when license telemetry required check fails (#16667)
Addresses#16455.## Changes- Initialize default entitlements in a Set to include all features- Initialize entitlements' `Warnings` and `Errors` fields to arraysrather than `nil`s.- Minor changes in formatting on the frontend## ReasoningI had to change how entitlements are initialized to match the `codersdk`[generatedtypes](https://github.com/coder/coder/blob/33d62619225702257fa2542f40ecc26bfd0d1fa6/site/src/api/typesGenerated.ts#L727),which the frontend assumes are correct, and doesn't run additionalchecks on.- `features: Record<FeatureName, Feature>`: this type signifies thatevery `FeatureName` is present in the record, but on `main`, that's nottrue if there's a telemetry required error- `warnings: readonly string[];` and `errors: readonly string[];`: thesetypes mean that the fields are not `null`, but that's not always trueWith a valid license, the [`LicensesEntitlements`function](https://github.com/coder/coder/blob/33d62619225702257fa2542f40ecc26bfd0d1fa6/enterprise/coderd/license/license.go#L92)ensures that all features are present in the entitlements. It's calledby the [`Entitlements`function](https://github.com/coder/coder/blob/33d62619225702257fa2542f40ecc26bfd0d1fa6/enterprise/coderd/license/license.go#L42),which is called by[`api.updateEnittlements`](https://github.com/coder/coder/blob/33d62619225702257fa2542f40ecc26bfd0d1fa6/enterprise/coderd/coderd.go#L687).However, when a license requires telemetry and telemetry is disabled,the entitlements with all features [arediscarded](https://github.com/coder/coder/blob/33d62619225702257fa2542f40ecc26bfd0d1fa6/enterprise/coderd/coderd.go#L704)in an early exit from the same function. By initializing entitlementswith all the features from the get go, we avoid this problem.## License issue banner after the changes<img width="1512" alt="Screenshot 2025-02-23 at 20 25 42"src="https://github.com/user-attachments/assets/ee0134b3-f745-45d9-8333-bfa1661e33d2"/>1 parentbebf2d5 commitac88c9b
File tree
4 files changed
+32
-7
lines changed- coderd/entitlements
- codersdk
- site/src
- api
- modules/dashboard/LicenseBanner
4 files changed
+32
-7
lines changedLines changed: 11 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
33 |
| - | |
34 |
| - | |
| 33 | + | |
| 34 | + | |
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
42 | 50 |
| |
43 | 51 |
| |
44 | 52 |
| |
45 | 53 |
| |
46 | 54 |
| |
47 | 55 |
| |
48 |
| - | |
| 56 | + | |
49 | 57 |
| |
50 | 58 |
| |
51 | 59 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
15 |
| - | |
| 15 | + | |
| 16 | + | |
16 | 17 |
| |
17 | 18 |
| |
18 | 19 |
| |
|
Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 15 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
| 9 | + | |
9 | 10 |
| |
10 | 11 |
| |
11 | 12 |
| |
| |||
14 | 15 |
| |
15 | 16 |
| |
16 | 17 |
| |
| 18 | + | |
17 | 19 |
| |
18 | 20 |
| |
19 | 21 |
| |
| |||
26 | 28 |
| |
27 | 29 |
| |
28 | 30 |
| |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
29 | 39 |
| |
30 | 40 |
| |
31 | 41 |
| |
| |||
57 | 67 |
| |
58 | 68 |
| |
59 | 69 |
| |
60 |
| - | |
| 70 | + | |
61 | 71 |
| |
62 | 72 |
| |
63 | 73 |
| |
64 | 74 |
| |
65 | 75 |
| |
66 | 76 |
| |
67 |
| - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
68 | 80 |
| |
69 | 81 |
| |
70 | 82 |
| |
| |||
90 | 102 |
| |
91 | 103 |
| |
92 | 104 |
| |
93 |
| - | |
| 105 | + | |
94 | 106 |
| |
95 | 107 |
| |
96 | 108 |
| |
|
0 commit comments
Comments
(0)