Repository navigation
Commit faea0ec
fix(platform): return operator session expiry as ISO UTC from confirmation GET (#383)
## Problem
`POST /operator/v1/session` (elevation) serializes `expiresAt` with
`toISOString()` → `2026-10-07T12:13:32.000Z`. `GET /operator/v1/session`
(confirmation) passed the column value through raw:
`operator_sessions.expires_at` is `timestamp without time zone`, and the
string-mode column mapping returns SQL text `2026-10-07 12:13:32` — same
instant, different text. The iOS admin gate validates ISO UTC and
rejected the confirmation response (`admin-session-confirm
incompatibleResponse`, status 200).
## Fix
In the confirmation handler only: parse the timezone-less wall time
explicitly as UTC (`T` separator, `+00:00` — no assumed bare suffix, no
runtime-local guessing) and serialize with `toISOString()`. The response
now carries the same instant and the same ISO text the elevation issued.
The middleware context value is untouched and nothing else reads it, so
blast radius is this one response.
## Test evidence (observed, not expected)
New regression test round-trips the expiry through the real database
conversion (PGlite) and asserts both responses carry byte-identical ISO
text plus the full shape the app validates (apiVersion 1, same user,
eight capability flags as booleans, hostedWorkerOperations a boolean).
- Old code: 7 of 8 pass; the new test fails with the app's exact
complaint — `expected '2026-10-07 12:13:32' to be
'2026-10-07T12:13:32.000Z'`
- With this patch: all 8 of 8 pass — elevation, drain maintenance,
role/suspension enforcement, forgery rejection, dev-bypass rejection,
and input validation all unaffected
```
vp test run --project platform-api-integration platform/packages/api/test/integration/operator-auth.test.ts
```
Co-authored-by: Pluso <pluso@airbuild.local>1 parent 21babf9 commit faea0ec
2 files changed
Lines changed: 59 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
120 | 128 | | |
121 | 129 | | |
122 | | - | |
| 130 | + | |
123 | 131 | | |
124 | 132 | | |
125 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
74 | 124 | | |
75 | 125 | | |
76 | 126 | | |
| |||
0 commit comments