Skip to content

feat: displays information about expired cert #1730

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

Merged
merged 1 commit into from
Jul 25, 2025
Merged

Conversation

stalniy
Copy link
Contributor

@stalniy stalniy commented Jul 24, 2025

Why

#1723

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced error messages for certificate and validation issues, providing clearer feedback in error notifications.
    • Added certificate expiration awareness with dynamic warning messages and button labels in certificate creation.
  • Bug Fixes

    • Improved checks for certificate presence before displaying deployment details, logs, and lease shell interfaces.
  • Refactor

    • Simplified and standardized dependency injection for certificate-related components, reducing reliance on context providers.
    • Centralized and streamlined initialization logic for network and message type configuration.
    • Updated hooks and components to use named parameter objects for improved clarity and flexibility.
    • Removed custom warning text props from certificate creation buttons for consistent UI behavior.
    • Improved error handling by reporting errors through a centralized service instead of console logs.
  • Tests

    • Updated test setups for certificate creation to use direct dependency injection, improving clarity and maintainability.
    • Refactored lease status hook tests to improve modularity and coverage for missing data scenarios.
  • Chores

    • Adjusted test query client defaults to prevent automatic retries and refetching during tests.

@stalniy stalniy requested a review from a team as a code owner July 24, 2025 10:08
Copy link

coderabbitai bot commented Jul 24, 2025

"""

Walkthrough

This change refactors the CreateCertificateButton component and its test suite to use direct dependency injection instead of context providers. It updates related components to remove the warningText prop and adjusts certificate-related conditional rendering. Supporting utility and initialization functions are modified to accept configuration parameters, and error handling is improved for manifest errors. The CertificateProvider context was enhanced with dependency injection, improved error handling, and certificate expiration awareness. The useLeaseStatus hook and its tests were refactored for dependency injection and improved handling of missing data.

Changes

File(s) Change Summary
CreateCertificateButton.tsx, CreateCertificateButton.spec.tsx Refactored to use dependency injection for UI elements and hooks; removed context providers and mocks in tests.
DeploymentDetail.tsx, DeploymentLeaseShell.tsx, DeploymentLogs.tsx, ManifestUpdate.tsx Updated usage of CreateCertificateButton to remove warningText prop; adjusted rendering logic for certificates.
ManifestErrorSnackbar.tsx Enhanced error message handling with detailed mapping and certificate-specific messages.
SettingsProviderContext.tsx Switched network store access to use a hook; initialization now uses selected network properties.
useLeaseQuery.ts, useLeaseQuery.spec.tsx Changed useLeaseStatus to accept a params object; added local certificate checks; enabled dependency injection; refactored tests with helper and added coverage for missing data.
http-browser.service.ts Registered networkStore as a service in the services container.
TransactionMessageData.ts, init.ts, proto/index.ts Refactored initialization and message type setup to accept configuration objects instead of direct store access.
TestContainerProvider.tsx Configured test QueryClient to disable retries and refetching in tests.
DeploymentListRow.tsx, LeaseRow.tsx Updated useLeaseStatus calls to use single object parameter instead of positional arguments.
CertificateProviderContext.tsx, index.ts Added dependency injection and error handling; exposed certificate expiration state; updated exports to include dependencies and types.

Sequence Diagram(s)

sequenceDiagram
    participant UI as User Interface
    participant CreateCertBtn as CreateCertificateButton
    participant CertHook as useCertificate (Injected)
    participant Spinner as Spinner (Injected)
    participant Alert as Alert (Injected)

    UI->>CreateCertBtn: Render with dependencies
    CreateCertBtn->>CertHook: Get certificate state (isCreatingCert, isLocalCertExpired, localCert)
    CreateCertBtn->>Alert: Show warning (if certificate missing or expired)
    UI->>CreateCertBtn: User clicks button
    CreateCertBtn->>CertHook: Call createCertificate()
    CertHook-->>CreateCertBtn: Certificate created/failed
    CreateCertBtn->>Spinner: Show/hide spinner as needed
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

Suggested reviewers

  • baktun14

Poem

A button reborn, with less to mock,
Dependencies passed in—no more context block!
Certificates checked, warnings now clear,
With errors mapped out, the message sincere.
The rabbit hops on, with code neat and tight,
Simpler tests and setup—oh what a delight! 🐇✨
"""

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-07-24T20_05_47_450Z-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 8cd9906 and 9153198.

📒 Files selected for processing (19)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx (1 hunks)
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx (1 hunks)
  • apps/deploy-web/src/components/deployments/DeploymentDetail.tsx (1 hunks)
  • apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/DeploymentListRow.tsx (1 hunks)
  • apps/deploy-web/src/components/deployments/DeploymentLogs.tsx (3 hunks)
  • apps/deploy-web/src/components/deployments/LeaseRow.tsx (1 hunks)
  • apps/deploy-web/src/components/deployments/ManifestUpdate.tsx (1 hunks)
  • apps/deploy-web/src/components/shared/ManifestErrorSnackbar.tsx (1 hunks)
  • apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx (7 hunks)
  • apps/deploy-web/src/context/CertificateProvider/index.ts (1 hunks)
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (3 hunks)
  • apps/deploy-web/src/queries/useLeaseQuery.spec.tsx (4 hunks)
  • apps/deploy-web/src/queries/useLeaseQuery.ts (1 hunks)
  • apps/deploy-web/src/services/http/http-browser.service.ts (2 hunks)
  • apps/deploy-web/src/utils/TransactionMessageData.ts (1 hunks)
  • apps/deploy-web/src/utils/init.ts (1 hunks)
  • apps/deploy-web/src/utils/proto/index.ts (2 hunks)
  • apps/deploy-web/tests/unit/TestContainerProvider.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • apps/deploy-web/src/components/deployments/DeploymentDetail.tsx
  • apps/deploy-web/src/services/http/http-browser.service.ts
🚧 Files skipped from review as they are similar to previous changes (17)
  • apps/deploy-web/src/components/deployments/DeploymentListRow.tsx
  • apps/deploy-web/src/components/deployments/LeaseRow.tsx
  • apps/deploy-web/src/components/deployments/ManifestUpdate.tsx
  • apps/deploy-web/src/components/deployments/DeploymentLeaseShell.tsx
  • apps/deploy-web/tests/unit/TestContainerProvider.tsx
  • apps/deploy-web/src/context/CertificateProvider/index.ts
  • apps/deploy-web/src/components/deployments/DeploymentLogs.tsx
  • apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx
  • apps/deploy-web/src/utils/proto/index.ts
  • apps/deploy-web/src/utils/TransactionMessageData.ts
  • apps/deploy-web/src/components/shared/ManifestErrorSnackbar.tsx
  • apps/deploy-web/src/utils/init.ts
  • apps/deploy-web/src/queries/useLeaseQuery.spec.tsx
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.spec.tsx
  • apps/deploy-web/src/queries/useLeaseQuery.ts
  • apps/deploy-web/src/components/deployments/CreateCertificateButton/CreateCertificateButton.tsx
  • apps/deploy-web/src/context/CertificateProvider/CertificateProviderContext.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/expired-cert

🪧 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 generate unit tests to generate unit tests for 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.

Copy link

codecov bot commented Jul 24, 2025

Codecov Report

Attention: Patch coverage is 41.37931% with 34 lines in your changes missing coverage. Please review.

Project coverage is 72.21%. Comparing base (e05506c) to head (9153198).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...CertificateProvider/CertificateProviderContext.tsx 22.22% 13 Missing and 1 partial ⚠️
...pps/deploy-web/src/utils/TransactionMessageData.ts 0.00% 10 Missing ⚠️
...ntext/SettingsProvider/SettingsProviderContext.tsx 33.33% 2 Missing ⚠️
...ploy-web/src/services/http/http-browser.service.ts 33.33% 2 Missing ⚠️
apps/deploy-web/src/utils/init.ts 33.33% 2 Missing ⚠️
apps/deploy-web/src/utils/proto/index.ts 0.00% 1 Missing and 1 partial ⚠️
...reateCertificateButton/CreateCertificateButton.tsx 90.90% 1 Missing ⚠️
apps/deploy-web/src/queries/useLeaseQuery.ts 85.71% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (41.37%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1730      +/-   ##
==========================================
- Coverage   72.65%   72.21%   -0.44%     
==========================================
  Files         611      606       -5     
  Lines       14381    14220     -161     
  Branches     2470     2464       -6     
==========================================
- Hits        10448    10269     -179     
+ Misses       3802     3720      -82     
- Partials      131      231     +100     
Flag Coverage Δ *Carryforward flag
api 80.13% <ø> (ø) Carriedforward from e05506c
deploy-web 56.85% <41.37%> (-0.72%) ⬇️
log-collector ?
notifications 87.25% <ø> (ø) Carriedforward from e05506c
provider-console 80.95% <ø> (ø) Carriedforward from e05506c
provider-proxy 84.35% <ø> (ø) Carriedforward from e05506c

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

Files with missing lines Coverage Δ
...eploy-web/src/context/CertificateProvider/index.ts 100.00% <100.00%> (ø)
...reateCertificateButton/CreateCertificateButton.tsx 94.11% <90.90%> (+1.80%) ⬆️
apps/deploy-web/src/queries/useLeaseQuery.ts 95.74% <85.71%> (-1.99%) ⬇️
...ntext/SettingsProvider/SettingsProviderContext.tsx 9.40% <33.33%> (-0.77%) ⬇️
...ploy-web/src/services/http/http-browser.service.ts 78.26% <33.33%> (-2.70%) ⬇️
apps/deploy-web/src/utils/init.ts 60.00% <33.33%> (ø)
apps/deploy-web/src/utils/proto/index.ts 31.57% <0.00%> (-3.43%) ⬇️
...pps/deploy-web/src/utils/TransactionMessageData.ts 6.55% <0.00%> (-7.96%) ⬇️
...CertificateProvider/CertificateProviderContext.tsx 8.63% <22.22%> (-21.60%) ⬇️

... and 34 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stalniy stalniy force-pushed the feat/expired-cert branch 2 times, most recently from dd63bbf to 8cd9906 Compare July 24, 2025 10:46
@stalniy stalniy force-pushed the feat/expired-cert branch from 8cd9906 to 9153198 Compare July 24, 2025 20:03
@stalniy stalniy merged commit 971eec9 into main Jul 25, 2025
61 of 62 checks passed
@stalniy stalniy deleted the feat/expired-cert branch July 25, 2025 02:13
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