Skip to content

feat(notifications): re-generates swagger and sdks#2268

Merged
ygrishajev merged 1 commit intomainfrom
feature/notifications-sdk
Dec 18, 2025
Merged

feat(notifications): re-generates swagger and sdks#2268
ygrishajev merged 1 commit intomainfrom
feature/notifications-sdk

Conversation

@ygrishajev
Copy link
Contributor

@ygrishajev ygrishajev commented Nov 21, 2025

Summary by CodeRabbit

  • New Features

    • Added two new alert types: wallet balance monitoring and chain event detection.
    • Alerts now default to enabled on creation.
    • Alert configuration and responses restructured for richer conditions (and/or branches), clearer field enums, tighter validation, and more detailed error/pagination responses.
  • Bug Fixes

    • Safer deployment name/DSEQ display in alerts: shows "N/A" when missing and links only when a valid DSEQ exists.

✏️ Tip: You can customize this high-level summary in your review settings.

@ygrishajev ygrishajev requested a review from a team as a code owner November 21, 2025 18:13
@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 51.06%. Comparing base (5fffef9) to head (015ad34).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...omponents/alerts/AlertsListView/AlertsListView.tsx 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2268      +/-   ##
==========================================
- Coverage   51.33%   51.06%   -0.28%     
==========================================
  Files        1071     1061      -10     
  Lines       29108    28763     -345     
  Branches     6416     6361      -55     
==========================================
- Hits        14942    14687     -255     
+ Misses      13831    13689     -142     
- Partials      335      387      +52     
Flag Coverage Δ *Carryforward flag
api 81.01% <ø> (+0.02%) ⬆️
deploy-web 31.16% <91.66%> (+0.02%) ⬆️
log-collector ?
notifications 87.94% <ø> (ø)
provider-console 81.48% <ø> (ø) Carriedforward from 5fffef9
provider-proxy 84.35% <ø> (ø) Carriedforward from 5fffef9

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

Files with missing lines Coverage Δ
...alerts/AlertsListContainer/AlertsListContainer.tsx 76.78% <100.00%> (ø)
...omponents/alerts/AlertsListView/AlertsListView.tsx 86.00% <90.90%> (+1.21%) ⬆️

... and 60 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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Walkthrough

Restructures notification/alert schemas and SDK types: nests alert fields into params, adds complex conditions, introduces WALLET_BALANCE and CHAIN_EVENT variants, tightens balance typings, updates Swagger responses, and applies small frontend safe-access refactors for dseq extraction and rendering.

Changes

Cohort / File(s) Summary
Swagger schema restructuring
apps/notifications/swagger/swagger.json
Large rework of Alert-related schemas: replaced flat fields with nested params, added logical conditions (and/or operators, typed values), introduced type enums (CHAIN_MESSAGE, DEPLOYMENT_BALANCE, WALLET_BALANCE, CHAIN_EVENT), defaults (enabled: true), and updated response/error shapes and required fields
React Query SDK schema updates
packages/react-query-sdk/src/notifications/schema.ts
Added WALLET_BALANCE and CHAIN_EVENT branches across AlertCreateInput, AlertOutputResponse, AlertListOutputResponse; introduced params for WALLET_BALANCE (owner, denom, suppressedBySystem); tightened balance typings (field: "balance", numeric value); aligned variants with Swagger enums
Frontend dseq handling and refactor
apps/deploy-web/src/components/alerts/AlertsListContainer/AlertsListContainer.tsx, apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx
Safer extraction and use of dseq: added explicit existence checks, introduced extractDseq helper, updated onToggle and cell renderers to conditionally link deployment name only when dseq exists; preserved fallback behavior

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Focus review on apps/notifications/swagger/swagger.json for interdependent schema constraints (required sets, enums, nested objects).
  • Verify packages/react-query-sdk/src/notifications/schema.ts precisely mirrors Swagger shape and typings (especially numeric vs string for balance/value).
  • Check frontend extractDseq usage for any edge cases where params is absent or has unexpected shapes.

Possibly related PRs

Suggested reviewers

  • stalniy
  • baktun14

Poem

🐇 I hopped through JSON, tidy and bright,
Nested params snug, conditions just right.
Wallets and chains now join the dance,
Dseqs are safe — I give a happy prance! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the pull request: regenerating Swagger/OpenAPI schemas and SDKs for the notifications component, which is the primary focus of all file changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/notifications-sdk

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/notifications/swagger/swagger.json (1)

4691-5150: Consider de-duplicating the conditions schema via shared $ref in a follow-up

AlertPatchInput.data.conditions (and the other alert schemas) inline essentially the same nested operator/field/value structure multiple times, with only minor differences between generic and balance-only variants. This is correct but quite verbose and harder to maintain if condition semantics evolve.

If you plan more alert types or condition operators, consider extracting:

  • A generic ConditionExpression schema for string/number/boolean fields.
  • A BalanceConditionExpression schema for field: "balance" + numeric value.

and then referencing them via $ref in the various oneOf branches. That refactor should happen at the source that emits swagger and be tracked as a separate issue rather than in this regeneration PR.
Based on learnings

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3e91173 and 33e3725.

📒 Files selected for processing (2)
  • apps/notifications/swagger/swagger.json (21 hunks)
  • packages/react-query-sdk/src/notifications/schema.ts (5 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
🔇 Additional comments (4)
packages/react-query-sdk/src/notifications/schema.ts (2)

247-290: WALLET_BALANCE AlertCreateInput variant looks structurally consistent

The new type: "WALLET_BALANCE" branch mirrors the existing DEPLOYMENT_BALANCE balance-conditions shape (restricted field: "balance" and numeric value) and introduces params with { owner, denom, suppressedBySystem? }, which aligns with the swagger schema and the intended wallet-level semantics. No structural issues stand out here from the SDK consumer perspective.


341-387: Output and list unions correctly model CHAIN_EVENT and WALLET_BALANCE variants

The added CHAIN_EVENT and WALLET_BALANCE cases in AlertOutputResponse.data and AlertListOutputResponse.data are internally consistent and match the swagger definitions:

  • Each variant has a clear discriminator via type: "CHAIN_MESSAGE" | "CHAIN_EVENT" | "DEPLOYMENT_BALANCE" | "WALLET_BALANCE".
  • Balance-based variants (DEPLOYMENT_BALANCE, WALLET_BALANCE) consistently restrict conditions to field: "balance" with value: number.
  • params payloads are specialized: deployment balance uses { dseq, owner, suppressedBySystem? }, wallet balance uses { owner, denom, suppressedBySystem? }, while chain-based variants keep the existing { dseq, type, suppressedBySystem? }.

This should give React Query consumers a clean discriminated-union surface over the regenerated API.

Also applies to: 453-487, 557-603, 669-702

apps/notifications/swagger/swagger.json (2)

1121-2211: AlertCreateInput: WALLET_BALANCE and extended alert variants are coherent

Within components.schemas.AlertCreateInput.data.oneOf, the four variants (CHAIN_MESSAGE, CHAIN_EVENT, DEPLOYMENT_BALANCE, WALLET_BALANCE) are well-formed and mutually distinguishable via their type enums. The WALLET balance branch:

  • Constrains conditions to numeric balance checks (and/or + single condition).
  • Uses params { owner, denom, suppressedBySystem? } with owner and denom required.
  • Mirrors the deployment-balance pattern while correctly omitting dseq.

This looks consistent with how the SDK types were generated and should be safe to expose as the canonical contract for creating wallet-balance alerts.


2212-4690: AlertOutputResponse & AlertListOutputResponse unions align across all alert types

The new AlertOutputResponse and AlertListOutputResponse schemas correctly:

  • Standardize common metadata (notificationChannelId, name, enabled, summary, description, id, userId, status, createdAt, updatedAt).
  • Discriminate per-alert behavior via type enums: "CHAIN_MESSAGE" | "CHAIN_EVENT" | "DEPLOYMENT_BALANCE" | "WALLET_BALANCE".
  • Keep chain-related branches on generic conditions (field: string, value: string|number|boolean) and optional params { dseq, type, suppressedBySystem? }.
  • Restrict balance-based branches to field: "balance" and numeric value, with specialized params for deployment vs wallet.

These shapes match the generated TypeScript in notifications/schema.ts and give clients a predictable discriminated union across list/read/delete responses as well as create.

stalniy
stalniy previously approved these changes Nov 25, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 33e3725 and b6a1557.

📒 Files selected for processing (2)
  • apps/deploy-web/src/components/alerts/AlertsListContainer/AlertsListContainer.tsx (1 hunks)
  • apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx (4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{ts,tsx,js}: Never use type any or cast to type any. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.

Files:

  • apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx
  • apps/deploy-web/src/components/alerts/AlertsListContainer/AlertsListContainer.tsx
🧠 Learnings (3)
📓 Common learnings
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
📚 Learning: 2025-06-05T21:07:51.985Z
Learnt from: baktun14
Repo: akash-network/console PR: 1432
File: apps/deploy-web/src/components/deployments/DeploymentAlerts/DeploymentCloseAlert.tsx:38-38
Timestamp: 2025-06-05T21:07:51.985Z
Learning: The ContactPointSelect component in apps/deploy-web/src/components/alerts/ContactPointSelectForm/ContactPointSelect.tsx uses the useFormContext hook internally to connect to React Hook Form, so it doesn't need to be wrapped in a FormField component.

Applied to files:

  • apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx
📚 Learning: 2025-11-25T17:45:39.561Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T17:45:39.561Z
Learning: Applies to **/*.{ts,tsx,js} : Never use deprecated methods from libraries.

Applied to files:

  • apps/deploy-web/src/components/alerts/AlertsListContainer/AlertsListContainer.tsx
🧬 Code graph analysis (1)
apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx (2)
apps/notifications/src/modules/alert/model-schemas/alert.schema.ts (1)
  • Alert (10-42)
apps/deploy-web/src/utils/urlUtils.ts (1)
  • UrlService (16-96)
⏰ 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). (8)
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: Validate local packages
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
apps/deploy-web/src/components/alerts/AlertsListContainer/AlertsListContainer.tsx (1)

125-125: LGTM! Improved type safety for dseq extraction.

The stricter existence checks (item.params && "dseq" in item.params) ensure type-safe access to the dseq property before calling getDeploymentName. This aligns well with the broader restructuring toward explicit param handling across alert components.

apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx (1)

64-64: Good refactoring with centralized dseq extraction.

The extractDseq helper successfully consolidates dseq extraction logic, and all usages correctly handle the optional nature of dseq:

  • Line 64: Passes extracted dseq to onToggle
  • Lines 74-83: Conditionally renders Link only when dseq exists
  • Line 87: Uses nullish coalescing for fallback display

Also applies to: 72-84, 85-88

@ygrishajev ygrishajev force-pushed the feature/notifications-sdk branch from b6a1557 to 015ad34 Compare December 18, 2025 12:06
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx (1)

46-51: Complete the logic simplification suggested in the previous review.

While the any type was correctly changed to unknown, the logic still needs simplification as previously suggested. The current pattern dseq || undefined unnecessarily coerces falsy values and lacks explicit type narrowing.

🔎 Apply the previously suggested diff to properly narrow the type and simplify:
 const extractDseq = useCallback((info: CellContext<Alert, unknown>) => {
   const { params } = info.row.original;
-  const dseq = params && "dseq" in params && params.dseq;
-
-  return dseq || undefined;
+  return params && typeof params === "object" && params !== null && "dseq" in params ? params.dseq : undefined;
 }, []);
🧹 Nitpick comments (1)
apps/notifications/swagger/swagger.json (1)

1945-2204: Regenerated alert / notification schemas are coherent and match the SDK types

The extended schemas for AlertCreateInput, AlertOutputResponse, and AlertListOutputResponse (including CHAIN_EVENT and WALLET_BALANCE variants), plus the standardized error and pagination wrappers, are internally consistent and line up with the generated TS types:

  • Balance‑based variants restrict conditions to field: "balance" and numeric value, with appropriate params ({ dseq, owner } vs { owner, denom }).
  • CHAIN* variants retain the generic condition/value typing and optional params while being cleanly discriminated via type.
  • New shared responses (ValidationErrorResponse, UnauthorizedErrorResponse, ForbiddenErrorResponse, InternalServerErrorResponse, list outputs, deployment alert DTOs, notification‑channel DTOs) are correctly referenced from the corresponding paths.

Given this file is generated from the backend OpenAPI and the TS SDK is derived from it, I would keep this PR focused on regeneration; any broader modeling/doc tweaks (e.g., refining query param descriptions or DRY‑ing repeated condition schemas) are better handled by updating the source API spec in a separate issue/PR and regenerating. Based on learnings, this keeps the scope of this change tight.

Also applies to: 2212-5639

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6a1557 and 015ad34.

📒 Files selected for processing (4)
  • apps/deploy-web/src/components/alerts/AlertsListContainer/AlertsListContainer.tsx (1 hunks)
  • apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx (4 hunks)
  • apps/notifications/swagger/swagger.json (21 hunks)
  • packages/react-query-sdk/src/notifications/schema.ts (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/deploy-web/src/components/alerts/AlertsListContainer/AlertsListContainer.tsx
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{ts,tsx,js}: Never use type any or cast to type any. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.

Files:

  • apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx
  • packages/react-query-sdk/src/notifications/schema.ts
🧠 Learnings (5)
📓 Common learnings
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
📚 Learning: 2025-11-25T17:45:39.561Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T17:45:39.561Z
Learning: Applies to **/*.{ts,tsx,js} : Never use type `any` or cast to type `any`. Always define the proper TypeScript types.

Applied to files:

  • apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx
📚 Learning: 2025-05-24T04:26:25.511Z
Learnt from: stalniy
Repo: akash-network/console PR: 1362
File: apps/api/src/core/services/open-api-hono-handler/open-api-hono-handler.ts:21-21
Timestamp: 2025-05-24T04:26:25.511Z
Learning: In TypeScript strict mode, double casts like `c as unknown as AppContext` may be necessary even when types are structurally compatible, as strict mode enforces more restrictive type compatibility rules than regular mode.

Applied to files:

  • apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx
📚 Learning: 2025-11-25T17:45:39.561Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T17:45:39.561Z
Learning: Applies to **/*.{ts,tsx,js} : Never use deprecated methods from libraries.

Applied to files:

  • apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx
📚 Learning: 2025-06-05T21:07:51.985Z
Learnt from: baktun14
Repo: akash-network/console PR: 1432
File: apps/deploy-web/src/components/deployments/DeploymentAlerts/DeploymentCloseAlert.tsx:38-38
Timestamp: 2025-06-05T21:07:51.985Z
Learning: The ContactPointSelect component in apps/deploy-web/src/components/alerts/ContactPointSelectForm/ContactPointSelect.tsx uses the useFormContext hook internally to connect to React Hook Form, so it doesn't need to be wrapped in a FormField component.

Applied to files:

  • apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx
🧬 Code graph analysis (1)
apps/deploy-web/src/components/alerts/AlertsListView/AlertsListView.tsx (2)
apps/notifications/src/modules/alert/model-schemas/alert.schema.ts (1)
  • Alert (10-42)
apps/deploy-web/src/utils/urlUtils.ts (1)
  • UrlService (16-96)
⏰ 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). (9)
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: validate / validate-app
  • GitHub Check: test-build
  • GitHub Check: validate (apps/provider-console) / should-validate-unsafe / should-validate
  • GitHub Check: Validate local packages
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
packages/react-query-sdk/src/notifications/schema.ts (1)

247-290: New CHAIN_EVENT / WALLET_BALANCE alert variants look consistent and type‑safe

The added union arms for CHAIN_EVENT and WALLET_BALANCE across AlertCreateInput, AlertOutputResponse, and AlertListOutputResponse keep the discriminated‑union pattern (type literal), constrain balance conditions to field: "balance" with numeric value, and introduce params with the expected shapes ({ dseq, owner } for deployment balance and { owner, denom } for wallet balance). No any usage, and everything aligns with the regenerated swagger contracts, so this looks good to ship as‑is, with any future tweaks flowing from the OpenAPI source rather than editing this file directly.

Also applies to: 341-387, 453-486, 557-603, 669-702

@ygrishajev ygrishajev merged commit d3aae18 into main Dec 18, 2025
70 of 74 checks passed
@ygrishajev ygrishajev deleted the feature/notifications-sdk branch December 18, 2025 12:36
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