Skip to content

fix: show device identifier in grower detail when registration is empty - #1201

Open
marsof02 wants to merge 1 commit into
Greenstand:masterfrom
marsof02:fix/grower-detail-device-identifier
Open

fix: show device identifier in grower detail when registration is empty#1201
marsof02 wants to merge 1 commit into
Greenstand:masterfrom
marsof02:fix/grower-detail-device-identifier

Conversation

@marsof02

@marsof02 marsof02 commented Jun 1, 2026

Copy link
Copy Markdown

Description

Grower detail only loaded device identifiers from planter-registration. For many growers (especially when registration rows are missing or lack device_identifier), the identifier still exists on captures (trees.deviceIdentifier), so the UI showed --- even though the API had data.

This PR:

  • Keeps registration as the primary source and reads alternate field shapes (device_identifier, deviceIdentifier, nested field_data / fieldData).
  • Falls back to deduped device identifiers from the grower’s most recent captures (up to 100) when registration returns none.
  • Fixes grower switching when the previous grower had an empty registration array (reload did not run).
  • Handles registration fetch errors without leaving stale device-id state.

Admin-only workaround — does not fix missing device_identifier on planter-registration in field-data / bulk-pack ingestion (follow-up on backend).

Issue(s) addressed

What kind of change(s) does this PR introduce?

  • Enhancement
  • Bug fix
  • Refactor

Please check if the PR fulfils these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Issue

What is the current behavior?

Grower detail shows device identifiers only from GET .../planter-registration. If that list is empty or rows lack device_identifier, the Device Identifier section shows ---, even when the grower’s captures include deviceIdentifier (e.g. dev growers 22711, 22707). Switching between growers after viewing one with empty registrations could also leave device IDs stale.

What is the new behavior?

Device identifiers are built from registrations when present; otherwise from recent captures. Opening a different grower reloads registration (and capture fallback when needed) correctly. OS label uses manufacturer when available, with shape-based inference for capture fallback.

Breaking change

Does this PR introduce a breaking change?

No.

Other useful information

Test plan (dev-k8s)

  • Grower 22711 — empty planter-registration, captures have deviceIdentifier → identifier visible in Grower detail.
  • Grower 22707 — same pattern.
  • Grower with registration device ids (e.g. 22716) — no regression.
  • Open grower A, then grower B — device ids update for B.

Follow-up (out of scope)

  • Persist/serve device_identifier on planter-registration (bulk-pack / field-data pipeline).
  • Re-test reporter grower 20692 on prod (not on dev-k8s).
  • Optional: Growers list filter applies deviceIdentifier: null when Device ID filter is empty.

Manual testing on dev-k8s; no new unit tests added.

@marsof02
marsof02 requested a review from a team as a code owner June 1, 2026 05:43
@cynthiabondi
cynthiabondi requested a review from dadiorchen June 1, 2026 08:49
@cynthiabondi cynthiabondi moved this to Ready for Review in Admin Panel Jun 1, 2026
@cynthiabondi

Copy link
Copy Markdown

@dadiorchen , can you please review this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

Device identifier is not served by the registration info (field data)

2 participants