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

Allow empty page_token for get_tree #1340

Merged
merged 1 commit into from
Sep 9, 2024
Merged

Allow empty page_token for get_tree #1340

merged 1 commit into from
Sep 9, 2024

Conversation

amonshiz
Copy link
Contributor

@amonshiz amonshiz commented Sep 9, 2024

Description

Fixes issue #1339

The RemoteExecution v2 API GetTreeRequest does not require that the page_token value be a non-empty string (or exist) only that it should only exist when the client wants the resume/offset the response based on a prior GetTreeResponse.next_page_token. The original implementation of the get_tree functionality (#905) requires that there always be a value in the page_token field.

The reference implementation in buildfarm treats an empty page_token as an initial request which seems entirely reasonable.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Added new unit tests.

Follow details in #1339 but run a local build of NativeLink using the changes in this PR and verify that the downloaded content exactly matches the uploaded content and there were no errors or warnings from NativeLink.

Checklist

  • Tests added/amended
  • bazel test //... passes locally
  • PR is contained in a single commit, using git amend see some docs

This change is Reviewable

@CLAassistant
Copy link

CLAassistant commented Sep 9, 2024

CLA assistant check
All committers have signed the CLA.

@amonshiz amonshiz changed the title Allow empty page_token for getTree Allow empty page_token for get_tree Sep 9, 2024
Copy link
Member

@allada allada left a comment

Choose a reason for hiding this comment

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

Awesome, thank you very much. Looks good just a few minor comments (not related to primary code, just test hygiene). 😃

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: 0 of 2 LGTMs obtained, and all files reviewed, and pending CI: license/cla, and 3 discussions need to be resolved


nativelink-service/tests/cas_server_test.rs line 388 at r1 (raw file):

    // First verify that using an empty page token is treated as if the client had sent the root
    // digest.
    let raw_response = cas_server

nit: Can we put all this new code tabbed in one and scoped inside { /* your code here */ }?

I like to do this for readability to know what code is related to what scope, especially for tests.

(might be good to scope the remaining code now too.


nativelink-service/tests/cas_server_test.rs line 397 at r1 (raw file):

        }))
        .await;
    assert!(raw_response.is_ok());

nit: You don't need this, since assert is just a panic and the below .unwrap() will panic anyway if it's not ok.


nativelink-service/tests/cas_server_test.rs line 471 at r1 (raw file):

    // First, verify that an empty initial page token is treated as if the client had sent the
    // root digest and respects the page size.
    let raw_response = cas_server

ditto about scoping.

Copy link
Contributor Author

@amonshiz amonshiz left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 LGTMs obtained, and 1 of 2 files reviewed, and pending CI: Bazel Dev / ubuntu-22.04, Cargo Dev / macos-13, Cargo Dev / ubuntu-22.04, Installation / macos-13, Installation / macos-14, Installation / ubuntu-22.04, Local / ubuntu-22.04, Publish image, Publish nativelink-worker-init, Publish nativelink-worker-lre-cc, Remote / large-ubuntu-22.04, docker-compose-compiles-nativelink (22.04), macos-13, ubuntu-20.04 / stable, ubuntu-22.04 / stable, windows-2022 / stable, and 1 discussions need to be resolved


nativelink-service/tests/cas_server_test.rs line 471 at r1 (raw file):

Previously, allada (Nathan (Blaise) Bruer) wrote…

ditto about scoping.

Done.

Copy link
Member

@allada allada left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 1 of 2 LGTMs obtained, and 1 of 2 files reviewed

Copy link
Member

@allada allada left a comment

Choose a reason for hiding this comment

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

+@adam-singer or +@aaronmondal for second approval

Reviewable status: 0 of 2 LGTMs obtained, and 1 of 2 files reviewed (waiting on @aaronmondal and @adam-singer)

Copy link
Contributor

@adam-singer adam-singer left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: 1 of 2 LGTMs obtained, and all files reviewed (waiting on @aaronmondal)

Copy link
Member

@allada allada left a comment

Choose a reason for hiding this comment

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

-@aaronmondal

Reviewable status: :shipit: complete! 2 of 2 LGTMs obtained, and all files reviewed

@allada allada merged commit d66d418 into TraceMachina:main Sep 9, 2024
28 checks passed
@amonshiz amonshiz deleted the amonshiz/empty-initial-page-token branch September 9, 2024 17:04
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.

5 participants