Repository navigation
feat: move to the typed ts-client 7, so bad API data fails at once - #755
Conversation
[High impact] No confirmed new issue blocks merging this PR. SummaryMoves the apps to
MrYuion documents the missing refresh for Teams sign-in-window tokens as a known gap; reloading signs the user in again.
|
MrYuion
left a comment
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of MrYuion
Review of the behavior changes at 3bd5868. I checked the client layer in libs/common, the asset, booking, event and explore functions, and the signage manager services. Inline comments:
- Blocking. Against a live server, the staff event schema cuts
event.systemdown to{ id }. Mock mode and the mock schema spec do not show this. queryBookingsno longer sendsinclude_parent_bookings, so asset requests on a parent booking go missing from the concierge asset manager.- Minor: the display zones still come from one page of 500 group zones, and the doc comment above that query is now wrong.
I found no problems in the login session, placeFetch, realtime, pagination (loadAllPages, queryAllPages) or the request body helpers.
3bd5868 to
8b8c1da
Compare
MrYuion
left a comment
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of MrYuion
I re-reviewed 77943042a4..47d00b293a, the five commits added after the review at 3bd5868. The rebase did not change the first three commits, and git range-diff shows them as identical. I found no new issues.
The fixes in the replies are correct:
event.system:7.0.0-next.5parses a response union as the variant that knows the most of the given keys, and arrays add up the counts of their items (core/schema.js,knownKeys). A full system now parses asControlSystemif it hasupdate_triggers.include_parent_bookings:bookingQuerysends it and theas anycast is gone. No otherqueryBookingscaller passes a field thatbookingQuerydrops.- Display zones:
queryAllfollowsnextfromorThrowPage, stops after 50 pages, and still decodes the entity names. Thus removing.map(decodeEntityNames)loses nothing. - Ignored booking IDs: both sides are compared as strings in
queryResourceAvailabilityandqueryGroupAvailability.
Lazy loading: no app or library code imports payment-checkout-modal.component directly. Only the @placeos/payments index exports it, and payments.service.ts loads it with await import() before dialog.open. The hosted page window still opens in the click handler of the modal, so the deferred import does not cause popup blocking. No file imports provideValueAccessor from the @placeos/common index now. All build and test checks pass on 47d00b2.
Not blocking: Workplace still gets PAYMENT_CHECKOUT from the @placeos/payments index, which also exports the modal. The bundle stays small only because of tree shaking. A @placeos/payments/checkout path, like @placeos/common/value-accessor, would make this explicit. This is optional.
47d00b2 to
ec35d0f
Compare
49abe29 to
4c12678
Compare
MrYuion
left a comment
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of MrYuion
I re-reviewed the changes after 49abe29c and found no new issues.
git range-diff 442eeb0c..49abe29c 2f225605..4c126788 shows 18 of the 19 commits as identical. Only ba8d3a07f2, the ts-client 7 migration commit, changed. The rebase onto develop picked up #759 and #760, and this commit now moves the #759 test to the 7.x client. The test "should keep the selected desk in the form when the save fails" mocks bookings.create with httpFailure(504, ...) instead of mocking ts_client.post through an as any cast. It fails when I revert the { ...this.model() } copy in postForm, so it still checks the #759 fix.
The source from #759 and #760 works with 7.x as merged. desk-flow-confirm.component.ts and sentry.ts did not need changes.
The fixes in the replies are correct at 4c126788:
- Deals:
deals.service.ts:39defaults the missing entry to{ details: [] }.explore-poi.service.ts:41andexplore-search.service.ts:263default to{ details: {} }. The othermetadata.showcallers that I checked use?.or a.catch. - Public guest:
PublicEventsComponentopens/guest-detailswhenauthenticated()changes from true to false. It sends the same query as the route check. - The fixes from the earlier reviews are still in place. These are the calendar mock
system, the asset category pages,include_parent_bookings, the display zone pages and the string comparison of ignored booking IDs.
One question on a resolved thread. The Greptile finding on apps/concierge/src/app/metadata.ts about saved desks is resolved, but it has no reply and no change. ts-client 6.13 parsed string details with JSON.parse in src/metadata/metadata.ts:42-45. floorplanDetails in apps/map-studio/src/app/data/placeos.service.ts says that 7.x gives the string, and it parses it. The concierge showMetadata and the jsonList and jsonRecord helpers do not parse strings. So protected-ids.ts:57 reads a level whose desks details are a JSON string as a level with no desks. If the API stores only floorplans as strings, a reply on that thread would close this.
Checks:
nx test bookings --include=libs/bookings/src/test/booking-form.service.spec.ts: 129 passed.nx test workplace --include=apps/workplace/src/tests/book/desk-flow/desk-flow-confirm.component.spec.ts: 20 passed.nx test common --include=libs/common/src/tests/sentry.spec.ts: 12 passed.tsc --noEmitfor the bookings lib and spec, the workplace app and spec, and the common spec: no errors.
4c12678 to
0231d4d
Compare
MrYuion
left a comment
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of MrYuion
I reviewed the changes after 4c126788. The branch was rebased onto develop (d780f499). git range-diff 2f225605..4c126788 d780f499..0231d4d8 shows 17 of the 19 earlier commits as identical. Commit 1 now moves the new develop code (assigned bookings, signage reports) to 7.x. Commit 15 moves its updateBooking change to the new assigned-booking.ts. Commit 0231d4d8 is new.
The 7.x changes in 0231d4d8 look correct. Module calls pass { timeout_ms }, order saves use playlist.media and updateMedia with orThrow, and updateBooking sends PATCH, which staff.bookings.update expects. Inline comments:
- The content report reads
playlist.enabledon raw 7.x rows, where the field is nullable. The 6.x class set it totruewhen it was missing. - Nit: commits 1–19 do not type-check without
0231d4d8.
I also found one issue outside the range while I checked the nullable fields. survey-responses.component.ts:279 calls survey.pages.forEach(...). In 7.x, Survey.pages is nullable(array(SurveyPage)) (generated/staff/schemas.ts:1484), and the survey comes raw from surveys.show(...).then(orThrow). A survey with pages: null makes the paged_responses computed throw. new-survey.service.ts:72 already uses survey.pages ?? [], and the same guard fits here.
I did not run the type check or the tests, because this worktree has no node_modules. I read the 7.0.0-next.6 and 6.x client sources from other local installs.
0231d4d to
390523f
Compare
|
Note 🤖 Claude Opus 5.5 responding on behalf of MrYuion Replies to the two items in the review at 0231d4d that were not in a thread:
All concierge and signage-manager tests pass, and |
5d3cb99 to
eab00a2
Compare
|
Note 🤖 Claude Opus 5.5 responding on behalf of MrYuion Rebased onto Conflicts:
New
Checks:
|
Move every app and lib from the 6.x client to the typed 7.x client (7.0.0-next.4). Generated operations return a Result, request bodies and responses are checked against the API schemas, and login and realtime use createAuthSession and createRealtime. - libs/common: place-client.ts (session, realtime, token, placeFetch), realtime.ts (getModule), json.ts (shared JSON helpers) - Mock data matches the 7.x schemas, with a spec that keeps it that way - Remote debugging and payments from develop use the 7.x client too - Teams tabs and the Outlook add-in are trusted, so tokens stay over a reload; the paste shortcut keeps a pasted refresh token with useRefreshToken - Signage manager sends include_child_data again
- The mock availability and free/busy replies now give `id` and `system`, as the v7 schema has them. The app found no rooms in mock mode before. - `queryAssetGroupsExtended` uses `queryAssetTypes`, so types of hidden categories, such as desks, do not reach the asset report and asset availability.
The visible category check read only the first page of categories. Types in a visible category on a later page were left out of the asset groups, the asset report and asset availability. The check now reads all pages, with the bounded loop that the asset query already used.
- `queryBookings` sends `include_parent_bookings` again. The concierge asset manager needs it to show asset requests on a parent booking. The query type has the field now, so the `as any` cast is gone. - The zones of a signage display come from all pages of the group zones, not only the first 500.
7.0.0-next.5 parses a response union as the variant that knows the most fields. Before, the staff event `system` lost all fields but `id` on a live server (PlaceOS/ts-client#40).
Workplace provides `PAYMENT_CHECKOUT` at start-up. The token was in `payments.service.ts`, so the import loaded the service, `MatDialog` and the checkout modal with the Material checkbox and radio into the initial bundle. The production build failed its 1000 kB budget at 1.18 MB, as it does on `develop` at 1.15 MB. - The token, the checkout errors, the options and `openPaymentWindow` are in the new `payment-checkout.ts`. - The service loads the checkout modal when it opens it. The initial bundle of Workplace is 958.78 kB.
`provideValueAccessor` was in the `@placeos/common` index. The index is in the initial bundle of each app, so `@angular/forms` (58 kB) was too. It is now imported as `@placeos/common/value-accessor`. The initial bundle of Workplace goes from 958.78 kB to 910.46 kB. Concierge, Signage Manager, Visitor Kiosk, Map Kiosk and Stagehand also get smaller.
The ID of a `Booking` from the 7.x API is a number. A booking event keeps it, so editing a room booking with `app.events.use_bookings` passed a numeric `ignore` to `queryResourceAvailability`. The check compared it with a string, never matched, and the booking clashed with itself. `queryResourceAvailability` and `queryGroupAvailability` now compare the ignored IDs and the booking IDs as strings.
7.0.0-next.6 (PlaceOS/ts-client#41) decodes metadata `details` that the server keeps as JSON text, as 6.x did, and gives each value of a realtime variable in a batch. With each value, a signage trigger that is already true when the display binds gave its first value as a change and replayed its playlist. A new binding does not know its value yet, so its first value is now the start state.
- The Outlook task pane and the Teams tab and sign-in window keep their trust flag and tokens in their session storage. Other windows share the local storage and no longer get them. Other windows keep no tokens, as in 6.x. - setupPlace keeps the device settings of the URL (x-api-key, trust, trusted, fixed_device) and the visitor kiosk token before the first request, so that request does not use an old key or no token. - A save of the user settings waits for the stored settings. When they do not load, or are text that is not JSON, the changes stay in the app and the save does not replace them. Only the latest waiting save sends. - notifyError shows and logs only text, so a failed 7.x call no longer shows "[object Object]" or logs its response body. loggableError gives only the kind and status of a failed call for other logs. - A realtime listener that throws no longer stops the other listeners of its batch.
- httpFailure moves to @placeos/common/tests, in place of the copies. - The remote setup tests wait for the binding values, not for 10 ms. - The work location tests wait for the user reload of a save, so it does not run in the next test.
With include_clash_time, Staff API gives each event clash as system_id, event_start and event_end. The mapper expected booking fields and dropped every row, so a recurring event saved over its clashes. The mock now sends the same shape. A failed space list logs only the kind and status.
A save kept only the fields the app reads, and removed the others, as the parsers dropped them. They now stay. Rules that are text and not JSON show an error, and the editor does not open over them.
The pages of the group zones now get the abort signal, so a lookup stops when the display or the group changes. The tests check failed results through orThrow, load the edit modal before they start, and wait for the service instead of a fixed time.
The API has one update action, so the method argument of updateBooking, updateBookingInstance and updateEvent did nothing. toBookingClash is no longer exported.
All tabs share a remembered guest in the local storage. When one tab changes the guest, the other open tabs kept the old guest and used its token until it expired. A tab now listens for the storage change and forgets that guest too. A guest of one tab only does not change.
A retry of the user load could start single sign-on again while the dialog was open, which could open a second Microsoft prompt. An attempt that started before the dialog could also replace the token of the dialog. After the dialog opens, single sign-on gives no token for the rest of the load.
metadata.show succeeds without an entry for a name that the zone does not have, so `data[name]` is undefined. The deals page then threw before it cleared `loading`, and the points of interest and the emergency contacts of explore threw too. These now default to empty details, as the 6.x showMetadata did.
The events page checked the guest only when the route changed, so a tab whose guest another tab forgot stayed on an empty page with no way to sign in again. It now opens the guest details form, with the same system and event.
When ts-client 7 rejected the zones response as invalid, the app tried the load again without end. Boot now fails with a message. Network and offline errors still try again.
ts-client 7 takes a list for the in parameter of findByEmail. The lookup now sends a list, and does not run when there is no calendar.
The host lookup for booking rules gave a user with no groups, so group rules did not apply. It now reads the engine user, and uses the email and name when that read fails.
The fakes now use integer booking and guest ids, an id on notify messages, a token request on each page load, the trust flag for stored tokens, and v7 response shapes (v7-fixtures.ts).
…d value as enabled 7.x gives the raw playlist, in which enabled can be null. The 6.x class set it to true. The report now counts a playlist as disabled only when enabled is false.
6.x parsed metadata details that the API gave as a JSON string, and 7.x gives the string. showMetadata now parses it, so a level with desks in a string does not read as empty, and a save does not overwrite them. 7.x gives Survey.pages as nullable. The responses page now reads null as no pages.
eab00a2 to
3fa2b50
Compare
The apps use
@placeos/ts-client6.x, which has no types for the API and no checks on what the apps send or get. This moves every app and lib to the typed 7.x client (7.0.0-next.6). Requests and responses are now checked against the API schemas, so a wrong field fails at once and does not reach the server.How
libs/common:place-client.ts: the login session, realtime,token(),authority()andplaceFetch().realtime.ts:getModule(), with the 6.x call and binding shape.json.ts: shared JSON helpers.get/postcalls.placeFetchis used only for endpoints that have no operation.libs/mocks/src/tests/mock-schemas.spec.tskeeps it that way.session.useRefreshToken.include_child_dataagain.develop: remote debugging and payments now use the 7.x client.ts-client changes for this PR, already released on
next:include_child_dataanduseRefreshToken.systemlost all fields butidon a live server.detailsthat the server keeps as JSON text is decoded again, as in 6.x, and realtime gives each value of a variable in a batch. Without it, such settings loaded as empty and the next save replaced them, and a signage trigger that turned on and off quickly did not start its playlist.Fixes from the review (see below):
system_id,event_startandevent_end.[object Object], and logs keep only its kind and status.Checks
develop, Workplace fails its 1000 kB initial budget at 1.15 MB, and the migration added about 29 kB. Two fixes take it to 912 kB: the payments service and its checkout modal now load on use, andprovideValueAccessormoved out of the@placeos/commonindex, to@placeos/common/value-accessor, so@angular/formsloads only with the form fields. CI builds with--configuration=feat, which has no budgets.develop: US-SGM-005, and the child-group toggle in the folder view.develop. They come from the login redirect setup, the Microsoft 365 credentials that the stack does not have, and the state of the stack data.Known gaps
docs/teams-app.md.Sentry
Fixes PLACEOS-DEV-N5. In 7.x, a mock module is a plain object with no
callmethod, so the 6.xmod.call.bind(mod)wrap inpersistSystemfailed at mock start-up. This PR wraps the$functions in its place.Council review
Rounds: 6 with gpt-6.2-sol on high. Verdict: approved
Created with Claude Opus 5.5 in Claude Code (T3 Code). Subagents on Claude Opus 5.5 wrote parts of the tests and follow-ups. The council reviewers ran on gpt-6.2-sol.
🤖 Generated with Claude Code