Skip to content

fix: fixes unathorized response from provider API#1438

Merged
stalniy merged 1 commit intomainfrom
fix/providers-order
Jun 6, 2025
Merged

fix: fixes unathorized response from provider API#1438
stalniy merged 1 commit intomainfrom
fix/providers-order

Conversation

@stalniy
Copy link
Contributor

@stalniy stalniy commented Jun 6, 2025

Why

Provider API returns 401 for sendManifest command because certificate is not included in the request

Summary by CodeRabbit

  • Refactor
    • Adjusted the placement of certain context providers to improve the structure of the application. This change does not affect user-facing features or functionality.

@stalniy stalniy requested a review from a team as a code owner June 6, 2025 14:00
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 6, 2025

Walkthrough

The _app.tsx file was updated to change the placement of the CertificateProvider and BackgroundTaskProvider context providers. These providers now wrap only the main page component within the App component, instead of wrapping the entire application through AppRoot. No other logic or public API changes were made.

Changes

File(s) Change Summary
apps/deploy-web/src/pages/_app.tsx Moved CertificateProvider and BackgroundTaskProvider from wrapping AppRoot to wrapping the main page component.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant UserProviders
    participant WalletProvider
    participant CertificateProvider
    participant BackgroundTaskProvider
    participant Component (Page)
    participant AppRoot
    participant LocalNoteProvider

    App ->> UserProviders: Render
    UserProviders ->> WalletProvider: Render
    WalletProvider ->> AppRoot: Render
    AppRoot ->> LocalNoteProvider: Render (wraps children)
    LocalNoteProvider ->> CertificateProvider: Render (now outside AppRoot)
    CertificateProvider ->> BackgroundTaskProvider: Render
    BackgroundTaskProvider ->> Component (Page): Render
Loading

Poem

In the warren of code, providers hop,
Shuffling their spots from bottom to top.
No logic disturbed, just a gentle rearrange,
Contexts now closer, a subtle change.
The rabbit approves with a happy thump,
For tidy providers make code jump! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-06T14_02_03_914Z-debug-0.log


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a30636b and ea4c39f.

📒 Files selected for processing (1)
  • apps/deploy-web/src/pages/_app.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: validate-deploy-web
  • GitHub Check: test-deploy-web-build
🔇 Additional comments (2)
apps/deploy-web/src/pages/_app.tsx (2)

78-82: Excellent architectural improvement for certificate context placement.

Moving CertificateProvider and BackgroundTaskProvider to wrap only the main component within UserProviders and WalletProvider is a smart change that:

  1. Provides proper context dependency order: Certificate operations now have access to user and wallet context, which is likely needed for authentication
  2. Reduces unnecessary context scope: Components like Loading and GoogleAnalytics don't need certificate access
  3. Aligns with the PR objective: Ensures certificates are available where API calls are made (main app components)

This change should resolve the 401 Unauthorized issues by ensuring certificate context is properly initialized with user/wallet dependencies.


112-112: Context hierarchy change verified.

The LocalNoteProvider is no longer wrapped by CertificateProvider and BackgroundTaskProvider, which means local note functionality won't have direct access to certificate context. This appears intentional and correct since local notes likely don't require certificate-based authentication.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 38.36%. Comparing base (a30636b) to head (ea4c39f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1438   +/-   ##
=======================================
  Coverage   38.35%   38.36%           
=======================================
  Files         849      849           
  Lines       20141    20141           
  Branches     3654     3668   +14     
=======================================
+ Hits         7726     7727    +1     
+ Misses      11691    11690    -1     
  Partials      724      724           
Flag Coverage Δ *Carryforward flag
api 70.33% <ø> (ø) Carriedforward from a30636b
deploy-web 16.50% <ø> (+<0.01%) ⬆️
notifications 88.94% <ø> (ø) Carriedforward from a30636b
provider-proxy 80.09% <ø> (ø) Carriedforward from a30636b

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
apps/deploy-web/src/pages/_app.tsx 0.00% <ø> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stalniy stalniy enabled auto-merge (squash) June 6, 2025 14:07
@stalniy stalniy merged commit 959eae7 into main Jun 6, 2025
27 checks passed
@stalniy stalniy deleted the fix/providers-order branch June 6, 2025 14:08
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

Comments