Skip to content

feat(preferences): site-aware, opinion-free block preferences#35

Open
zackkatz wants to merge 3 commits into
developfrom
tweak/improve-preferences
Open

feat(preferences): site-aware, opinion-free block preferences#35
zackkatz wants to merge 3 commits into
developfrom
tweak/improve-preferences

Conversation

@zackkatz

Copy link
Copy Markdown
Member

Summary

Reworks block preferences to be site-aware and opinion-free, so the score table reflects the block families actually on the site rather than a fixed built-in list, and no third-party block is treated as legacy unless the admin chooses to score it down.

  • Site-aware score table — lists block families registered by active plugins/themes plus any found in published content, instead of a hardcoded list.
  • No built-in opinions — only WordPress core blocks are preferred by default; every other family is fine to use until scored down. Built-in "avoid this block" opinions and built-in replacement suggestions are removed. The replacement map is now entirely the admin's own list.
  • Orphaned-block flag — blocks whose plugin/theme is no longer active are flagged as "not active on this site" in the score table and in AI assistant responses.
  • Upgrade preservation — previously saved preferences are kept exactly as they were. A one-time Settings → Block MCP notice explains the new model and offers a one-click reset to the new defaults.
  • Developer field — block read responses now include preference.orphaned: true for any block whose namespace has no registered provider, so integrations can detect orphaned blocks.

Changes

  • gk-block-mcp.php, class-preferences.php, class-block-reader.php, class-settings-page.php, uninstall.php — site-aware/opinion-free model, migration, orphaned detection, settings UI + reset notice.
  • readme.txt= develop = changelog entry.
  • Tests — new PreferencesMigrationTest.php; updated coverage across Preferences, Settings page, Block CRUD, Post, REST summary, and API test case for the site-aware model, migration, and orphaned blocks.

Test plan

  • PHPUnit suite passes (preferences, migration, orphaned-block, settings-page coverage)
  • Upgrade from a site with saved preferences keeps them intact; one-time notice + reset works
  • Score table reflects active plugins/themes + content; orphaned blocks flagged
  • a11y + i18n verified on the new settings UI strings

https://claude.ai/code/session_011ywjjoe3j6XLMsTNammUU6

zackkatz added 3 commits June 17, 2026 20:17
The shipped preference table hardcoded a GravityKit-flavored opinion: a fixed
namespace score list (filter/gravityforms preferred, stackable/ugb/jetpack
branded legacy) plus a built-in Stackable/UGB replacement map. That contradicted
sites not running those plugins and quietly imposed migrations no admin chose.
Preferences are now derived from the site itself.

- Ship opinion-free defaults: only `core` is preferred (90); every other
  namespace resolves to a neutral 50, and the replacement map ships empty.
- Stop deep-merging `replacement_map`; it is the admin's authoritative list,
  taken verbatim, so a removed mapping stays removed.
- Build the score table from a site-aware row universe: families registered by
  active plugins/themes, families the admin scored, and families found in
  published content. Store `namespace_scores` overrides-only so Reset reverts to
  default and storage never accumulates the neutral defaults.
- Flag orphaned blocks in read responses (`preference.orphaned`) and in the
  score table when a namespace appears in content but has no registered provider.
- Migrate existing sites on activation and lazily on `plugins_loaded`: bump the
  schema to 1.5.0, preserve saved preferences verbatim, and raise a one-time,
  dismissible notice explaining the new model for sites that had saved prefs.
- Drop em-dashes from the settings copy.
…ocks

- Add PreferencesMigrationTest for the 1.5.0 migration: schema stamping,
  idempotency, and the one-time notice flag for sites with saved preferences.
- Rework SettingsPagePreferencesTest and PreferencesTest for the overrides-only
  store, verbatim replacement map, and site-aware row universe (Reset control,
  default marker, orphaned flag); drop the old "layer over shipped defaults"
  contracts.
- Cover `preference.orphaned` for unregistered namespaces in BlockCrudTest.
- Seed legacy/avoid namespaces explicitly in the shared bases now that the
  shipped defaults brand nothing legacy (BlockApiTestCase, PostManagerTest,
  RestSummaryTest).
Add the = develop = entry describing the site-aware, opinion-free preference
model, preserved upgrade settings, the orphaned-block flag, and the new
`preference.orphaned` developer field.
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@zackkatz, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 2 hours, 11 minutes, and 15 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 762b3dcf-b684-4839-a9e1-e9cc4f63f253

📥 Commits

Reviewing files that changed from the base of the PR and between ce7f2e8 and a7d2bec.

📒 Files selected for processing (13)
  • wordpress-plugin/gk-block-mcp/gk-block-mcp.php
  • wordpress-plugin/gk-block-mcp/includes/class-block-reader.php
  • wordpress-plugin/gk-block-mcp/includes/class-preferences.php
  • wordpress-plugin/gk-block-mcp/includes/class-settings-page.php
  • wordpress-plugin/gk-block-mcp/readme.txt
  • wordpress-plugin/gk-block-mcp/tests/Block/BlockCrudTest.php
  • wordpress-plugin/gk-block-mcp/tests/BlockApiTestCase.php
  • wordpress-plugin/gk-block-mcp/tests/Connect/SettingsPagePreferencesTest.php
  • wordpress-plugin/gk-block-mcp/tests/Post/PostManagerTest.php
  • wordpress-plugin/gk-block-mcp/tests/Preferences/PreferencesMigrationTest.php
  • wordpress-plugin/gk-block-mcp/tests/Preferences/PreferencesTest.php
  • wordpress-plugin/gk-block-mcp/tests/REST/RestSummaryTest.php
  • wordpress-plugin/gk-block-mcp/uninstall.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tweak/improve-preferences

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

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