Skip to content

fix(api): restore deprecated info.platform/identity.mac device filters#6582

Merged
otavio merged 1 commit into
masterfrom
fix/device-filter-dotted-names
Jun 30, 2026
Merged

fix(api): restore deprecated info.platform/identity.mac device filters#6582
otavio merged 1 commit into
masterfrom
fix/device-filter-dotted-names

Conversation

@otavio

@otavio otavio commented Jun 30, 2026

Copy link
Copy Markdown
Member

Description

#6569 ("refactor(api): remove MongoDB remnants") dropped the Mongo-style dotted filter field names from the device list endpoint: info.platform and identity.mac were removed from DeviceFilterFields and the legacyMongoFieldMapping translation layer was deleted.

These dotted names are part of the public device-list filter contract, so external integrations that send info.platform / identity.mac started getting HTTP 400 after #6569. This restores backward compatibility for the two live fields without bringing back the dead code, and turns the removal into a proper deprecation cycle.

Changes

  • api/services/device.go — re-accept info.platform and identity.mac in DeviceFilterFields as deprecated aliases.
  • api/store/pg/internal/filters.go — add a minimal legacyDeviceFieldAliases map (info.platformplatform, identity.macmac) and rewrite the field name once in ParseFilterProperty, before any SQL binding, so every operator is covered. Extracted a shared renameFilterField helper reused by the existing device_uid alias.
  • openapi/spec/paths/api@devices.yaml — document the deprecated aliases and announce removal in the next major API version.
  • api/store/pg/internal/filters_test.go — regression test covering both aliases across eq/contains/ne.

The other six aliases removed in #6569 (info.id, info.pretty_name, info.version, info.arch, position.longitude, position.latitude) were never in the allowlist and stay removed.

Verification

  • go build ./..., go test ./store/pg/internal/..., golangci-lint run — all clean
  • OpenAPI: Prettier + Redocly lint pass

Fixes: #6574

#6569 dropped the Mongo-style dotted filter field names from the device
list endpoint, breaking external integrations that filter by
info.platform or identity.mac. Re-accept them as deprecated aliases that
translate to the platform and mac columns, and document the deprecation
in the OpenAPI spec for removal in the next major API version.

Fixes: #6574
@otavio otavio requested review from a team as code owners June 30, 2026 11:36
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

Claude finished @otavio's task in 3m 14s —— View job


Code Review

  • Gathered PR context
  • Reviewing with 5 specialized agents
  • Posting feedback

@gustavosbarreto

Copy link
Copy Markdown
Member

/review

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

Claude finished @gustavosbarreto's task in 4m 8s —— View job


Code Review Complete

Reviewed 4 files across code quality, security, testing, language patterns, and architecture — no new issues found. The code looks good as-is.

To request another review round, comment /review.


View job

@otavio otavio merged commit b421ac5 into master Jun 30, 2026
15 checks passed
@otavio otavio deleted the fix/device-filter-dotted-names branch June 30, 2026 14:46
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.

Device list filter no longer accepts documented info.* / identity.* field names (regression from #6569)

2 participants