Skip to content

Attempt to fix develop branch build error#3661

Merged
acicovic merged 2 commits intodevelopfrom
fix/attempt-to-fix-develop-branch-build-error
Sep 8, 2025
Merged

Attempt to fix develop branch build error#3661
acicovic merged 2 commits intodevelopfrom
fix/attempt-to-fix-develop-branch-build-error

Conversation

@acicovic
Copy link
Collaborator

@acicovic acicovic commented Sep 8, 2025

Description

When we updated api-fetch to 7.30, we started getting this error when npm run build was being called. From here:

ERROR in /home/runner/work/wp-parsely/wp-parsely/src/content-helper/common/providers/base-provider.tsx(151,66)
      TS2345: Argument of type 'APIFetchOptions<boolean>' is not assignable to parameter of type 'APIFetchOptions<true>'.
  Type 'boolean' is not assignable to type 'true'.

We fixed the error with 0a6834b, but then develop plugin builds started failing. This doesn't happen for the PRs themselves. We're getting the error only after merging into develop

This PR is an attempt to fix this issue.

Summary by CodeRabbit

  • Chores
    • Updated CI workflows to use the latest Node.js setup action across build and test pipelines.
  • Documentation
    • Added a @SInCE note to the fetch method describing the use of APIFetchOptions.
  • Style
    • Minor type annotation adjustment in fetch call to align with generic options (no runtime behavior change).

@acicovic acicovic added this to the 3.20.7 milestone Sep 8, 2025
@acicovic acicovic self-assigned this Sep 8, 2025
@acicovic acicovic requested a review from a team as a code owner September 8, 2025 08:08
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 8, 2025

📝 Walkthrough

Walkthrough

Updated GitHub Actions workflows to use actions/setup-node@v5. Adjusted TypeScript typing in base-provider.tsx by casting apiFetch options to APIFetchOptions<true> and adding a JSDoc @since note. No control-flow or runtime behavior changes.

Changes

Cohort / File(s) Summary of Changes
GitHub Actions workflows
.github/workflows/build-plugin.yml, .github/workflows/e2e-tests.yml, .github/workflows/node.js.yml
Bumped actions/setup-node from v4/v4.1.0 to v5 in “Use Node.js” steps; inputs (node-version, cache) unchanged.
Content provider typing
src/content-helper/common/providers/base-provider.tsx
Cast apiFetch options to APIFetchOptions<true> and added a JSDoc @since 3.20.7 note; no runtime logic changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Maintenance

Suggested reviewers

  • alecgeatches

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • Failed to retrieve linked issues from the platform client.
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/attempt-to-fix-develop-branch-build-error

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 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 (5)
.github/workflows/node.js.yml (1)

31-34: Upgrade to setup-node v5 looks good; consider minor hardening.

Add check-latest and cache-dependency-path to stabilize CI across runners and monorepos.

Apply this diff:

-      - name: Use Node.js ${{ env.NODE_VERSION }}
-        uses: actions/setup-node@v5
-        with:
-          node-version: ${{ env.NODE_VERSION }}
-          cache: npm
+      - name: Use Node.js ${{ env.NODE_VERSION }}
+        uses: actions/setup-node@v5
+        with:
+          node-version: ${{ env.NODE_VERSION }}
+          check-latest: true
+          cache: npm
+          cache-dependency-path: |
+            package-lock.json
+            **/package-lock.json
.github/workflows/e2e-tests.yml (1)

34-37: setup-node v5: add cache-dependency-path and check-latest for reproducibility.

This helps avoid stale caches and patch-level drift during Playwright/E2E runs.

Apply this diff:

-      - name: Use Node.js ${{ env.NODE_VERSION }}
-        uses: actions/setup-node@v5
-        with:
-          node-version: ${{ env.NODE_VERSION }}
-          cache: npm
+      - name: Use Node.js ${{ env.NODE_VERSION }}
+        uses: actions/setup-node@v5
+        with:
+          node-version: ${{ env.NODE_VERSION }}
+          check-latest: true
+          cache: npm
+          cache-dependency-path: |
+            package-lock.json
+            **/package-lock.json
src/content-helper/common/providers/base-provider.tsx (2)

140-141: Good @SInCE note; align JSDoc types and optional-param syntax.

Update JSDoc to match the signature and WP JS docs: use APIFetchOptions, Promise, and optional param as [id].

Suggested JSDoc block (outside the changed hunk):

/**
 * Fetches data from the API. Either resolves with the data or rejects with an error.
 *
 * This method is a wrapper around apiFetch() that automatically adds the AbortController signal.
 *
 * @since 3.15.0
 * @since 3.20.7 Using APIFetchOptions<true> to avoid a type error when building on GitHub.
 *
 * @param {APIFetchOptions<true>} options Options to pass to apiFetch.
 * @param {string} [id]                  Optional request ID used for cancellation.
 *
 * @return {Promise<T>} The fetched data.
 */

151-154: Redundant type cast; let the function signature carry the type.

options is already APIFetchOptions; the extra cast is noise.

Apply this diff:

-            const response = await apiFetch<ContentHelperAPIResponse<T>>(
-                options as APIFetchOptions<true>
-            );
+            const response = await apiFetch<ContentHelperAPIResponse<T>>( options );
.github/workflows/build-plugin.yml (1)

55-58: setup-node v5: enable check-latest and broaden cache key.

Prevents Node patch skew and improves cache hits when multiple package-lock.json files exist.

Apply this diff:

-      - name: Use Node.js ${{ env.NODE_VERSION }}
-        uses: actions/setup-node@v5
-        with:
-          node-version: ${{ env.NODE_VERSION }}
-          cache: npm
+      - name: Use Node.js ${{ env.NODE_VERSION }}
+        uses: actions/setup-node@v5
+        with:
+          node-version: ${{ env.NODE_VERSION }}
+          check-latest: true
+          cache: npm
+          cache-dependency-path: |
+            package-lock.json
+            **/package-lock.json
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca28834 and 1bf49e8.

📒 Files selected for processing (4)
  • .github/workflows/build-plugin.yml (1 hunks)
  • .github/workflows/e2e-tests.yml (1 hunks)
  • .github/workflows/node.js.yml (1 hunks)
  • src/content-helper/common/providers/base-provider.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,jsx}

⚙️ CodeRabbit configuration file

**/*.{js,ts,tsx,jsx}: "Perform a detailed review of the provided code with following key aspects in mind:

  • Review the code to ensure it is well-structured and adheres to best practices.
  • Verify compliance with WordPress coding standards.
  • Ensure the code is well-documented.
  • Check for security vulnerabilities and confirm the code is secure.
  • Optimize the code for performance, removing any unnecessary elements.
  • Validate JSDoc comments for accuracy, currency, and adherence to WordPress coding standards.
  • Ensure each line comment concludes with a period.
  • Confirm every JSDoc comment includes a @SInCE tag indicating the next version of the plugin to include the code.
  • Guarantee compatibility with the latest version of WordPress, avoiding deprecated functions or features."

Files:

  • src/content-helper/common/providers/base-provider.tsx
🧬 Code graph analysis (1)
src/content-helper/common/providers/base-provider.tsx (1)
src/content-helper/common/providers/base-wordpress-provider.tsx (1)
  • apiFetch (145-189)
⏰ 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). (1)
  • GitHub Check: E2E against WordPress latest

@acicovic acicovic merged commit cfabb01 into develop Sep 8, 2025
38 of 39 checks passed
@acicovic acicovic deleted the fix/attempt-to-fix-develop-branch-build-error branch September 8, 2025 08:15
@coderabbitai coderabbitai bot mentioned this pull request Oct 2, 2025
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.

1 participant