Skip to content
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

Remove fixes.tsv serialization from NullAway serialization service #1063

Merged
merged 16 commits into from
Nov 5, 2024

Conversation

nimakarimipour
Copy link
Contributor

This PR removes the now-redundant serialization of fixes.tsv following updates to errors.tsv (#643). Previously, fixes.tsv recorded the locations of all non-null variables that participated in pseudo-assignments from nullable to non-null types, triggering NullAway errors. However, there was no direct link between these non-null locations and the corresponding errors. #643 addressed this by enhancing error serialization to include the relevant non-null location with each reported error. As a result, fixes.tsv is no longer needed, and NullAwayAnnotator now relies solely on errors.tsv.

This PR removes all serialization related to fixes.tsv and updates unit test expected output accordingly. Each unit test was adjusted to verify serialized errors, preserving their value and functionality.

Copy link

codecov bot commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.86%. Comparing base (17fc1ba) to head (e81395d).
Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1063      +/-   ##
============================================
+ Coverage     87.66%   87.86%   +0.20%     
+ Complexity     2222     2211      -11     
============================================
  Files            86       85       -1     
  Lines          7271     7188      -83     
  Branches       1436     1425      -11     
============================================
- Hits           6374     6316      -58     
+ Misses          456      438      -18     
+ Partials        441      434       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@msridhar msridhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! One question below. Also, have you tested a local build of NullAway with the Annotator to make sure this doesn't break anything?

* serialize the fix separately.
* </ul>
*/
public class SerializationV4Adapter extends SerializationV3Adapter {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you say more on why we need to bump the serialization version? I feel like annotator will still work even with V3 serialized state so there is no compatibility issue? No big harm here, just want to understand

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed version 4, as I initially thought any serialization change would require a version update. However, Annotator works perfectly fine with version 3, and actually, updating to version 4 causes it to crash with an "unsupported version" error, which would require an update to Annotator. Overall, I believe this update is unnecessary.

4a7cd5c

msridhar pushed a commit that referenced this pull request Nov 5, 2024
This PR prepares for #1063 by moving the `initializeAdapter` declaration
from `FixSerializationConfig` to `SerializationVersionAdapter`. This
change ensures that version-specific serializations are handled directly
by `SerializationVersionAdapter`, which will simplify test modifications
in #1063.

This transition also aligns with a clearer design, as
`SerializationVersionAdapter` should be responsible for computing the
appropriate adapter for each new version. This approach will help us
maintain version updates within `SerializationVersionAdapter` while
keeping `FixSerializationConfig` unchanged.

I'm uncertain if maintaining backward compatibility is necessary in the
long term. If it's not needed, we can consider removing it in the
future. For now, however, this PR is required to keep #1063 concise.
@msridhar
Copy link
Collaborator

msridhar commented Nov 5, 2024

@nimakarimipour please let me know when this is ready for another review

@nimakarimipour
Copy link
Contributor Author

@msridhar I just had an end to end test with this version of NullAway and Annotator and could produce the exact same result with NullAway version 0.12.1. I think this is ready for another review.

@nimakarimipour
Copy link
Contributor Author

nimakarimipour commented Nov 5, 2024

@msridhar One more note: I think the package name is currently fixserialization, or we’re using FixSerializationConfig. It might make more sense to rename these to serialization and SerializationConfig for clarity. If that sounds good, I can create a separate PR to make the update.

Copy link
Collaborator

@msridhar msridhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@msridhar
Copy link
Collaborator

msridhar commented Nov 5, 2024

@msridhar One more note: I think the package name is currently fixserialization, or we’re using FixSerializationConfig. It might make more sense to rename these to serialization and SerializationConfig for clarity. If that sounds good, I can create a separate PR to make the update.

I think it's better to leave as is? To make clear this is serializing state related to fixing of NullAway errors?

@msridhar msridhar merged commit 1e9c754 into uber:master Nov 5, 2024
11 checks passed
@nimakarimipour nimakarimipour deleted the nimak/remove-fixes-serialization branch November 6, 2024 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants