Page MenuHomePhabricator

[Flow] improve report related types
ClosedPublic

Authored by kamil on Nov 15 2023, 4:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 2, 9:13 AM
Unknown Object (File)
Sun, Oct 27, 8:54 PM
Unknown Object (File)
Oct 7 2024, 6:23 AM
Unknown Object (File)
Oct 7 2024, 2:13 AM
Unknown Object (File)
Oct 6 2024, 11:08 PM
Unknown Object (File)
Sep 29 2024, 3:22 AM
Unknown Object (File)
Sep 29 2024, 3:22 AM
Unknown Object (File)
Sep 29 2024, 3:22 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.