Commit c5a69aa
authored
fix(backend): restore user OAuth token injection in workspace terminals (CRW-11193) (#1606)
* fix(backend): add polling fallback in PostStartInjector
If the Kubernetes Watch fails to start, fall back to polling the
DevWorkspace via GET every 10 s for up to 300 s. Inject on Running;
stop without injection on Failed, Failing, Stopped, Stopping, or
Terminating. While polling is active the workspace key remains in
activeWatches to prevent duplicate start attempts.
Fixes: CRW-11193
Assisted-by: Claude Sonnet 4.6
Signed-off-by: Oleksii Orel <oorel@redhat.com>
* refactor(backend): reuse watchInNamespace in PostStartInjector
Replace the standalone k8s.Watch in PostStartInjector with
devworkspaceApi.watchInNamespace() — the same code path used by the
WebSocket SUBSCRIBE DEV_WORKSPACE channel. Benefits:
- No separate watch infrastructure; reuses existing DevWorkspace service
- User OAuth token for both watch and polling (passed via devworkspaceApi)
- stopWatching() called after injection (clean unsubscribe)
- Shared injectCredentials() helper removes duplication between
watch-path and polling-fallback
Fixes: CRW-11193
Assisted-by: Claude Sonnet 4.6
Signed-off-by: Oleksii Orel <oorel@redhat.com>
* test(common): cover DevWorkspaceStatus re-export getter to fix 100% function coverage (CRW-11193)
The export { DevWorkspaceStatus } from './dto/api' in src/index.ts compiles
to an Object.defineProperty getter that Istanbul counts as a function. The
existing test never accessed DevWorkspaceStatus via the package index, leaving
that getter uncovered and dropping function coverage to 96% (24/25), which
failed the 100% threshold enforced by jest config.
Assisted-by: Claude Sonnet 4.6
Signed-off-by: Oleksii Orel <oorel@redhat.com>
---------
Signed-off-by: Oleksii Orel <oorel@redhat.com>1 parent 12f196f commit c5a69aa
10 files changed
Lines changed: 392 additions & 250 deletions
File tree
- packages
- common/src
- __tests__
- dto/api
- dashboard-backend/src
- routes/api
- __tests__
- helpers/__mocks__
- services
- __tests__
- dashboard-frontend/src
- services/helpers
- store/__mocks__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
225 | 235 | | |
226 | 236 | | |
227 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | 83 | | |
85 | 84 | | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | 135 | | |
137 | 136 | | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| |||
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
73 | | - | |
74 | 76 | | |
75 | 77 | | |
| 78 | + | |
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| |||
111 | 114 | | |
112 | 115 | | |
113 | 116 | | |
114 | | - | |
| 117 | + | |
115 | 118 | | |
116 | | - | |
117 | 119 | | |
118 | 120 | | |
| 121 | + | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
| 244 | + | |
243 | 245 | | |
244 | 246 | | |
245 | 247 | | |
| |||
0 commit comments