Commit 5d790e7
[core][http] Add spaceId to KibanaRequestState and KibanaRequest (US-001) (#269158)
## Summary
Phase 1, US-001 of
[elastic/kibana-team#3204](elastic/kibana-team#3204):
_First-Class Space ID on Core Request_.
Adds `spaceId: string` as a first-class property on `KibanaRequest` and
`KibanaRequestState` (server side), with the backing implementation in
`CoreKibanaRequest`.
### What this PR does
- Adds `spaceId: string` to `KibanaRequestState` (the per-request Hapi
app state).
- Adds `readonly spaceId: string` to the `KibanaRequest` public
interface with JSDoc.
- Implements `spaceId` on `CoreKibanaRequest`, reading from
`appState.spaceId` and defaulting to `'default'`. This means the
property is **always populated** — never `undefined` — even before
US-002 writes the resolved space into the app state.
- Updates the `createKibanaRequest` mock fixture default to include
`spaceId: 'default'` so existing tests compile without changes.
### What this PR does NOT do
- No space extraction from the URL yet (that is US-002, which will write
to `app.spaceId` in the `onRequest` handler in `http_server.ts`).
- No changes to the Spaces plugin, `@kbn/spaces-utils`, or any
downstream consumers.
### Checklist
- [x] `node scripts/type_check --project
src/core/packages/http/server/tsconfig.json` ✅
- [x] `node scripts/type_check --project
src/core/packages/http/router-server-internal/tsconfig.json` ✅
- [x] `node scripts/type_check --project
src/core/packages/http/router-server-mocks/tsconfig.json` ✅
- [x] `node scripts/type_check --project
src/core/packages/http/server-internal/tsconfig.json` ✅
- [x] `node scripts/check_changes.ts` ✅
Made with [Cursor](https://cursor.com)
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 14aa086 commit 5d790e7
2 files changed
Lines changed: 14 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
| |||
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
| 187 | + | |
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
245 | 247 | | |
246 | 248 | | |
247 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
248 | 259 | | |
249 | 260 | | |
250 | 261 | | |
| |||
0 commit comments