Prefer fetch-api device definition documents over DB fields#178
Open
Prefer fetch-api device definition documents over DB fields#178
Conversation
When resolving the Definition field on a Vehicle, first check the fetch-api gRPC service for a stored cloud event with subject equal to the vehicle's DID and type "dimo.document.devicedefinition". If found, the JSON data payload (tableland column key-value pairs) takes precedence over the make/model/year/id values stored in the DB. Falls back to DB values when: - FETCH_API_GRPC_ADDR is not configured - No document exists in fetch-api for the vehicle DID - Any fetch-api error occurs (logged as a warning) Changes: - internal/fetchapi/: vendored proto-generated gRPC client types from github.com/DIMO-Network/fetch-api/pkg/grpc (package renamed to fetchapi to avoid import aliasing issues) - internal/services/fetch_api_service.go: new gRPC client wrapping GetLatestCloudEvent with subject/type filtering - internal/config/settings.go: add FETCH_API_GRPC_ADDR setting - internal/repositories/vehicle/vehicles.go: inject FetchAPIService, enrich Definition from fetch-api in GetVehicle and GetVehicles - graph/resolver.go: wire up FetchAPIService using settings addr - go.mod/go.sum: add google.golang.org/grpc v1.78.0 https://claude.ai/code/session_019HRD1qSgtK9yEo6D4W34Vw
Route fetch-api device definition enrichment through request-scoped vehicle loading instead of the vehicle repository. - restore the vehicle repository to DB-only behavior - add a vehicle definition fetcher interface plus shared overlay helper - enrich batched vehicle loads with bounded concurrency and fallback logging - keep top-level vehicle queries consistent by reusing the same enrichment helper - update middleware wiring and add tests for override/fallback and query-shape consistency
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.
When resolving the Definition field on a Vehicle, first check the
fetch-api gRPC service for a stored cloud event with subject equal to
the vehicle's DID and type "dimo.document.devicedefinition". If found,
the JSON data payload (tableland column key-value pairs) takes precedence
over the make/model/year/id values stored in the DB.
Falls back to DB values when:
Changes:
github.com/DIMO-Network/fetch-api/pkg/grpc (package renamed to fetchapi
to avoid import aliasing issues)
GetLatestCloudEvent with subject/type filtering
enrich Definition from fetch-api in GetVehicle and GetVehicles
https://claude.ai/code/session_019HRD1qSgtK9yEo6D4W34Vw