-
Notifications
You must be signed in to change notification settings - Fork 1
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
tickets/DM-46480: adopt shared rubin-nublado-client #374
Conversation
8cf7a40
to
229a031
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main architectural questions are:
- Would it be cleaner to keep a nublado support in mobu, whose only job is to wrap the extracted nublado client's methods and do the exception transormations, instead of doing those at each call site? Would that even be possible?
- Is there any way to extract out the common stuff we're doing in all of the wrapped exceptions, like adding annotations and mobu fields, somehow so we don't have to repeat the same logic in every wrapped exception?
self.mobu_init(monkey=monkey, event=event) | ||
|
||
@classmethod | ||
def from_client_exception( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this isn't used in any calling code, can it just be smooshed into from_exception
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDK. In most cases, from_exception() is how the base class turns its parent exception into the NubladoClientException. We'd be changing the call signature if we made it an override.
My tendency is to pick a different name, but maybe I'm wrong about that? I feel like it's a kind of useful distinction between "this is already a NubladoClientSlackException" (or SlackWeb) and therefore mostly-tame already, versus "naw, dawg, this is turning anything into one of our own exceptions".
"description": ANY, | ||
"reference": ANY, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we lose the ability to test specific descriptions and references here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and elsewhere in these tests)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it wasn't clear to me that we would want to set them directly or use the ones from the NubladoClient testing suite, and there they are not exposed well. I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing here is, they're a magic constant (like "w_2077_43") that doesn't appear in any of the mobu code, because it's just being pulled in from the client testing code, and if the client testing code wants to change them (although, why would it?) then why should mobu break.
Maybe I should be exposing it in the client testing layer? But that feels weird too because it's basically just a test fixture.
The right way to address the architectural concerns (and this is something I talked about a little with @rra ) is ultimately to turn almost all of these exception fields into annotations. That will weaken the typing a little, but will make composing exceptions a whole lot easier. It's a little subtle, in that we want to maintain the one-column vs two-column distinctions (that is, blocks versus fields) and large amounts of data will need to be packaged as attachments, and that (or something near there) is not documented in the Slack API...and then all of that really needs to be in Safir, neither in Mobu nor in NubladoClient. But that's going to be a lot of work, so what I want to do in the immediate term is to land splitting out the NubladoClient into the Nublado monorepo, and adopting it into ghostwriter, mobu, and noteburst. In addition to being a lot of work, the annotation-based Safir rewrite is work we should not undertake without Jonathan, who will have strong opinions about how Safir ought to work, so we really can't tackle it until 2025 when he's back. |
Uh. Trying to think through this. Because the stuff we're adding isn't part of the client...buuuut if it ALSO took a CodeContext on each call, or updated a CodeContext object that DID live on the client....anyway, let's see. |
I guess it's the moral equivalent of _convert_exception() in the Nublado Client. Hm. I still don't see how we would get away from updating each exception individually, though, because monkey and event depend on something that definitely isn't a client property. There probably is some much more clever way to do it, but I think I'm going to put that off until we do the proper refactoring of the Safir base Slack exception class. |
Waaaaait why am I logged in as sqreadmin? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more typo, but yeah, I guess we can put off a refactor until we do the bigger refactor
Co-authored-by: Dan Fuchs <[email protected]>
Rather than use internal client, use the shared client from the
nublado
repo.This is currently dependent on DM-46480 branch of nublado, and will be changed once that work is merged and released.