-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: switch to latest release a2 library #362
Conversation
* This switches from our semi-vendored a2, back to the official release. This should also clear the warning about the included `nom` library. *Breaking Change* This removes the unused `.aps` field from the router_data options. This field was only used during testing. That test was also removed.
* note the reason we can't update tungstenite properly
We've identified some missing parts of Mark's original a2 branch that didn't get merged to a2 master likely due to merge conflicts. E.g. in this PR the Client::certificate_parts in here wasn't added. So we should double check that all of Mark's original branch made it into a2 before moving off of it. |
No worries, @jrconlin! Thanks. 👍🏻 |
I compared the current version of mozilla-services/a2 against Mark's PR and looks like the only thing missing was the Once that PR lands, I'll redo this PR to include the new 0.8.0 version, and then submit a PR to |
Switched to using our Part of the delay was trying to debug the way that code wants to read in key/cert from the environment. I couldn't get the escape quite right. I would frequently get a Private Key error in the cert. Passing
worked, even with the same values, so guessing all the coding/recording might have changed a value. |
Maybe that's more of a shell problem, assuming you're running with I just tried running it surrounded in single quotes instead (preserving everything inside) and it worked as I'd expect (on master):
|
Oh, it's absolutely a vscode problem, and I was being stubborn. < rant > {
"type": "lldb",
… ,
"cwd": "${workspaceFolder}",
"env": {
"RUST_LOG": "autopush=DEBUG,autoconnect=DEBUG,autopush_common=DEBUG,autoendpoint=DEBUG,warn",
"AUTOEND__PORT": "9160",
//"AUTOEND__BIND_HOST": "0.0.0.0",
"AUTOEND__HUMAN_LOGS": "1",
"AUTOEND__CRYPTO_KEYS": "[…]",
"AUTOEND__APNS__CHANNELS": "{\"dev\":{\"cert\":\"-----BEGIN CERTIFICATE-----\\n…=\\n-----END CERTIFICATE-----\", \"key\": \"-----BEGIN PRIVATE KEY-----\\n…----END PRIVATE KEY-----\"}}",
}
}, So yeah, LOTS of opportunities to screw things up, because control characters in JSON strings are big no-nos. |
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.
Couple things:
- I forgot what we concluded when we last discussed this, but is there a way to add a test that ensures we fixed the panic? Can we just shoot a message to
Endpoint::Sandbox
? - probably want to rename the branch to
feat/
at this point
autoendpoint/Cargo.toml
Outdated
# The version of a2 at the time of the fork is v0.5.3. | ||
a2 = { git = "https://github.com/mozilla-services/a2.git", branch = "autoendpoint" } | ||
# several of these libraries are pinned due to https://github.com/mozilla-services/autopush-rs/issues/249 | ||
a2 = {version = "0.8", git = "https://github.com/mozilla-services/a2"} |
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.
We should probably pin this to a specific revision (even though we own this repo) -- actually, upstream quickly merged your pr 🎉 so let's pin to their repo instead.
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.
?? reown-com/a2#72 is still pending review.
I'll pin to a specific commit, but will still keep the version, since I ought to do a release.
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 fault I must have been looking at the wrong repo
@@ -251,15 +302,13 @@ impl Router for ApnsRouter { | |||
.get("rel_channel") | |||
.and_then(Value::as_str) | |||
.ok_or(ApnsError::NoReleaseChannel)?; | |||
// XXX: We don't really use anything that is a numeric here, aside from |
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.
Not really an XXX: (broken/fixmeish) comment IMO
// XXX: We don't really use anything that is a numeric here, aside from | |
// NOTE: We don't really use anything that is a numeric here, aside from |
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.
Actually... It is a FIXME, specifically the third line:
// Once we're off of DynamoDB, we might want to kill the map.
That's a note to future us that we probably want to recheck if we need to do this, right?
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.
Ah, could do FIXME but XXX works
.collect(), | ||
device_token: token, | ||
options: NotificationOptions { | ||
let mut aps = Self::default_aps(); |
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.
Sorry, I probably missed some this the last time I reviewed it (is James back from PTO yet, can we just kill all this? 😄 ) -- looking at it now, I think we can at least move this large chunk into its own method, I've taken a shot at that on this branch.
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.
I mean, sure? It's still a big ugly pile of code regardless of if we want to screw with the stack or not. Tossing it into a different function doesn't really help, and IDEs allow for block collapse if we just want to ignore it for now.
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.
It's just too many lines for one method, this block is > 100 by itself (clippy's pedantic too_many_lines
lint is that). I assumed it was in here due to lifetime trickyness, hence my branch to solve that w/ the new method. I wouldn't justify e.g. an even larger say 500 line method either with IDE collapsing help -- so I'll argue this does help readability.
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.
Yeah, fair. I broke it out into it's own function like you suggested. (changed the name and gave it a better comment) I was debating how much of that I could reduce using macros, but I figured that was more work for what was (hopefully) a temporary thing.
@@ -45,7 +45,7 @@ tokio.workspace = true | |||
url.workspace = true | |||
uuid.workspace = true | |||
|
|||
a2 = {version = "0.8", git = "https://github.com/mozilla-services/a2"} | |||
a2 = {version = "0.8", git = "https://github.com/mozilla-services/a2", branch="master"} |
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.
I was thinking more of a specific sha (thinking of reproducable builds) but then again we weren't doing this before by pointing to the autoendpoint branch, so never mind I guess.
This should also clear the warning about the included
nom
library.Breaking Change
This removes the unused
.aps
field from the router_data options. Thisfield was only used during testing. That test was also removed.