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

[PFS 227] nil out entire branch #9944

Merged
merged 64 commits into from May 2, 2024
Merged

Conversation

Zhang-Muyang
Copy link
Contributor

@Zhang-Muyang Zhang-Muyang commented Apr 11, 2024

This PR is to nil out branch field in responses. This is done in interceptors.
Motivated by need to reduce confusion about relationship between Commits and Branches.

Most of the changes in this PR are to fix tests. 90%+ of failed tests are due to nil pointer problem (branch field is nil). A common fix is: we resolve commit by its id instead of by its branch.

@Zhang-Muyang Zhang-Muyang requested review from a team as code owners April 11, 2024 14:21
@Zhang-Muyang Zhang-Muyang marked this pull request as draft April 11, 2024 14:21
@Zhang-Muyang Zhang-Muyang changed the title Muyang/pfs 227 nil out entire branch [PFS 227] nil out entire branch Apr 11, 2024
@Zhang-Muyang Zhang-Muyang marked this pull request as ready for review April 23, 2024 16:35
@Zhang-Muyang Zhang-Muyang requested a review from a team as a code owner April 23, 2024 16:35
Copy link

codecov bot commented Apr 23, 2024

Codecov Report

Attention: Patch coverage is 77.57009% with 24 lines in your changes are missing coverage. Please review.

Project coverage is 58.25%. Comparing base (682cd23) to head (766c55e).
Report is 1 commits behind head on master.

Files Patch % Lines
src/server/pfs/fuse/options.go 54.54% 5 Missing ⚠️
src/server/pfs/pretty/pretty.go 28.57% 5 Missing ⚠️
src/server/pfs/s3/multipart.go 0.00% 4 Missing ⚠️
src/pfs/pfs.go 91.17% 3 Missing ⚠️
src/server/pfs/cmds/cmds.go 0.00% 3 Missing ⚠️
src/internal/pfssync/cache_client.go 60.00% 2 Missing ⚠️
src/internal/pfsload/client.go 66.66% 1 Missing ⚠️
src/server/pfs/fuse/loopback.go 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9944      +/-   ##
==========================================
- Coverage   58.35%   58.25%   -0.10%     
==========================================
  Files         614      614              
  Lines       75607    75675      +68     
==========================================
- Hits        44117    44086      -31     
- Misses      30935    31031      +96     
- Partials      555      558       +3     

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

@FahadBSyed FahadBSyed requested review from FahadBSyed and removed request for brendoncarroll April 24, 2024 14:40
Copy link
Contributor

@FahadBSyed FahadBSyed left a comment

Choose a reason for hiding this comment

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

I think the only message type that is left to handle is FindCommitsResponse

Copy link
Contributor

@smalyala smalyala left a comment

Choose a reason for hiding this comment

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

Changes to python sdk test files look good

Copy link
Member

@jrockway jrockway left a comment

Choose a reason for hiding this comment

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

Looks good. It would be nice if this could be done as a validation rule, so that we can start validating other outputs. It would also be good to do a pass and see which code emits nil branches, and stop them from doing that. A dpanic in the interceptor when this happens would make that easy.

return nil, err
}
if b, ok := resp.(branchNillable); ok {
b.NilBranch()
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice if a non-nil branch logged at level dpanic instead. This would make tests that return non-nil branches fail, and we could fix everything at the source.

It would also be nice if we called ValidateAll on the way out, and implemented the nil branch requirement through validation rules. (Validation failure on output should just be a log.DPanic.)

var b1 = &Branch{Name: "dummy"}
var c1 = &Commit{Branch: b1}
c1.NilBranch()
require.Nil(t, c1.Branch)
Copy link
Member

Choose a reason for hiding this comment

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

A better test would require.NoDiff with an expected branch. This way you can be sure that NilBranch() doesn't also delete the Name field.

Copy link
Contributor

@FahadBSyed FahadBSyed left a comment

Choose a reason for hiding this comment

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

The code changes look good to me.
You just need to fix the merge conflict on the MODULE.bazel.lock file.
@jrockway made some good points, I think they can be addressed in a follow-up PR.

@Zhang-Muyang
Copy link
Contributor Author

The code changes look good to me.
You just need to fix the merge conflict on the MODULE.bazel.lock file.
@jrockway made some good points, I think they can be addressed in a follow-up PR.

Ah, these commit were efforts trying to rebase... But it turns out didn't solve the conflict. I'll try again to resolve the conflict.

Copy link
Contributor

@FahadBSyed FahadBSyed left a comment

Choose a reason for hiding this comment

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

lgtm

@Zhang-Muyang Zhang-Muyang force-pushed the muyang/PFS-227-nilEntireBranch branch 2 times, most recently from fbdb813 to 83c64c8 Compare May 1, 2024 19:55
@Zhang-Muyang Zhang-Muyang force-pushed the muyang/PFS-227-nilEntireBranch branch from 83c64c8 to 766c55e Compare May 1, 2024 19:56
@Zhang-Muyang Zhang-Muyang merged commit 933aac0 into master May 2, 2024
21 checks passed
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.

None yet

4 participants