Skip to content

fix(bookings): visitor timezone setting overrides the bookings setting - #665

Merged
MrYuion merged 4 commits into
developfrom
fix/visitor-building-timezone-override
Nov 3, 2026
Merged

MrYuion merged 4 commits into
developfrom
fix/visitor-building-timezone-override

Conversation

@camreeves

Copy link
Copy Markdown
Contributor

The visitor invite forms read bookings.use_building_timezone || visitors.use_building_timezone. So bookings.use_building_timezone: true turned the building timezone on even when visitors.use_building_timezone was explicitly false. They now read visitors ?? bookings, the same as desks, parking and lockers since #655.

Alex agreed to this in the "Automated testing standard workflow" chat after Sharmila asked about it on #595.

Based on #595 because it changes that PR's bookings.use-building-timezone e2e spec. When #595 merges, this retargets to develop.

Changes

  • visitor-flow-details.component.ts (Workplace visitor flow), invite-visitor-form.component.ts (shared form, Workplace) and visitor-invite-form.component.ts (shared form, Concierge) read the visitors key first. The two setting signals for the visitors key now default to undefined, so an unset key falls back to bookings.
  • settings.schema.json, docs/settings/workplace.md and docs/settings/concierge.md now say the visitors key overrides the bookings one.
  • One unit test per form for the override. Each one fails on the old code.
  • bookings.use-building-timezone.spec.ts now has 4 cases: bookings true/false with visitors unset, visitors true, and visitors false overriding bookings true. The QA status doc rows are updated to match.

Checked locally

  • nx test bookings: 597 passed
  • nx test workplace: 871 passed
  • Concierge visitor specs: 59 passed
  • nx build workplace and nx build concierge: both pass
  • e2e:typecheck: clean
  • The changed e2e specs (bookings.use-building-timezone and visitor-invite.building-timezone) against the local stack: 14/14, each spec run twice

Behaviour change

A deployment with bookings.use_building_timezone: true and visitors.use_building_timezone: false will now show visitor invite times in local time. This only affects sites that set both keys to different values.

The visitor invite forms read `bookings.use_building_timezone ||
visitors.use_building_timezone`, so a generic `true` overrode an explicit
visitors `false`. They now read the visitors key first and fall back to
the bookings key only when it is unset, as desks, parking and lockers do
since #655.

- Workplace visitor flow details, the shared invite visitor form and the
  Concierge visitor invite form.
- Settings schema and docs describe the visitors key as an override.
- Unit tests for each form, and an override case in the
  bookings.use_building_timezone e2e spec.
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
frontend-templates Ignored Ignored Preview Nov 3, 2026 2:31pm UTC

@camreeves
camreeves changed the base branch from test/e2e-workplace-settings to develop November 3, 2026 14:20

@MrYuion MrYuion left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of Alex Sorafumo

The visitors ?? bookings change is correct for the first settings load, and the docs and schema match it. I found two issues:

  1. Fallback stops working after a building switch (both shared forms). The settingSignal cache keeps the old value when a key becomes unset, so after a building that set visitors.use_building_timezone, the forms never fall back to bookings.use_building_timezone again. visitor-flow-details reads _settings.get and does not have this problem.
  2. QA doc totals not updated. The visitor-invite rows now add up to 31, but the header still says 29, and the summary still says 445 although the spec now has 2 more tests.

Not run: I did not run the unit or e2e suites. I checked the findings by reading settings.service.ts and organisation.service.ts.

public readonly timezone = computed(() =>
this._booking_use_building_timezone() ||
this._visitor_use_building_timezone()
(this._visitor_use_building_timezone() ??

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of Alex Sorafumo

After the first set, this ?? cannot fall back to bookings again. The signal comes from the global settingSignal cache, and SettingsService._updateSignals() (libs/common/src/lib/settings.service.ts:431-434) does this.get(key) ?? old. So when the key becomes unset, the signal keeps its last value and never goes back to undefined.

How to see it: building A has zone metadata visitors.use_building_timezone: false. Building B does not set the visitors key and has bookings.use_building_timezone: true. A building switch calls OrganisationService._updateSettingOverrides() → setOverrides() → _updateSignals(), and the visitors signal stays false. On building B the form shows local time, but the docs say it should use bookings (true). The opposite case works the same way with a stale true.

Before this PR, || hid half of this. Now that an unset key has its own meaning, it matters more. visitor-flow-details.component.ts and the desk, parking and locker flows read _settings.get(...) each time, so they are not affected. A simple fix is to read the keys in a computed that uses this._settings.get(...) with a signal dependency on overrides, or to change _updateSignals so an unset key goes back to the default it was created with. The second fix applies to all signal-backed settings, so it is probably out of scope here. The same applies to visitor-invite-form.component.ts:557.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of Alex Sorafumo

Fixed in a02aae8. timezone now reads both keys with this._settings.get(...) inside the computed, and the two cached signals are removed. get() reads the _overrides and _debug_overrides signals, so the computed recomputes on a building switch and an unset visitors key falls back to bookings again. _updateSignals() is unchanged, as you suggested.

The settings test mock's get was not reactive, so it now reads its version signal (libs/common/src/tests/test-helpers.ts). Unit tests pass for bookings, assets, catering, common, components and workplace, and workplace and concierge build.

);
public readonly timezone = computed(() =>
this._visitor_use_bld_tz() || this._booking_use_bld_tz()
(this._visitor_use_bld_tz() ?? this._booking_use_bld_tz())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of Alex Sorafumo

This has the same problem as the comment on invite-visitor-form.component.ts:875. settingSignal('visitors.use_building_timezone') keeps its last value after a building switch removes the key, so the Concierge form does not fall back to bookings.use_building_timezone again in that session.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of Alex Sorafumo

Fixed in a02aae8 with the same this._settings.get(...) change. The new spec test sets settingSignal('visitors.use_building_timezone') to a stale false while the current settings only set bookings.use_building_timezone: true. It fails on the previous code and passes now.

| visitors.allow_visitor_internal_or_external | visitor-invite.allow-visitor-internal-or-external | 2 | PASS | |
| visitors.bookable_hours | visitor-invite.bookable-hours | 3 | PASS | Overrides bookings.bookable_hours, falls back to it, and both unset offer the whole day |
| visitors.use_building_timezone | visitor-invite.building-timezone | 2 | PASS | |
| visitors.use_building_timezone | visitor-invite.building-timezone, bookings.use-building-timezone | 4 | PASS | True with bookings.use_building_timezone false, and false overriding bookings.use_building_timezone true. The forms read visitors ?? bookings |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of Alex Sorafumo

This row went from 2 to 4, but the totals above it did not change. The ### visitor-invite (13 specs, 16 Settings, 29 scenarios) rows (line 310) now add up to 31. The summary row still says 445 scenarios, but bookings.use-building-timezone.spec.ts now has 4 tests instead of 2. The doc says its counts match --list, so the header and summary need +2.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of Alex Sorafumo

Fixed in a02aae8. I checked the counts with --list (449 tests, including the 2 preflight tests):

  • visitor-invite header: 29 → 31 scenarios
  • Summary: 445 → 447 scenarios
  • settings project row: 409 → 411 tests. This row was also out of date.

…uilding switch

The cached setting signals keep their last value when a building switch
unsets a key, so `visitors ?? bookings` never fell back again. Both
shared visitor forms now read the keys with `SettingsService.get()` in
the `computed`, which tracks the overrides signals.

The settings test mock `get` now reads its version signal, so a
`computed` over `get()` recomputes when a spec changes the mock.

Update the QA doc totals for the 2 new e2e tests (447 scenarios).
…oops

The playwright(valid-title) lint rule rejects `test(scenario.label, ...)`
and blocks the pre-push hook. Match the other loop specs.
@vercel

vercel Bot commented Nov 3, 2026

Copy link
Copy Markdown

Deployment failed for project frontend-templates with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/placeos?upgradeToPro=build-rate-limit

@MrYuion
MrYuion merged commit 2de305a into develop Nov 3, 2026
46 of 51 checks passed
@MrYuion
MrYuion deleted the fix/visitor-building-timezone-override branch November 3, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants