Skip to content

Redux Routine: Convert the tests to TypeScript - #85121

Merged
manzoorwanijk merged 6 commits into
WordPress:trunkfrom
himanshupathak95:fix/redux-routine-typescript-tests
Oct 20, 2026
Merged

manzoorwanijk merged 6 commits into
WordPress:trunkfrom
himanshupathak95:fix/redux-routine-typescript-tests

Conversation

@himanshupathak95

@himanshupathak95 himanshupathak95 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What?

Part of #67691. Converts all three test files in @wordpress/redux-routine to TypeScript.

Why?

The package source is already TypeScript, but its tests were still JavaScript and were not type checked. Converting the middleware tests also exposes existing type declarations that do not match the supported behavior.

How?

Splits the package’s TypeScript configuration into build and development projects, updates project references, and removes the obsolete JavaScript-path ESLint suppressions.

Corrects control result and generator dispatch types, exports the types from the package root, and updates the API documentation. Keeps the two regression checks and local fixture types in the existing middleware test file. No runtime behavior or existing assertions change.

Testing Instructions

  1. npm run test:unit -- packages/redux-routine/src/test packages/data/src
  2. npm run typecheck -- --force
  3. npm run lint:tsconfig, npm run lint:js:prune-suppressions, npm run lint:published-deps, and npm run lint:changelogs -- packages/redux-routine/CHANGELOG.md
  4. npm run build

Use of AI Tools

Implemented with assitance of Codex (Astra 6)

@coderabbitai review

@github-actions github-actions Bot added [Package] Data /packages/data [Package] Redux Routine /packages/redux-routine labels Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: himanshupathak95 <abcd95@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

@himanshupathak95
himanshupathak95 marked this pull request as ready for review October 19, 2026 16:33
@himanshupathak95
himanshupathak95 marked this pull request as draft October 19, 2026 16:51
@himanshupathak95 himanshupathak95 changed the title Redux Routine: Type-check action and generator predicate tests Redux Routine: Convert the tests to TypeScript Oct 19, 2026
@himanshupathak95 himanshupathak95 added the [Type] Code Quality Issues or PRs that relate to code quality label Oct 19, 2026
@himanshupathak95
himanshupathak95 marked this pull request as ready for review October 19, 2026 17:03
@himanshupathak95
himanshupathak95 force-pushed the fix/redux-routine-typescript-tests branch from 09c2ed5 to fe3a465 Compare October 19, 2026 17:14
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: WordPress/gutenberg/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9e5e0a09-52f6-49a2-9c48-80154ecd50e4
📥 Commits

Reviewing files that changed from the base of the PR and between 1c73105 and 5415440.

📒 Files selected for processing: 15
  • packages/data/tsconfig.json
  • packages/redux-routine/CHANGELOG.md
  • packages/redux-routine/README.md
  • packages/redux-routine/src/index.ts
  • packages/redux-routine/src/rungen.d.ts
  • packages/redux-routine/src/runtime.ts
  • packages/redux-routine/src/test/index.ts
  • packages/redux-routine/src/test/is-action.ts
  • packages/redux-routine/src/test/is-generator.ts
  • packages/redux-routine/src/types.ts
  • packages/redux-routine/tsconfig.build.json
  • packages/redux-routine/tsconfig.json
  • tools/eslint/suppressions.json
  • tsconfig.build.json
  • tsconfig.json
💤 Files with no reviewable changes: 3
  • packages/redux-routine/src/test/is-generator.ts
  • packages/redux-routine/src/test/is-action.ts
  • tools/eslint/suppressions.json
🚧 Files skipped from review as they are similar to previous changes: 1
  • packages/redux-routine/CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

📝 Summary

Summary by CodeRabbit

  • New Features
    • Added Controls and RoutineDispatch types for clearer middleware configuration and generator dispatch.
    • Control results, including undefined, are now available as yielded values.
  • Bug Fixes
    • Corrected control and generator-dispatch type definitions to align with runtime behavior.
  • Documentation
    • Updated API guidance for control handling, middleware types, and dispatching generator routines.
  • Tests
    • Expanded coverage for synchronous and asynchronous controls, middleware compatibility, and routine results.

The changes add exported Controls and RoutineDispatch types, apply them to middleware and runtime signatures, convert tests to TypeScript, document the contracts, and update TypeScript project references.

Changes: redux-routine type and TypeScript updates

Layer / File(s) Summary
Define control and dispatch types
packages/redux-routine/src/types.ts, packages/redux-routine/src/rungen.d.ts, packages/redux-routine/src/runtime.ts
Controls handlers return unknown. RoutineDispatch accepts a generator and returns a promise. Runtime control declarations use Controls, and yieldNext accepts an unknown result.
Expose and verify typed middleware
packages/redux-routine/src/index.ts, packages/redux-routine/src/test/index.ts, packages/redux-routine/README.md, packages/redux-routine/CHANGELOG.md
The package exports Controls and RoutineDispatch, and createMiddleware uses these types. Tests cover control return values, middleware compatibility, and dispatch results. Documentation describes the types and yielded assignments, including undefined.
Configure TypeScript project references
packages/redux-routine/tsconfig.build.json, packages/redux-routine/tsconfig.json, tsconfig.build.json, tsconfig.json, packages/data/tsconfig.json, tools/eslint/suppressions.json
The package adds a build configuration and updates its development configuration. Root and data project references target the package build configuration. TypeScript lint suppressions for converted tests are removed.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 54154

The test conversion and TypeScript project split show no identified merge-blocking issue. Merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. (7 skipped: 7… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the primary change: converting the Redux Routine tests to TypeScript.
Description check Passed The description is directly related to the changeset and explains the TypeScript conversion, configuration updates, type corrections, documentation changes, and validation steps.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. (7 skipped: 7 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 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.

ESLint install timed out. The project may have too many dependencies for the sandbox.

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

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

Comment thread packages/redux-routine/tsconfig.json Outdated
Comment thread tsconfig.json Outdated
@manzoorwanijk manzoorwanijk added the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label Oct 20, 2026
@github-actions github-actions Bot removed the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label Oct 20, 2026
@himanshupathak95
himanshupathak95 force-pushed the fix/redux-routine-typescript-tests branch from a7f4285 to 6bfc6c8 Compare October 20, 2026 14:10
@himanshupathak95
himanshupathak95 force-pushed the fix/redux-routine-typescript-tests branch from 6bfc6c8 to 1c73105 Compare October 20, 2026 14:21
@manzoorwanijk

Copy link
Copy Markdown
Member

Failures should be fixed after rebase once #85201 gets merged.

@himanshupathak95
himanshupathak95 force-pushed the fix/redux-routine-typescript-tests branch from 1c73105 to 5415440 Compare October 20, 2026 14:27
@manzoorwanijk
manzoorwanijk enabled auto-merge (squash) October 20, 2026 14:29
@manzoorwanijk
manzoorwanijk merged commit 9edf287 into WordPress:trunk Oct 20, 2026
112 checks passed
@github-actions github-actions Bot added this to the Gutenberg 24.4 milestone Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Data /packages/data [Package] Redux Routine /packages/redux-routine [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants