-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HOLD for payment 2024-12-19] [HOLD for payment 2024-12-17] [LHN Mismatch] Move client-only keys from report_ to reportMetadata_ #51867
Comments
Current assignee @puneetlath is eligible for the NewFeature assigner, not assigning anyone new. |
|
Triggered auto assignment to Design team member for new feature review - @dubielzyk-expensify ( |
I'll be taking this part since it requires looking at the back-end also. |
Hey, Tomasz from Callstack here, I can help with this issue |
@TMisiukiewicz I need to confirm the full list that we're working with. To start, can you look into:
|
@puneetlath I checked this list and seems like majority of these properties are generated in the runtime and describe the options for LHN, not reports directly. Seems like they are not stored in Onyx at all, might the So, I'd say both properties are replaceable by referring to |
Oh wow, ok that's great to know.
This makes sense to me. Want to do this as a first step? Basically, raise a PR to update the type with only the things that are actually used by the client. Also, if the back-end attempts to merge something into Onyx that isn't in the type, do we log that? |
yeah sure, I'll start exploring it tomorrow 👍 |
So i verified all the properties and looks like there is 15 of them that should be possible to remove:
I’ll remove each unused property along with its references, one at a time, committing after each change to ensure stability. |
Nice! Sounds good. Perhaps we should break it up into a few different PRs so that it's easier to revert if one of them causes a problem, without needing to revert it all. |
Sure, i'll start with a PR with those that are not used anywhere as it's the easiest one |
Opened first PR #52182, now I'll move to work on the properties that have some references in the codebase but do not seem to be a part of |
Issue is ready for payment but no BZ is assigned. @muttmuure you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks! |
Payment Summary
BugZero Checklist (@muttmuure)
|
@TMisiukiewicz I have a few more I'd like to look into:
And then can you remind me what the deal is with lastMessageTranslationKey? Is that something that is ever sent by the back-end? I couldn't find any reference to it. And if it's a front-end only thing is it then only used optimistically? Or when is it used? |
And then in addition to those, I'd love to find a way to have some kind of front-end validation, that we are only setting fields that have been defined in the Report type. And to log if we aren't. Like if Onyx had a "validator" feature that you could pass it when initializing Onyx. And that would tell Onyx that if you see anything merged into X key it has to match Y shape. And to log if it doesn't. Do you think something like that would make sense and be possible? |
I think this one is used also when you invite members to the room or policy, so i think OpenApp should return this one
yeah seems like this one can be removed, I'll test it and prepare a PR if everything goes well
Looks like it's being sent only for optimistic data. I'll do some tests and open a PR if works properly
Let me think about it some more and discuss it with our team internally, I'll get back to you with that one 👍 |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
Opened a PR #53817 to remove Regarding validating Onyx schema, this sounds like a pretty complex thing. Validation would be done in the runtime so there would be an additional cost for the performance. Are you thinking about specifically about validating correctness of the keys, or validating keys together with their type? If you are interested, we could possibly try to build some PoC to see how it affects the performance |
Thanks!
It's not returned by OpenApp. I don't see
Would you mind giving me a real-world example of how it's used? I'd love to understand what its used for better to see if we can come up with something for it.
I was thinking of both. Validating the keys and their type. I could see that there would be a potential performance impact. Maybe this is better done with integration testing or something. How hard do you think it'd be to create a POC? |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
I moved it to
We have App/src/libs/actions/Report.ts Lines 525 to 538 in 665fa04
and
Hmm, creating a simple PoC for validating keys and their types shouldn’t be too hard. For a start, we could manually define a single object schema and check if passed object matches it by validating both the key existence and value types. This approach would be basic and give a quick sense of feasibility. Ideally, though, an automated solution that generates schemas from our existing TypeScript types would be much better for scalability. One tool worth exploring is ts-to-zod, which transforms TypeScript types into Zod schemas. Zod is widely used for schema validation and could simplify the process significantly. We already have a DebugUtils.ts file in our project, that includes some validations for specific items. However, this seems to require manual maintenance for each validator, which could be tedious over time. If you are interested I can work on a simple PoC to validate the concept, and if the idea proves useful and practical, we can explore how to streamline schema generation and formalize it into a proposal |
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.74-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-12-19. 🎊 For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
@puneetlath just a quick heads-up, I tried building a simple, basic schema validator, just to validate simplest possible keys during I'll try to set this up with collections to be able to verify the performance overhead |
Sounds good.
Good to know! It would be awesome if it turns out we can remove lastMessageTranslationKey altogether.
Very cool! Interested to see what you find! |
We are going to be changing the behavior of OpenApp/ReconnectApp when it does a full reconnect to replace the full reports list that the client has stored instead of merging with it. This means that any client-only data that we have about reports can potentially get wiped when the back-end reconnects.
We already have a reportMetadata_ object in Onyx that is meant to store such data. Let's move any keys that are currently client-only that are stored in the report_ object to the reportMetadata_ object. These are some likely keys that we will need to migrate:
To do this we will need to:
a. Updating any code that sets the data to set it in reportMetadata_ instead
b. Updating any code that gets the data to get it from reportMetadata_ instead
c. Create migration to migrate any existing data in these keys from report_ to reportMetadata_
Issue Owner
Current Issue Owner: @muttmuureThe text was updated successfully, but these errors were encountered: