fix(api): restore deprecated info.platform/identity.mac device filters#6582
Merged
Conversation
#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
Member
|
/review |
|
Claude finished @gustavosbarreto's task in 4m 8s —— View job Code Review CompleteReviewed 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
#6569 ("refactor(api): remove MongoDB remnants") dropped the Mongo-style dotted filter field names from the device list endpoint:
info.platformandidentity.macwere removed fromDeviceFilterFieldsand thelegacyMongoFieldMappingtranslation layer was deleted.These dotted names are part of the public device-list filter contract, so external integrations that send
info.platform/identity.macstarted 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-acceptinfo.platformandidentity.macinDeviceFilterFieldsas deprecated aliases.api/store/pg/internal/filters.go— add a minimallegacyDeviceFieldAliasesmap (info.platform→platform,identity.mac→mac) and rewrite the field name once inParseFilterProperty, before any SQL binding, so every operator is covered. Extracted a sharedrenameFilterFieldhelper reused by the existingdevice_uidalias.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 acrosseq/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 cleanFixes: #6574