Skip to content

v1.1.0: rename provider id to ultimate-ai-connector-anthropic-max + fix render clobber#6

Merged
superdav42 merged 2 commits intomainfrom
fix/connector-render-clobber
Apr 8, 2026
Merged

v1.1.0: rename provider id to ultimate-ai-connector-anthropic-max + fix render clobber#6
superdav42 merged 2 commits intomainfrom
fix/connector-render-clobber

Conversation

@superdav42
Copy link
Copy Markdown
Contributor

@superdav42 superdav42 commented Apr 7, 2026

Summary

Two coordinated changes that have to ship together to fix the Connectors page properly.

1. Rename the provider id (BREAKING)

Old New
PHP createProviderMetadata() first arg 'anthropic-max' 'ultimate-ai-connector-anthropic-max'
JS registerConnector() slug 'ai-provider-for-anthropic-max/connector' 'ultimate-ai-connector-anthropic-max'
Rendered ConnectorItem className connector-item--anthropic-max connector-item--ultimate-ai-connector-anthropic-max

Why:

  • Consistency with the sister plugins ultimate-ai-connector-webllm and ultimate-ai-connector-compatible-endpoints that both follow the ultimate-ai-connector-{name} naming.
  • Namespace claim: anthropic-max is generic enough that another plugin author could easily collide with it. ultimate-ai-connector-anthropic-max reserves the name properly.
  • One card on the Connectors page instead of two. Previously the JS-side slug differed from the PHP-side provider id, so WP core's registerDefaultConnectors() was creating a separate auto-registered entry with the generic API-key form alongside our custom card. The duplicate was just visually hidden in most layouts. Matching the slugs collapses them into a single store entry.

This is a breaking change for any caller that hardcoded the old id, e.g. AiClient::defaultRegistry()->getProvider('anthropic-max'). Things that are deliberately not changed to keep upgrades safe:

  • Stored OAuth tokens (anthropic_max_oauth_pool option)
  • PKCE transient prefix (anthropic_max_pkce_)
  • REST endpoint namespace (anthropic-max-pool/v1)
  • Plugin folder, text domain, composer/npm package names, error log prefixes

2. 5-tick registerConnector() re-assertion (workaround)

Once the slugs match, this plugin is exposed to the same race the other Ultimate-Multisite connector plugins hit:

  • WP core's routes/connectors-home/content module runs registerDefaultConnectors() from inside an async dynamic import.
  • By the time it executes, our top-level registerConnector() has already populated the store.
  • The store reducer in @wordpress/connectors spreads new config over existing entries, so the default's args.render = ApiKeyConnector overwrites our custom render and the user sees the generic API-key form.

Re-assert the registration on five ticks (sync + microtask + setTimeout at 0/50/250/1000 ms) so we always end up last regardless of dynamic-import resolution order. Idempotent so the redundant calls cost essentially nothing.

The proper upstream fix is WordPress/gutenberg#77116 (already opened, makes registerDefaultConnectors() skip slugs that already have a custom render). Once that ships in a Gutenberg release, the workaround can be removed; the rename in (1) is permanent.

Test plan

  • Activate this branch on a clean WordPress 7.0 install with the AI plugin loaded.
  • Visit Settings → Connectors and verify exactly one "Anthropic Max" card is rendered, showing the OAuth pool form (not the generic API-key form).
  • Open the Anthropic Max card, walk through the OAuth flow, add an account, run a health check — all should work as before. Existing OAuth tokens from v1.0.0 should still authenticate (no migration needed because the option keys are unchanged).
  • Verify against other connector plugins active simultaneously (load-order shifts should no longer affect rendering).

Release

Bumps version 1.0.0 → 1.1.0 in:

  • plugin.php header + ANTHROPIC_MAX_AI_PROVIDER_VERSION constant
  • package.json
  • readme.txt Stable tag + new changelog entry (marked with BREAKING)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Enhanced Anthropic Max connector with improved UI registration and display stability.
  • Chores

    • Bumped plugin version to 1.1.0.
    • Updated provider identifier; API users should review integration points for compatibility.

superdav42 and others added 2 commits April 7, 2026 17:16
WP core's routes/connectors-home/content.js runs registerDefaultConnectors()
from inside an async dynamic import, and the connectors store reducer
spreads new config over existing entries — so the default's
`args.render = ApiKeyConnector` can overwrite a plugin's custom render.

This plugin currently dodges the bug because its JS slug
(ai-provider-for-anthropic-max/connector) doesn't collide with the PHP-side
provider id (anthropic-max). That's fragile — a future upstream change to
slug normalization or sanitization could break it without warning.

Re-assert the registration on five ticks (sync + microtask + setTimeout
0/50/250/1000ms) so we always end up last regardless of dynamic-import
resolution order. Idempotent and cheap.

The proper upstream fix is WordPress/gutenberg#77116. Once that ships in
a Gutenberg release, this defense can be removed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ix render clobber

This commit makes two coordinated changes that have to ship together:

1. RENAME the AI Client provider id from 'anthropic-max' to
   'ultimate-ai-connector-anthropic-max', and the JS registerConnector()
   slug from 'ai-provider-for-anthropic-max/connector' to the same
   'ultimate-ai-connector-anthropic-max'. This:

   - Matches the naming convention used by the sister plugins
     (ultimate-ai-connector-webllm, ultimate-ai-connector-compatible-endpoints).
   - Claims the 'ultimate-ai-connector-' namespace properly so a future
     third-party 'anthropic-max' plugin can't collide with this one.
   - Causes the WP Connectors page to render ONE card instead of two —
     previously a hidden duplicate auto-registered ApiKeyConnector card
     existed alongside the custom-rendered card because the slugs differed.

   This is a BREAKING change for any caller that hardcoded the old
   provider id (e.g. AiClient::defaultRegistry()->getProvider('anthropic-max')).
   Stored OAuth tokens, REST endpoint URLs, option keys, transient prefixes,
   plugin folder name, text domain, and css class are unchanged.

2. WORKAROUND for WP core's registerDefaultConnectors() clobbering custom
   renders. The rename in (1) makes the slugs match, which exposes this
   plugin to the same race the other Ultimate-Multisite connector plugins
   hit: WP core's routes/connectors-home/content module runs
   registerDefaultConnectors() inside an async dynamic import, after our
   top-level registerConnector() has already populated the store, and the
   reducer's spread overwrites our custom render with the generic
   ApiKeyConnector. Re-assert the registration on five ticks (sync +
   microtask + setTimeout 0/50/250/1000ms) so we always end up last.

The proper upstream fix is in WordPress/gutenberg#77116. Once that ships
in a Gutenberg release, the 5-tick workaround can be removed; the rename
is permanent.

CSS class on the rendered card also updated from
`connector-item--anthropic-max` to `connector-item--ultimate-ai-connector-anthropic-max`
to match the new slug and the convention used by the sister plugins.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

This release renames the Anthropic Max provider identifier from anthropic-max to ultimate-ai-connector-anthropic-max, bumps the version to 1.1.0 across configuration files, and updates the JavaScript connector registration with a re-assertion pattern to prevent WordPress core from overwriting the custom connector card.

Changes

Cohort / File(s) Summary
Version Bumps
package.json, plugin.php
Version incremented from 1.0.0 to 1.1.0 in package manifest and plugin metadata constant.
Provider ID Rename
src/Provider/AnthropicMaxProvider.php
Provider identifier argument updated from 'anthropic-max' to 'ultimate-ai-connector-anthropic-max' in createProviderMetadata() with docblock annotations for version 1.1.0.
Connector Registration
js/connector.jsx
Updated slug and CSS class to match new provider ID; replaced single registration call with re-assertion pattern across immediate, microtask, and scheduled async ticks to persist custom connector card.
Documentation
readme.txt
Updated stable tag, documented provider ID rename, and added changelog entries explaining the connector re-registration workaround and unchanged REST endpoints/OAuth tokens.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A new name for our Anthropic friend,
ultimate-ai-connector marks the blend,
Version one-point-one hops into place,
Async re-registrations keep pace,
WordPress won't overwrite our grace!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: the provider ID rename to ultimate-ai-connector-anthropic-max and the fix for the connector render clobber issue.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/connector-render-clobber

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.

@superdav42 superdav42 changed the title v1.0.1: defensive re-register on Connectors page v1.1.0: rename provider id to ultimate-ai-connector-anthropic-max + fix render clobber Apr 7, 2026
Copy link
Copy Markdown

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
readme.txt (2)

39-39: ⚠️ Potential issue | 🟡 Minor

Documentation references outdated provider id.

Line 39 still states the plugin registers as anthropic-max, but the changelog at line 70 documents the rename to ultimate-ai-connector-anthropic-max. This inconsistency will confuse users.

📝 Proposed fix
-The plugin registers as a separate provider (`anthropic-max`) and coexists with the standard API-key-based Anthropic provider.
+The plugin registers as a separate provider (`ultimate-ai-connector-anthropic-max`) and coexists with the standard API-key-based Anthropic provider.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@readme.txt` at line 39, The README still references the old provider id
'anthropic-max' while the changelog and code use
'ultimate-ai-connector-anthropic-max'; update the README text on line mentioning
the provider id to use 'ultimate-ai-connector-anthropic-max' so the
documentation matches the renamed provider, and search for any other occurrences
of 'anthropic-max' in this file (or nearby docs) to replace them with
'ultimate-ai-connector-anthropic-max' to keep IDs consistent with the changelog
and code.

56-56: ⚠️ Potential issue | 🟡 Minor

FAQ section also references the old provider id.

Same inconsistency here - should be updated to reflect the new ultimate-ai-connector-anthropic-max id.

📝 Proposed fix
-Yes. This plugin registers as "Anthropic Max" (`anthropic-max`), separate from the standard "Anthropic" (`anthropic`) provider. Both can be active simultaneously.
+Yes. This plugin registers as "Anthropic Max" (`ultimate-ai-connector-anthropic-max`), separate from the standard "Anthropic" (`anthropic`) provider. Both can be active simultaneously.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@readme.txt` at line 56, Update the FAQ entry that references the old provider
id to use the new provider id string: replace any occurrences of "anthropic-max"
or the standard "anthropic" where the FAQ is meant to refer to the new connector
with "ultimate-ai-connector-anthropic-max" and ensure the display name
"Anthropic Max" remains consistent; look for the FAQ text that mentions the
provider id and change the identifier to ultimate-ai-connector-anthropic-max so
the README matches the registered provider name.
🧹 Nitpick comments (1)
js/connector.jsx (1)

528-535: Consider freezing the CONFIG object to prevent accidental mutation.

Since CONFIG is shared across multiple deferred calls, freezing it ensures the same reference is always passed.

🔧 Optional: freeze the config object
 const CONFIG = {
 	label: __( 'Anthropic Max' ),
 	description: __(
 		'Use Claude with your Max subscription via OAuth. Supports account pool rotation for reliability.'
 	),
 	render: AnthropicMaxConnectorCard,
-};
+};
+Object.freeze( CONFIG );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@js/connector.jsx` around lines 528 - 535, CONFIG is mutated-prone as a shared
object; make it immutable by freezing it so deferred callers always receive the
same unmodifiable reference. Replace the current CONFIG declaration with a
frozen object (e.g., use Object.freeze on the CONFIG object or assign CONFIG =
Object.freeze({...})) while keeping SLUG and render reference to
AnthropicMaxConnectorCard unchanged; a shallow freeze is sufficient for
label/description/render but if nested mutability is possible, apply a deep
freeze utility before exporting/using CONFIG.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@readme.txt`:
- Line 39: The README still references the old provider id 'anthropic-max' while
the changelog and code use 'ultimate-ai-connector-anthropic-max'; update the
README text on line mentioning the provider id to use
'ultimate-ai-connector-anthropic-max' so the documentation matches the renamed
provider, and search for any other occurrences of 'anthropic-max' in this file
(or nearby docs) to replace them with 'ultimate-ai-connector-anthropic-max' to
keep IDs consistent with the changelog and code.
- Line 56: Update the FAQ entry that references the old provider id to use the
new provider id string: replace any occurrences of "anthropic-max" or the
standard "anthropic" where the FAQ is meant to refer to the new connector with
"ultimate-ai-connector-anthropic-max" and ensure the display name "Anthropic
Max" remains consistent; look for the FAQ text that mentions the provider id and
change the identifier to ultimate-ai-connector-anthropic-max so the README
matches the registered provider name.

---

Nitpick comments:
In `@js/connector.jsx`:
- Around line 528-535: CONFIG is mutated-prone as a shared object; make it
immutable by freezing it so deferred callers always receive the same
unmodifiable reference. Replace the current CONFIG declaration with a frozen
object (e.g., use Object.freeze on the CONFIG object or assign CONFIG =
Object.freeze({...})) while keeping SLUG and render reference to
AnthropicMaxConnectorCard unchanged; a shallow freeze is sufficient for
label/description/render but if nested mutability is possible, apply a deep
freeze utility before exporting/using CONFIG.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d0c1132b-6692-461c-9ca4-dd4c97b41cff

📥 Commits

Reviewing files that changed from the base of the PR and between 995dffc and 71d39bc.

📒 Files selected for processing (5)
  • js/connector.jsx
  • package.json
  • plugin.php
  • readme.txt
  • src/Provider/AnthropicMaxProvider.php

@superdav42 superdav42 merged commit af4ce5e into main Apr 8, 2026
1 check passed
@superdav42
Copy link
Copy Markdown
Contributor Author

Summary

Two coordinated changes that have to ship together to fix the Connectors page properly.

1. Rename the provider id (BREAKING)

Old New
PHP createProviderMetadata() first arg 'anthropic-max' 'ultimate-ai-connector-anthropic-max'
JS registerConnector() slug 'ai-provider-for-anthropic-max/connector' 'ultimate-ai-connector-anthropic-max'
Rendered ConnectorItem className connector-item--anthropic-max connector-item--ultimate-ai-connector-anthropic-max
Why:
  • Consistency with the sister plugins ultimate-ai-connector-webllm and ultimate-ai-connector-compatible-endpoints that both follow the ultimate-ai-connector-{name} naming.
  • Namespace claim: anthropic-max is generic enough that another plugin author could easily collide with it. ultimate-ai-connector-anthropic-max reserves the name properly.
  • One card on the Connectors page instead of two. Previously the JS-side slug differed from the PHP-side provider id, so WP core's registerDefaultConnectors() was creating a separate auto-registered entry with the generic API-key form alongside our custom card. The duplicate was just visually hidden in most layouts. Matching the slugs collapses them into a single store entry.
    This is a breaking change for any caller that hardcoded the old id, e.g. AiClient::defaultRegistry()->getProvider('anthropic-max'). Things that are deliberately not changed to keep upgrades safe:
  • Stored OAuth tokens (anthropic_max_oauth_pool option)
  • PKCE transient prefix (anthropic_max_pkce_)
  • REST endpoint namespace (anthropic-max-pool/v1)
  • Plugin folder, text domain, composer/npm package names, error log prefixes

2. 5-tick registerConnector() re-assertion (workaround)

Once the slugs match, this plugin is exposed to the same race the other Ultimate-Multisite connector plugins hit:

  • WP core's routes/connectors-home/content module runs registerDefaultConnectors() from inside an async dynamic import.
  • By the time it executes, our top-level registerConnector() has already populated the store.
  • The store reducer in @wordpress/connectors spreads new config over existing entries, so the default's args.render = ApiKeyConnector overwrites our custom render and the user sees the generic API-key form.
    Re-assert the registration on five ticks (sync + microtask + setTimeout at 0/50/250/1000 ms) so we always end up last regardless of dynamic-import resolution order. Idempotent so the redundant calls cost essentially nothing.
    The proper upstream fix is Connectors: don't clobber third-party custom render in registerDefaultConnectors WordPress/gutenberg#77116 (already opened, makes registerDefaultConnectors() skip slugs that already have a custom render). Once that ships in a Gutenberg release, the workaround can be removed; the rename in (1) is permanent.

Test plan

  • Activate this branch on a clean WordPress 7.0 install with the AI plugin loaded.
  • Visit Settings → Connectors and verify exactly one "Anthropic Max" card is rendered, showing the OAuth pool form (not the generic API-key form).
  • Open the Anthropic Max card, walk through the OAuth flow, add an account, run a health check — all should work as before. Existing OAuth tokens from v1.0.0 should still authenticate (no migration needed because the option keys are unchanged).
  • Verify against other connector plugins active simultaneously (load-order shifts should no longer affect rendering).

Release

Bumps version 1.0.0 → 1.1.0 in:

  • plugin.php header + ANTHROPIC_MAX_AI_PROVIDER_VERSION constant
  • package.json
  • readme.txt Stable tag + new changelog entry (marked with BREAKING)
    🤖 Generated with Claude Code

Merged via PR #6 to main.
Merged by deterministic merge pass (pulse-wrapper.sh).

aidevops.sh v3.6.158 spent 7m on this as a headless bash routine.

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