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

Fix incorrect type check. #203

Merged

Conversation

chrisstaite-menlo
Copy link
Collaborator

@chrisstaite-menlo chrisstaite-menlo commented Jul 18, 2023

When re-factoring the GrpcScheduler change, a dodgy copy-paste made it in. Fix up the type check to the correct type.


This change is Reviewable

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.

Can you write a simple test for this too?

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @chrisstaite-menlo)

@chrisstaite-menlo
Copy link
Collaborator Author

Yes, and it turns out there's a bug in action_name too...

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.

Reviewed 1 of 2 files at r2.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on @chrisstaite-menlo)


cas/scheduler/action_messages.rs line 75 at r2 (raw file):

    pub fn action_name(&self) -> String {
        format!(
            "{}/{}-{}/{:X}",

🤦 I thought .str() encoded size_bytes. I think this should be renamed: .hash_str() to remove confusion.

When re-factoring the GrpcScheduler change, a dodgy copy-paste
made it in.  Fix up the type check to the correct type.

Also fixes an issue in the action_name() implementation that was
detected when writing a test.  The size is not encoded but is
expected for decoding.
Copy link
Collaborator Author

@chrisstaite-menlo chrisstaite-menlo 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: 1 of 12 files reviewed, 1 unresolved discussion (waiting on @allada)


cas/scheduler/action_messages.rs line 75 at r2 (raw file):

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

🤦 I thought .str() encoded size_bytes. I think this should be renamed: .hash_str() to remove confusion.

That function is used in a lot of places! Funny how this simple one string change turned into a 91 line 12 file diff.

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.

Reviewed 11 of 11 files at r4.
Reviewable status: all files reviewed (commit messages unreviewed), 4 unresolved discussions (waiting on @chrisstaite-menlo)


cas/scheduler/action_messages.rs line 780 at r2 (raw file):

}

fn from_any<T>(message: &Any) -> Result<T, Error>

clever! 💯


cas/scheduler/action_messages.rs line 840 at r2 (raw file):

        };

        println!("Operation name: {}", operation.name);

nit: debug artifact.


cas/scheduler/action_messages.rs line 899 at r2 (raw file):

        Self {
            name: val.unique_qualifier.action_name(),
            metadata: Some(to_any(&metadata)),

nit: Here (and above) Don't we need to deal with the result of to_any()? I'm kinda confused on how this is compiling.

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.

Reviewed all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @chrisstaite-menlo)

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.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @chrisstaite-menlo)

Copy link
Collaborator Author

@chrisstaite-menlo chrisstaite-menlo 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: all files reviewed, 3 unresolved discussions (waiting on @allada)


cas/scheduler/action_messages.rs line 780 at r2 (raw file):

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

clever! 💯

Can't claim the credit here, all from tokio-rs/prost#299....


cas/scheduler/action_messages.rs line 840 at r2 (raw file):

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

nit: debug artifact.

Yeah, already gone.


cas/scheduler/action_messages.rs line 899 at r2 (raw file):

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

nit: Here (and above) Don't we need to deal with the result of to_any()? I'm kinda confused on how this is compiling.

to_any can't fail... only from_any can.

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.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @chrisstaite-menlo)


cas/scheduler/action_messages.rs line 899 at r2 (raw file):

Previously, chrisstaite-menlo (Chris Staite) wrote…

to_any can't fail... only from_any can.

aaah, need more coffee.

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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @chrisstaite-menlo)

@chrisstaite-menlo chrisstaite-menlo merged commit a22e437 into TraceMachina:master Jul 18, 2023
@chrisstaite-menlo chrisstaite-menlo deleted the fix_incorrect_check branch July 18, 2023 16:42
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