Skip to content

Conversation

@yim-lee
Copy link
Member

@yim-lee yim-lee commented Jul 21, 2022

Resolves #932

@yim-lee yim-lee requested a review from ktoso July 21, 2022 04:09
case .all: // compiler gets confused if this is grouped together with above
reply = .init(callID: callID, error: codableError)
default:
reply = .init(callID: callID, error: GenericRemoteCallError(message: "Remote call error of [\(type(of: error as Any))] type occurred"))
Copy link
Member

Choose a reason for hiding this comment

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

does this emit a warning? May have to be any Any? (not sure, just asking)

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't noticed any. Will double check.

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't see any. 👌

Copy link
Member

Choose a reason for hiding this comment

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

Ok cool! Learning the new rules about spelling types myself still huh

import DistributedActorsTestKit
import XCTest

final class RemoteCallTests: ClusteredActorSystemsXCTestCase {
Copy link
Member

Choose a reason for hiding this comment

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

nice to move here 👍

guard error is GenericRemoteCallError else {
throw TestError("Expected GenericRemoteCallError, got \(error)")
}
}
Copy link
Member

Choose a reason for hiding this comment

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

can we add another test when we allow-listed an error, but did not register it?

Copy link
Member Author

@yim-lee yim-lee Jul 21, 2022

Choose a reason for hiding this comment

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

In that case we'd get a timeout error IIRC. What's the expected behavior? I guess it should return a serialization error -> generic error.

Copy link
Member Author

@yim-lee yim-lee Jul 21, 2022

Choose a reason for hiding this comment

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

We get timeout error because we fail to deserialize AnyRemoteCallReply (TransportPipelines.swift L641) so we can't even call back.

Copy link
Member Author

Choose a reason for hiding this comment

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

amended b73914d

let remote = await setUpNode("remote") { settings in
settings.remoteCall.codableErrorAllowance = .custom([AnotherGreeterCodableError.self])
settings.serialization.registerInbound(GreeterCodableError.self)
settings.serialization.registerInbound(AnotherGreeterCodableError.self)
Copy link
Member

Choose a reason for hiding this comment

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

Hm I'm wondering if this is too annoying... we have to allow list types, that's for sure... and serializers as well... Hm, for now this is okey, maybe some sugar in the future "register trusted error type"?

Copy link
Member Author

@yim-lee yim-lee Jul 21, 2022

Choose a reason for hiding this comment

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

Maybe I still don't get the directions right, but for me it's confusing in that I don't know on which node I need to set the allow list and register types (or maybe there should be registerInbound and registerOutbound?). I feel like I should only need to do these on the responding node.

Hm, for now this is okey, maybe some sugar in the future "register trusted error type"?

We can probably make ClusterSystemSettings smarter and have it automatically register the allowed types?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, how come GenericRemoteCallError doesn't need to be registered?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I agree this is confusing, I'll have a look

Copy link
Member

Choose a reason for hiding this comment

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

Follow up ticket #1024

Copy link
Member

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

LGTM, one potential follow up and extra test but looks good 👍

@ktoso
Copy link
Member

ktoso commented Jul 21, 2022

Would you be up to writing a small docs section about those as well actually?

It'd be in Clustering.md at the end of the file, a new section probably explaining those options and how they work a little

@yim-lee
Copy link
Member Author

yim-lee commented Jul 21, 2022

Would you be up to writing a small docs section about those as well actually?

Sure. I will update the docs in this PR as well.

@ktoso ktoso merged commit 31e4247 into apple:main Jul 25, 2022
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.

Make remote call error handling configurable

2 participants