feat: add discovery timestamps to deviceInfo#1441
Open
sinchubhat wants to merge 1 commit into
Open
Conversation
sinchubhat
force-pushed
the
issue1394-rpc-go
branch
from
July 14, 2026 08:31
d9ad76e to
37b2fe1
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds discovery-related timestamp fields to the device sync payloads sent to Console, improving device lifecycle observability by distinguishing “first seen” vs “last sync” times and clarifying semantics via a field rename.
Changes:
- Introduces
deviceInfo.firstDiscovered(write-once) anddeviceInfo.lastSynced(advances each sync), replacing the priordeviceInfo.lastUpdated. - Ensures
lastSyncedis stamped once per sync attempt and reused across the 404 auto-register POST + retry PATCH flow so timestamps agree. - Adds test coverage validating timestamp behavior for existing devices and 404 auto-register scenarios for both discovered and explicitly provisioned devices.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/device/api.go | Updates the shared DeviceInfo API shape to include firstDiscovered and rename lastUpdated → lastSynced. |
| internal/commands/amtinfo.go | Stamps and sends lastSynced on every sync; stamps firstDiscovered only on POST create when discovered=true; updates POST fallback to reuse the same sync timestamp. |
| internal/commands/amtinfo_test.go | Adds comprehensive tests asserting correct presence/absence and equality invariants for firstDiscovered / lastSynced across sync scenarios. |
sinchubhat
marked this pull request as ready for review
July 14, 2026 10:33
sinchubhat
force-pushed
the
issue1394-rpc-go
branch
from
July 15, 2026 04:01
37b2fe1 to
599f9ed
Compare
Add firstDiscovered (immutable) and rename lastUpdated to lastSynced. Related to #1394
madhavilosetty-intel
approved these changes
Jul 17, 2026
sinchubhat
force-pushed
the
issue1394-rpc-go
branch
2 times, most recently
from
July 17, 2026 04:43
8d50265 to
3607f94
Compare
sudhir-intc
approved these changes
Jul 17, 2026
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.
Add firstDiscovered (immutable) and rename lastUpdated to lastSynced.
Related to #1394
Depends on device-management-toolkit/console#1136
Description:
Note: lastUpdated is renamed to lastSynced; console maps the legacy lastUpdated on read so existing console keep working.
Observe the fields from the output:
discovered, firstDiscovered and lastSynced
Query from host
Sync before activation:
discovered=true; firstDiscovered and lastSynced are equal:
Example:
Activate directly:
discovered=false; firstDiscovered omitted; lastSynced set.
Use any one of below command:
or
or
On later syncs: discovered and firstDiscovered stay unchanged (immutable); only lastSynced advances.
Full deactivation deletes the console record, so a later sync/activate creates a new record - firstDiscovered and discovered are set fresh: