Skip to content

4.19: Enable TypeScript noImplicitAny option & fix types as necessary#1971

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:release-4.19from
kyoto:4.19-noImplicitAny
May 26, 2026
Merged

4.19: Enable TypeScript noImplicitAny option & fix types as necessary#1971
openshift-merge-bot[bot] merged 1 commit into
openshift:release-4.19from
kyoto:4.19-noImplicitAny

Conversation

@kyoto
Copy link
Copy Markdown
Member

@kyoto kyoto commented May 21, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved Kubernetes resource selector logic for Job and VirtualMachine resources to use explicit label-based matching.
    • Updated alerting rule ID generation (may change derived rule IDs).
  • New/Improved Validation

    • Tighter YAML upload and alert/silence parsing to reject invalid inputs.
  • Chores

    • Added TypeScript type definitions for dependencies.
    • Enhanced type safety and stricter compiler behavior across the codebase.

@kyoto kyoto added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 21, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b395213e-4332-4835-adbf-f861f141484f

📥 Commits

Reviewing files that changed from the base of the PR and between b9c9954 and bc068ae.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • package.json
  • src/components/AttachLogModal.tsx
  • src/components/AttachmentModal.tsx
  • src/components/AttachmentsSizeAlert.tsx
  • src/components/Prompt.tsx
  • src/hooks/usePopover.ts
  • src/redux-reducers.ts
  • src/validation.ts
  • tsconfig.json

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting


📝 Walkthrough

Walkthrough

This PR strengthens TypeScript type safety across the codebase by tightening the compiler configuration, adding missing type packages, and annotating components, hooks, and validation flows with explicit types. It also adjusts alert rule ID hashing by removing a salt argument.

Changes

Unified Type Safety Improvements

Layer / File(s) Summary
TypeScript Configuration and Type Packages
tsconfig.json, package.json
Remove noImplicitAny: false override to use strict mode default behavior, and add missing @types packages for js-yaml, lodash, and murmurhash-js.
Prometheus Attachment Type Safety
src/components/Prompt.tsx
Import and apply PrometheusAlert, PrometheusRule, PrometheusRulesResponse, and Silence types to Alert, Silence, and AlertingRule attachment flows; tighten YAML validation to reject null; type the chat attachment payload mapping and textarea change handler.
Kubernetes Log Attachment Selector Typing
src/components/AttachLogModal.tsx
Import Selector type and refactor selectors to use matchLabels format for Job and VirtualMachine/VirtualMachineInstance resources; update container-name extraction with explicit callback types.
Editor and Attachment Size Type Annotations
src/components/AttachmentModal.tsx, src/components/AttachmentsSizeAlert.tsx
Add EditorDidMount type to code-editor mount handler and annotate attachment size aggregation with Attachment type in the reduce callback.
Hook and Redux State Typing
src/hooks/usePopover.ts, src/redux-reducers.ts
Change usePopover return type signature from array to null, and type findIndex callback entry parameters as ImmutableMap<string, unknown> in chat history reducers.
Alert Rule ID Hashing Update
src/validation.ts
Remove the 'monitoring-salt' second argument from murmur3() invocation in alertingRuleID computation, altering the derived rule ID values.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • openshift/lightspeed-console#1941: Both PRs touch the alerting-rule/silence attachment flow—especially src/validation.ts’s alertingRuleID hashing logic and src/components/Prompt.tsx’s attachment/YAML handling—so the main PR is directly related to the retrieved PR.
  • openshift/lightspeed-console#1955: Both PRs modify src/validation.ts’s alertingRuleID hashing logic by changing how murmur3 is invoked (salt/fixed-salt handling), so the changes are code-level related.
  • openshift/lightspeed-console#1960: Both PRs modify src/validation.ts’s murmur3-based alertingRuleID hash generation (main PR removes the explicit "monitoring-salt" salt while the retrieved PR adds it), directly affecting the same ID logic.

Suggested labels

lgtm

Suggested reviewers

  • joshuawilson
  • syedriko

"I'm a rabbit who loves tidy types,
I hopped through code on cozy nights.
I cleaned the selectors, trimmed a hash,
Typed up components in a flash.
Hooray — the build now sleeps so tight!"

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: enabling TypeScript's noImplicitAny option and fixing types throughout the codebase, which aligns with the comprehensive type fixes shown in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot requested review from joshuawilson and syedriko May 21, 2026 05:28
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kyoto
Copy link
Copy Markdown
Member Author

kyoto commented May 21, 2026

/retest

1 similar comment
@kyoto
Copy link
Copy Markdown
Member Author

kyoto commented May 21, 2026

/retest

@PeterYurkovich
Copy link
Copy Markdown

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 21, 2026
@kyoto
Copy link
Copy Markdown
Member Author

kyoto commented May 21, 2026

/retest

3 similar comments
@kyoto
Copy link
Copy Markdown
Member Author

kyoto commented May 25, 2026

/retest

@kyoto
Copy link
Copy Markdown
Member Author

kyoto commented May 25, 2026

/retest

@kyoto
Copy link
Copy Markdown
Member Author

kyoto commented May 26, 2026

/retest

Co-authored-by: Cursor <cursoragent@cursor.com>
@kyoto kyoto force-pushed the 4.19-noImplicitAny branch from b9c9954 to bc068ae Compare May 26, 2026 05:29
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label May 26, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 26, 2026

New changes are detected. LGTM label has been removed.

@openshift-merge-bot openshift-merge-bot Bot merged commit fdb4444 into openshift:release-4.19 May 26, 2026
1 of 5 checks passed
@kyoto kyoto deleted the 4.19-noImplicitAny branch May 26, 2026 05:48
@kyoto kyoto added the lgtm Indicates that a PR is ready to be merged. label May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants