Skip to content

Ensure CityJSON layer names are unique before name-based selection #1375

Closed

Description

@coderabbitai

Summary

Follow up during the release quality pass on the CityJSON layer-name collision edge case deferred from #1300.

In crates/data/src/cityjson.rs, layers() truncates object types to 64 characters when constructing layer names. Distinct object types with the same first 64 characters can produce identical names. This makes info.fileLayers output ambiguous and can cause selection by the layer parameter to retain multiple layers.

add_dataset keeps map layer names distinct after import, but that does not disambiguate names used for selection before import.

Required changes

  • Ensure generated CityJSON layer names are unique before returning them from layers(), for example by adding numeric suffixes until each name is unused.
  • Preserve existing names for non-colliding layers.
  • Check the listing and name-based selection paths in crates/engine/src/cmd/layer.rs.
  • Add regression coverage in crates/data/src/cityjson/tests.rs and applicable engine tests.

Acceptance criteria

  • Two distinct object types with the same first 64 characters receive distinct, deterministic layer names.
  • Collision handling also avoids names already containing the chosen numeric suffix.
  • info.fileLayers lists distinct names, and selecting either name imports only the intended layer.
  • Non-colliding layer names remain unchanged.

Context

This minor edge case was deferred to the release quality pass rather than treated as a requirement for #1300.

Requested by @jgregoriorincon.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions