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

Remove various IUOs, force unwraps, and force casts #89

Merged
merged 12 commits into from
Aug 17, 2023

Conversation

mokagio
Copy link
Contributor

@mokagio mokagio commented Aug 17, 2023

In most instances, the code was safe enough to ensure these maneuvers would never crash. Still, not having them in the first place makes the code even safer 🤓

I recommend reviewing commit by commit.

Comment on lines -27 to -30
func testEndpoint() {
let endpoint = RequestBuilder.buildPixelEndpoint()
XCTAssert(endpoint != "", "buildPixelEndpoint should return a non-empty string")
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test was redundant given the next one performed a more accurate check that implied non-emptyness.

Comment on lines -33 to -38
var expected: String = "https://p1.parsely.com/mobileproxy"
var actual = RequestBuilder.buildPixelEndpoint()
XCTAssert(actual == expected, "buildPixelEndpoint should return the correct URL for the given date")
expected = "https://p1.parsely.com/mobileproxy"
actual = RequestBuilder.buildPixelEndpoint()
XCTAssert(actual == expected, "buildPixelEndpoint should return the correct URL for the given date")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I could see, these were duplicated checks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Our pixel server used to have today's date in the hostname. I think the multiple checks should have been removed when we made it a static hostname.

@mokagio mokagio changed the title Remove optionality from Accumulator eventArgs, default to [:] Remove various IUOs, force unwraps, and force casts Aug 17, 2023
@mokagio mokagio marked this pull request as ready for review August 17, 2023 06:38
@mokagio mokagio enabled auto-merge August 17, 2023 06:38
Copy link
Contributor

@cwisecarver cwisecarver left a comment

Choose a reason for hiding this comment

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

Thanks for cleaning this up!

Comment on lines -33 to -38
var expected: String = "https://p1.parsely.com/mobileproxy"
var actual = RequestBuilder.buildPixelEndpoint()
XCTAssert(actual == expected, "buildPixelEndpoint should return the correct URL for the given date")
expected = "https://p1.parsely.com/mobileproxy"
actual = RequestBuilder.buildPixelEndpoint()
XCTAssert(actual == expected, "buildPixelEndpoint should return the correct URL for the given date")
Copy link
Contributor

Choose a reason for hiding this comment

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

Our pixel server used to have today's date in the hostname. I think the multiple checks should have been removed when we made it a static hostname.

urlref: urlref,
metadata: metadata,
extra_data: extra_data,
// empty string seems a weird default, but is what we had in the code before this comment was written
Copy link
Contributor

Choose a reason for hiding this comment

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

The idsite aka apikey is the primary identifier of which customer traffic is coming from. It's normally their domain, eg arstechnica.com. Making it default to blank means that any pixels coming from a misconfigured SDK will be filtered out of our pipeline very early in the process so that we don't waste CPU and storage with bad data.

@mokagio mokagio merged commit b1db4b0 into master Aug 17, 2023
@mokagio mokagio deleted the mokagio/remove-more-iuo branch August 17, 2023 17:42
@crazytonyli crazytonyli mentioned this pull request Jan 28, 2024
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