Skip to content

feat(dav): add IRoomMetadata::BUILDING_NAME - #63244

Open
Rikdekker wants to merge 1 commit into
nextcloud:masterfrom
Rikdekker:feat/room-building-name
Open

feat(dav): add IRoomMetadata::BUILDING_NAME#63244
Rikdekker wants to merge 1 commit into
nextcloud:masterfrom
Rikdekker:feat/room-building-name

Conversation

@Rikdekker

@Rikdekker Rikdekker commented Aug 14, 2026

Copy link
Copy Markdown
  • Resolves: #

Summary

Adds IRoomMetadata::BUILDING_NAME — a metadata key for the name of the building a room is in.

OCP\Calendar\Room\IRoomMetadata has keys for where a room is, but not for which building it belongs to:

BUILDING_ADDRESS     = '{http://nextcloud.com/ns}room-building-address'
BUILDING_STORY       = '{http://nextcloud.com/ns}room-building-story'
BUILDING_ROOM_NUMBER = '{http://nextcloud.com/ns}room-building-room-number'

Any client that wants to group rooms per building therefore has to derive a building name from the free-form address, in practice by taking everything before the first comma.

That guess fails on real data. On our test instance 51 of 113 rooms have an address whose first segment is empty, so the guess lands on the postal code instead: 32 rooms group under a building called "3511 EP" and 19 under "1098 XG". Neither is a building.

This is not hypothetical. nextcloud/calendar#8264 adds a browsable room finder to the Calendar room picker that groups rooms per building, and it has to carry exactly that heuristic — including a special case to skip postal-code segments — purely because there is no field to read. Every other client that wants to group rooms will reinvent the same guess.

Room backends often do know the building name as a separate value. Exchange and Microsoft 365 room mailboxes expose Building as its own property on Get-Place, and other room backends store it separately from the address. The information exists; there is just no agreed key to publish it under.

The change is one constant, placed alongside the existing building keys:

/**
 * The name of the building this room is located in
 *
 * @since 35.0.0
 */
public const BUILDING_NAME = '{http://nextcloud.com/ns}room-building-name';

Interface-only. No behaviour change and nothing to migrate: IRoomMetadata documents keys that backends may provide, and its docblock already states that backends are not limited to this list. Backends that have a building name publish it; clients that do not know the key ignore it.

Alternatives considered

  • Keep deriving it from the address. The status quo, and what produces "3511 EP" as a building name. It also pushes the same heuristic into every client independently.
  • Let each backend invent its own key. Backends can already do this, but without a shared key no two backends agree on a name and clients cannot rely on any of them.
  • Parse the building out of BUILDING_ADDRESS server-side. That centralises the guess instead of removing it, and still cannot recover a name that was never in the address.

TODO

  • Add the constant with a @since matching current master (35.0.0)

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Room backends can publish a building address but not a building name.
Clients that group rooms by building therefore derive one from the
address, in practice by taking the segment before the first comma. That
only works for backends that put the building name first: a room whose
address is "1098 XG, Amsterdam" ends up grouped under a postal code.

Add BUILDING_NAME so backends that hold the building name as a separate
field can publish it, and clients can stop guessing. The key is
optional, and nothing changes for backends that do not provide it.

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Rikdekker <Rikdekker@users.noreply.github.com>
Rikdekker added a commit to nextcloud/RoomVox that referenced this pull request Aug 14, 2026
…tant

The property table listed six of the eight keys the room backend publishes —
room-building-story and room-building-name were both missing, and 1.3.0 changed
what is emitted for the address and the floor.

Bring it in line with the code, map each key to its IRoomMetadata constant, and
note that room-building-name is the one without one. That is deliberate:
Nextcloud has no such constant, so the key is published as a literal. Proposed
upstream in nextcloud/server#63244; if it lands, the literal can be swapped for
the constant without changing the key string.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Rikdekker <Rikdekker@users.noreply.github.com>
@SebastianKrupinski

Copy link
Copy Markdown
Contributor

Hi @Rikdekker

Can you put the original PR template back in the description and fill it in, instead of replacing it.

*
* @since 35.0.0
*/
public const BUILDING_NAME = '{http://nextcloud.com/ns}room-building-name';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi, So you are adding a dav property. But where is the implementation of this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good question — there is no implementation to add here, because the metadata pipeline is already generic.

AbstractPrincipalBackend stores whatever keys a backend returns from IRoom::getAllAvailableMetadataKeys() in calendar_rooms_md, and searchPrincipalsByMetadataKey() handles arbitrary keys in its default branch. Only FEATURES and CAPACITY need special cases, because they are a list and a numeric range rather than a plain string. BUILDING_ADDRESS, BUILDING_STORY and BUILDING_ROOM_NUMBER have no implementation either — they are defined in IRoomMetadata and nowhere else in server, and reach clients through that generic path. BUILDING_NAME behaves exactly the same.

So this PR is a shared vocabulary entry rather than a feature: without it, backends and clients cannot agree on a key name for something both sides already have.

ProducerRoomVox 1.3.0 publishes this property today. It holds the building as its own field, so it can emit the real name instead of leaving clients to guess. It currently uses the literal string, since there is no constant to reference; if this lands, that becomes IRoomMetadata::BUILDING_NAME with no change to the key itself.

Consumernextcloud/calendar#8264 adds a room browser to the Calendar room picker that groups rooms per building. It currently derives the building name from BUILDING_ADDRESS by taking the segment before the first comma, plus a special case to skip postal codes. That heuristic exists purely because there is no key to read, and it is wrong often enough to matter: on a 113-room instance, 51 rooms group under a postal code instead of a building.

Happy to open a follow-up on the Calendar side that prefers BUILDING_NAME when a backend supplies it and keeps the address heuristic as a fallback — that felt like it belonged in a separate PR rather than this one.

@Rikdekker

Copy link
Copy Markdown
Author

Done — template restored and filled in, with the rationale moved into the Summary section instead of replacing it. Sorry for the noise.

Two notes on the checklist:

  • No tests: the change is a single public constant, so there is no behaviour to cover. Happy to add something if you would rather see it.
  • I left the label and milestone boxes unticked since I cannot set those myself.

I also ticked the AI box: the commit carries an Assisted-by trailer.

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