Skip to content

Conversation

@Sobyt483
Copy link
Collaborator

@Sobyt483 Sobyt483 commented Oct 22, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Strengthened null/undefined safety across UI and data flows to prevent runtime errors.
    • Improved user-facing error alerts for missing resource data, navigation failures, and invalid kubeconfig inputs.
    • Validated kubeconfig properties before download and defaulted select inputs to safe values.
  • Tests

    • Expanded test coverage for many undefined/null edge cases and error paths.
  • Chores

    • Enabled stricter TypeScript null checking (strictNullChecks).

@Sobyt483 Sobyt483 requested a review from gkrajniak October 22, 2025 11:05
@Sobyt483 Sobyt483 marked this pull request as draft October 22, 2025 11:06
@Sobyt483 Sobyt483 self-assigned this Oct 22, 2025
@Sobyt483 Sobyt483 added the enhancement New feature or request label Oct 22, 2025
@Sobyt483 Sobyt483 linked an issue Oct 22, 2025 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Oct 22, 2025

Walkthrough

Enables strict null checking and applies defensive null/undefined handling across services, components, templates, utilities, and tests; introduces runtime guards, required inputs, a kubeconfig validation helper, and test adjustments for null-safety.

Changes

Cohort / File(s) Summary
Portal options & router tests
projects/lib/portal-options/services/node-context-processing.service.ts, projects/lib/portal-options/services/node-context-processing.service.spec.ts, projects/lib/portal-options/services/router-config.service.spec.ts
Added guard when updating entityNode.context; updated tests to use non-null assertions or cast undefined to any for type compatibility.
Gateway service & tests
projects/lib/services/resource/gateway.service.ts, projects/lib/services/resource/gateway.service.spec.ts
Extracted KCP-path extraction into getCurrentKcpPath with alerting on failures; adjusted resolveKcpPath/getGatewayUrl flows and added tests covering valid/invalid extraction cases and alerting.
Resource service & tests
projects/lib/services/resource/resource.service.ts, projects/lib/services/resource/resource.service.spec.ts
Switched read error return from of(null) to EMPTY; changed namespace param to `string
Resource field utils & tests
projects/lib/utils/utils/resource-field-by-path.ts, projects/lib/utils/utils/resource-field-by-path.spec.ts
Removed some optional/fallback handling (direct property access, removed `resource
Kubeconfig validation util
projects/wc/src/app/utils/ts-guargs/validate-kubeconfig-props.ts
Added validateKubeconfigProps(props: any) asserting required kubeconfig-related string props and throwing on falsy values.
Dynamic select component & tests
projects/wc/src/app/components/dynamic-select/dynamic-select.component.ts, projects/wc/src/app/components/dynamic-select/dynamic-select.component.spec.ts
Replaced field input with required, strongly-typed dynamicValuesDefinition; updated default value to ''; adapted method signatures and tests to async input setting and stable detection.
Detail view component, template & tests
projects/wc/src/app/components/generic-ui/detail-view/detail-view.component.ts, projects/wc/src/app/components/generic-ui/detail-view/detail-view.component.html, projects/wc/src/app/components/generic-ui/detail-view/detail-view.component.spec.ts
Inputs LuigiClient/context made required; resource becomes `Resource
List view component, template & tests
projects/wc/src/app/components/generic-ui/list-view/list-view.component.ts, projects/wc/src/app/components/generic-ui/list-view/list-view.component.html, projects/wc/src/app/components/generic-ui/list-view/list-view.component.spec.ts
Inputs made required; introduced getResourceDefinition() validation helper; changed many accesses to optional chaining/nullish coalescing; added error alerts and tests covering undefined resourceDefinition and missing resource names.
Create/delete modal templates & create modal component
projects/wc/src/app/components/generic-ui/list-view/create-resource-modal/create-resource-modal.component.html, projects/wc/src/app/components/generic-ui/list-view/create-resource-modal/create-resource-modal.component.ts, projects/wc/src/app/components/generic-ui/list-view/delete-resource-confirmation-modal/delete-resource-modal.component.html
Used field.values ?? []; bind dynamic path via [dynamicValuesDefinition]; tightened [required] to boolean; made context input required; explicit ValidatorFn[] typing; guarded metadata.name?.toLowerCase().
Value cell template & link-value test
projects/wc/src/app/components/generic-ui/value-cell/value-cell.component.html, projects/wc/src/app/components/generic-ui/value-cell/link-value/link-value.component.spec.ts
Added non-null assertions to child bindings (!) and included NO_ERRORS_SCHEMA in test module schemas alongside CUSTOM_ELEMENTS_SCHEMA.
Organization management component & tests
projects/wc/src/app/components/organization-management/organization-management.component.ts, projects/wc/src/app/components/organization-management/organization-management.component.html, projects/wc/src/app/components/organization-management/organization-management.component.spec.ts
Inputs made required; sanitizeSubdomainInput now accepts optional input?: string; defaulted select value to '' via nullish coalescing; replaced some name usages with control values; expanded tests for sanitization and undefined organization flows.
Welcome component
projects/wc/src/app/components/welcome/welcome.component.ts
Inputs made required; enhancedContext and header signals now allow undefined; template and bindings adjusted to use signal value aliasing and optional chaining.
Various tests & minor spec edits
projects/lib/portal-options/...spec.ts, projects/lib/services/resource/...spec.ts, projects/wc/...component.spec.ts (multiple)
Many specs updated to accommodate stricter types: added non-null assertions, casting undefined to any, added LuigiClient.uxManager.showAlert mocks, updated async test flows, and added/modified test cases for error/undefined conditions.
TypeScript config
tsconfig.json
Enabled strictNullChecks in compilerOptions.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

  • Areas needing extra attention:
    • DetailView and ListView components (new guards, kubeconfig plumbing, template refactors).
    • Gateway and Resource services (new helper extraction and EMPTY return behavior).
    • Utility changes in resource-field-by-path (removal of fallbacks may introduce runtime errors where callers pass undefined).
    • Broad test updates (ensure expectations reflect EMPTY vs emitted null and async fixture flows).

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 3ecb4ec and ad2a1da.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • projects/wc/src/app/components/generic-ui/detail-view/detail-view.component.html (2 hunks)
  • projects/wc/src/app/components/generic-ui/list-view/list-view.component.html (2 hunks)
  • projects/wc/src/app/components/generic-ui/list-view/list-view.component.spec.ts (2 hunks)
  • projects/wc/src/app/components/generic-ui/list-view/list-view.component.ts (8 hunks)
  • projects/wc/src/app/components/generic-ui/value-cell/value-cell.component.html (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • projects/wc/src/app/components/generic-ui/list-view/list-view.component.html
  • projects/wc/src/app/components/generic-ui/list-view/list-view.component.spec.ts
  • projects/wc/src/app/components/generic-ui/value-cell/value-cell.component.html

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

@Sobyt483 Sobyt483 marked this pull request as ready for review October 24, 2025 11:53
@Sobyt483 Sobyt483 requested review from a team as code owners October 28, 2025 14:57
@Sobyt483 Sobyt483 merged commit 4447ce4 into main Oct 28, 2025
7 checks passed
@Sobyt483 Sobyt483 deleted the strict-null-check branch October 28, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor lib by including strictNullCheck in ts config

3 participants