joyent / conch-api

Datacenter build and management service
Mozilla Public License 2.0
22 stars 11 forks source link

remove POST /device/:id/validated endpoint #532

Open karenetheridge opened 5 years ago

karenetheridge commented 5 years ago

..as soon as we're sure conch-reporter and conch-livesys don't use it.

see https://github.com/joyent/conch-relay/issues/168 and https://github.com/joyent/conch-livesys/issues/97.

karenetheridge commented 5 years ago

We may or may not want to keep the 'validated' timestamp in the DetailedDevice data structure, as it indicates the time of the last passing report.

The actual database field adds no valuethough , as we can find that information by searching for the last passing report (which we will be retaining even after applying the new retention logic). It's not tracking that specific data though -- all it's tracking is "when did someone hit the device/:id/validated endpoint, which might be something totally different. A reporter should not have to hit this endpoint when it gets a passing result from submitting a report.

sungo commented 5 years ago

(From #640) My point is that having access to a single timestamp of 'validated' is useful. Yes, one can get it from looking at the device reports or validation states. Right now, though, a device response comes with a timestamp indicating when the device was validated and that is super handy.

Currently, to get that same information from the API, I need to make two hits. one to get the device, another to get the validated states.

karenetheridge commented 5 years ago

We can either get the 'last passed validations' timestamp by searching device reports when filling in DetailedDevice, or if that's too expensive for the db, we can just denormalize the data by filling in the existing device.validated timestamp when we process a passing device report.

Either way, the endpoint discussed in the subject of this issue is bad and should not be used.

sungo commented 5 years ago

The field is also in the Device schema

karenetheridge commented 5 years ago

Also related: figure out if we want to track "time of first passing validation", or "time of most recent passing validation" (or both?), and rename the column in db and/or response schemas accordingly.

karenetheridge commented 5 years ago

I suspect that we might want to get rid of this 'validated' field in the device table, and instead use the 'phase' field to capture this information. It doesn't make sense to maintain both fields orthogonally. Needs spec to sort out exactly what to do.