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

[ads] Send page land immediately for non-successful HTTP status codes #26404

Merged
merged 6 commits into from
Nov 7, 2024

Conversation

tmancey
Copy link
Collaborator

@tmancey tmancey commented Nov 6, 2024

Resolves brave/brave-browser#42137

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

For landing pages (site visits) returning HTTP status codes in the 4xx and 5xx ranges, redeem a landed confirmation token for Rewards users immediately without a 5-second delay. For status codes in the 2xx and 3xx ranges, apply a 5-second delay before redeeming the confirmation token.

@tmancey tmancey self-assigned this Nov 6, 2024
@tmancey tmancey requested a review from a team as a code owner November 6, 2024 19:33
@tmancey tmancey force-pushed the issues/42137 branch 2 times, most recently from 17b2af8 to 6ba8a78 Compare November 6, 2024 19:36
Copy link
Collaborator

@aseren aseren left a comment

Choose a reason for hiding this comment

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

LGTM

@tmancey tmancey force-pushed the issues/42137 branch 7 times, most recently from 02d2a2c to af8e826 Compare November 7, 2024 14:54
Copy link
Contributor

github-actions bot commented Nov 7, 2024

[puLL-Merge] - brave/brave-core@26404

Description

This pull request makes several improvements and fixes to the Brave Ads codebase. The changes primarily focus on error handling, code cleanup, and improving the site visit functionality.

Changes

Changes

  1. browser/brave_ads/device_id/device_id_impl_unittest.cc:

    • Fixed typo in struct name from "DisallwedMask" to "DisallowedMask".
  2. browser/brave_ads/tabs/ads_tab_helper_browsertest.cc:

    • Removed unused include of "base/memory/raw_ptr.h".
    • Changed NOTREACHED_NORETURN() to NOTREACHED().
  3. components/brave_ads/browser/ads_service_impl.cc:

    • Changed NOTREACHED_NORETURN() to NOTREACHED().
  4. components/brave_ads/browser/reminder/reminder_util.cc:

    • Changed NOTREACHED_NORETURN() to NOTREACHED().
  5. components/brave_ads/core/internal/common/net/http/http_status_code_util.cc:

    • Added IsSuccessfulHttpStatusCode() function.
  6. components/brave_ads/core/internal/user_engagement/site_visit/site_visit.cc:

    • Improved logic for handling page landing based on HTTP status codes.
    • Added check for successful HTTP status code before landing on a page.
  7. components/brave_ads/core/internal/user_engagement/site_visit/site_visit_unittest.cc:

    • Updated tests to include HTTP status codes in simulations.
    • Added new tests for different HTTP status code scenarios.
  8. Various files:

    • Changed NOTREACHED_NORETURN() to NOTREACHED() in multiple locations.
    • Removed unused includes of "base/memory/raw_ptr.h".
    • Added net/http/http_status_code.h include where needed.

Possible Issues

  • The changes to error handling (replacing NOTREACHED_NORETURN() with NOTREACHED()) might affect how certain error conditions are handled in production. Careful testing should be done to ensure this doesn't introduce any unexpected behavior.

Security Hotspots

None identified. The changes appear to be mostly cleanup and improvements to existing functionality without introducing new security risks.

@tmancey tmancey merged commit 1eed8d5 into master Nov 7, 2024
17 checks passed
@tmancey tmancey deleted the issues/42137 branch November 7, 2024 22:32
@github-actions github-actions bot added this to the 1.75.x - Nightly milestone Nov 7, 2024
@brave-builds
Copy link
Collaborator

Released in v1.75.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ads] Send page land immediately for non-successful HTTP status codes
3 participants