Page MenuHomePhabricator

[Flow] improve report related types
ClosedPublic

Authored by kamil on Nov 15 2023, 4:07 AM.
Tags
None
Referenced Files
F3510007: D9893.id33253.diff
Sat, Dec 21, 10:18 AM
Unknown Object (File)
Sun, Dec 15, 11:58 PM
Unknown Object (File)
Sun, Dec 15, 11:58 PM
Unknown Object (File)
Sun, Dec 15, 11:58 PM
Unknown Object (File)
Sun, Dec 15, 11:57 PM
Unknown Object (File)
Sun, Dec 15, 11:49 PM
Unknown Object (File)
Fri, Dec 13, 11:18 PM
Unknown Object (File)
Fri, Dec 13, 2:54 AM
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.