Page MenuHomePhabricator

[Flow] improve report related types
ClosedPublic

Authored by kamil on Nov 15 2023, 4:07 AM.
Tags
None
Referenced Files
F1666305: D9893.id.diff
Fri, Apr 26, 8:03 AM
Unknown Object (File)
Tue, Apr 16, 4:25 PM
Unknown Object (File)
Tue, Apr 16, 3:13 AM
Unknown Object (File)
Mon, Apr 15, 8:37 PM
Unknown Object (File)
Mon, Apr 15, 5:48 PM
Unknown Object (File)
Sun, Apr 14, 7:58 AM
Unknown Object (File)
Sat, Apr 13, 11:57 PM
Unknown Object (File)
Sat, Apr 13, 12:06 PM
Subscribers

Details

Summary

D7916 introduced id field on the client side to identify reports and avoid comparing the entire blob each time - this is different from keyserver id assigned by the backend database.

It was properly added for ClientThreadInconsistencyReportCreationRequest and ClientEntryInconsistencyReportCreationRequest which are only ClientReportCreationRequest.

By mistake, it was also added for ErrorReportCreationRequest, MediaMissionReportCreationRequest and UserInconsistencyReportCreationRequest types which are used as both ClientReportCreationRequest and ReportCreationRequest.

That caused diverging types, invalid validators (keyserver validators were implemented without the id field) and a lot of confusion pointed out by @ashoat here:

This shouldn't cause any issues for older clients, the id field is extracted in the current code version, and also was in the past (D7910).

The main issue is that validators were not reflected in types, this diff should fix this.

Test Plan
  1. FLow.
  2. Make sure validators are properly defined (without id field).
  3. report-store-reducer.test.js and report-store-ops.test.js.
  4. Try sending some reports and make sure it succeeded..

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil added inline comments.
lib/utils/reports-service.js
20–32 ↗(On Diff #33253)

adding this explicitly, to make it more clear

kamil published this revision for review.Nov 15 2023, 4:22 AM

Seems reasonable to me. I haven't audited all places on the client where reports are constructed – hoping you went through all of those cases carefully

native/input/input-state-container.react.js
157 ↗(On Diff #33253)

Looks like your IDE accidentally added this

This revision is now accepted and ready to land.Nov 15 2023, 4:49 AM

Seems reasonable to me. I haven't audited all places on the client where reports are constructed – hoping you went through all of those cases carefully

Yes, I made sure that ReportCreationRequest types are used only on keyserver, and on the client we use those with Client* prefix

This revision was automatically updated to reflect the committed changes.