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

Dev 4362 Break through loading state, even if privacy plugin blocks events #64

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

BraunreutherA
Copy link
Contributor

When the Ninetailed Privacy Plugin is configured to block any event, the loading state of the Ninetailed Provider will never get set to true.
The Default Loading Component in React works around this problem, by falling back to the baseline after a certain time.

This PR sends a PROFILE_CHANGE event, when the request got blocked with the cached fallback profile state or a error state, if no cached fallback is available.

The PR is currently in draft as we should discuss the implementation and maybe go for a bigger change and create new states of the profile in the SDK.

Copy link

qodo-merge-pro bot commented Sep 10, 2024

CI Failure Feedback 🧐

(Checks updated until commit 247f6c8)

Action: Build 📦

Failed stage: Build 📦 [❌]

Failed test name: plugins-insights:build

Failure summary:

The action failed due to a TypeScript type error during the build process of the plugins-insights
package:

  • The error occurred in the file NinetailedInsightsPlugin.ts at line 146.
  • The argument previousProfile passed to the function createEventsBatch was of a type that included
    undefined.
  • TypeScript reported that undefined is not assignable to the expected parameter type, which does not
    allow undefined.
  • As a result, the build process for plugins-insights failed, causing the overall action to fail.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    604:  changes and commit them, and you can discard any commits you make in this
    605:  state without impacting any branches by switching back to a branch.
    606:  If you want to create a new branch to retain commits you create, you may
    607:  do so (now or later) by using -c with the switch command. Example:
    608:  git switch -c <new-branch-name>
    609:  Or undo this operation with:
    610:  git switch -
    611:  Turn off this advice by setting config variable advice.detachedHead to false
    612:  HEAD is now at 247f6c8 WIP: break loading by handling abort as error
    ...
    
    641:  [command]/usr/bin/tar -xf /home/runner/work/_temp/5c704e88-3ef0-4bdd-9b41-56e2cda5d2c6/cache.tzst -P -C /home/runner/work/experience.js/experience.js --use-compress-program unzstd
    642:  Received 412801618 of 412801618 (100.0%), 196.7 MBs/sec
    643:  Cache restored successfully
    644:  Cache restored from key: Linux-node-modules-yarn-c3f1d1144619d2e920e20f3f2da854d0e90a3b6c4e02a5b6e3c9bf6d54d61320
    645:  ##[group]Run nrwl/nx-set-shas@v3
    646:  with:
    647:  main-branch-name: main
    648:  set-environment-variables-for-job: true
    649:  error-on-no-successful-workflow: false
    650:  last-successful-event: push
    651:  working-directory: .
    652:  ##[endgroup]
    653:  ##[group]Run node "$GITHUB_ACTION_PATH/dist/index.js" "$gh_token" "$main_branch_name" "$error_on_no_successful_workflow" "$last_successful_event" "$working_directory" "$working_id"
    654:  �[36;1mnode "$GITHUB_ACTION_PATH/dist/index.js" "$gh_token" "$main_branch_name" "$error_on_no_successful_workflow" "$last_successful_event" "$working_directory" "$working_id"�[0m
    655:  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
    656:  env:
    657:  gh_token: ***
    658:  main_branch_name: main
    659:  error_on_no_successful_workflow: false
    ...
    
    780:  ⚡ Done in 7.79s
    781:  > nx run sdks-nextjs:build
    782:  Bundling sdks-nextjs...
    783:  index.cjs.js 4.623 KB
    784:  index.esm.js 2.945 KB
    785:  ⚡ Done in 9.15s
    786:  > nx run plugins-insights:build
    787:  Bundling plugins-insights...
    788:  Error during bundle: Error: �[96mpackages/plugins/insights/src/lib/NinetailedInsightsPlugin.ts�[0m:�[93m146�[0m:�[93m28�[0m - �[91merror�[0m�[90m TS2345: �[0mArgument of type '{ id: string; stableId: string; random: number; audiences: string[]; traits: JsonObject; location: { coordinates?: { latitude: number; longitude: number; } | undefined; city?: string | undefined; ... 6 more ...; timezone?: string | undefined; }; session: { ...; }; } | undefined' is not assignable to parameter of type '{ id: string; stableId: string; random: number; audiences: string[]; traits: JsonObject; location: { coordinates?: { latitude: number; longitude: number; } | undefined; city?: string | undefined; ... 6 more ...; timezone?: string | undefined; }; session: { ...; }; }'.
    789:  Type 'undefined' is not assignable to type '{ id: string; stableId: string; random: number; audiences: string[]; traits: JsonObject; location: { coordinates?: { latitude: number; longitude: number; } | undefined; city?: string | undefined; ... 6 more ...; timezone?: string | undefined; }; session: { ...; }; }'.
    790:  �[7m146�[0m     this.createEventsBatch(previousProfile);
    791:  �[7m   �[0m �[91m                           ~~~~~~~~~~~~~~~�[0m
    792:  Bundle failed: plugins-insights
    ...
    
    957:  │     (SSG) Generated at build time                                  │
    958:  │   D (DSG) Deferred static generation - page generated at runtime   │
    959:  │   ∞ (SSR) Server-side renders at runtime (uses getServerData)      │
    960:  │   λ (Function) Gatsby function                                     │
    961:  │                                                                    │
    962:  ╰────────────────────────────────────────────────────────────────────╯
    963:  info Done building in 63.79159309 sec
    964:  > nx run playgrounds-gatsby:build
    965:  >  NX   Running target build for 18 projects and 3 tasks they depend on failed
    966:  Tasks not run because their dependencies failed or --nx-bail=true:
    967:  - playgrounds-easy-hr:build:production
    968:  Failed tasks:
    969:  - plugins-insights:build
    970:  error Command failed with exit code 1.
    971:  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    972:  ##[error]Process completed with exit code 1.
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    @maroun9t maroun9t force-pushed the DEV-4362-privacy-plugin-break-loading-state branch from 247f6c8 to 9fe45a5 Compare October 16, 2024 09:04
    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.

    1 participant