Skip to content

Conversation

@priethor
Copy link
Contributor

@priethor priethor commented Nov 28, 2025

What

Refactor Abilities API classes to extract a shared base class and consolidate tests.

Why

Post Type and Taxonomy abilities shared most code and logic, since they map almost 1:1 the acf_internal_post_type methods. This will reduce maintenance, simplify tests, and make it easier to add abilities for Field Groups and Options Pages.

The base class is heavily tested, with full coverage I wouldn't consider worth in most cases, but apart from leveraging ai tools to create the tests, it serves as a way to "document" the settings and allowed polishing the abilities, as some of them were not correctly marked as read-only.

How

  • Extracts SCF_Internal_Post_Type_Abilities base class with shared CRUD logic
  • Simplifies SCF_Post_Type_Abilities and SCF_Taxonomy_Abilities to thin subclasses that simply map to each SCF post type.
  • Consolidates E2E tests into a single parameterized suite, testing both entity types
  • Adds more PHPUnit tests for the base class
  • Rename files to follow WordPress naming conventions:

Testing Instructions

  1. Run PHPUnit tests: vendor/bin/phpunit --testsuite=secure-custom-fields
  2. Run E2E tests: npm run test:e2e -- abilities-internal-post-types.spec.ts
  3. More importantly, connect through MCP, list the SCF abilities and verify they work the same.

@priethor priethor added this to the 6.7.0 milestone Nov 28, 2025
@priethor priethor self-assigned this Nov 28, 2025
@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 9.36%. Comparing base (6124103) to head (21f9fa9).
⚠️ Report is 1 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff             @@
##             trunk    #264      +/-   ##
==========================================
+ Coverage     8.84%   9.36%   +0.52%     
+ Complexity    4322    4288      -34     
==========================================
  Files          265     266       +1     
  Lines        33404   33159     -245     
==========================================
+ Hits          2953    3105     +152     
+ Misses       30451   30054     -397     
Flag Coverage Δ
e2e 21.79% <ø> (ø)
phpunit 6.08% <100.00%> (+0.63%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@priethor priethor marked this pull request as ready for review November 29, 2025 18:08
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props priethor.

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

@priethor priethor merged commit af2367e into trunk Nov 30, 2025
9 checks passed
@priethor priethor deleted the refactor/abilities-internal-post-types branch November 30, 2025 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants