Skip to content

RedHerb integration probes cleanups (PR #781 follow-up)#791

Merged
malberts merged 9 commits intofrontend-extensibilityfrom
redherb-sidebar-panel-review-fixes
Apr 29, 2026
Merged

RedHerb integration probes cleanups (PR #781 follow-up)#791
malberts merged 9 commits intofrontend-extensibilityfrom
redherb-sidebar-panel-review-fixes

Conversation

@alistair3149
Copy link
Copy Markdown
Member

@alistair3149 alistair3149 commented Apr 28, 2026

Result of code review of #781 with @alistair3149.
Context: the NeoWiki codebase, the frontend-extensibility branch, and live verification of which findings were worth acting on.
Written by Claude Code, Opus 4.7 (1M context)

Follows-up to #781

Targets redherb-sidebar-panel so this lands as a stacked review fix into #781 once approved.

Addressed

Eight commits, one per finding (read in branch order):

  1. Rename ext.redherb-sidebarext.redherb-subject-finder — only loaded by Special:RedHerbSubjectFinder; old name was misleading.
  2. Use fresh DerivativeContext + OutputPage in testRegistersResourceLoaderModules — was order-dependent on RequestContext::getMain().
  3. SubjectFinderPanel.onSelected — add .catch() so a load failure logs and notifies instead of silently half-loading.
  4. CreateChildDialog.loadSchema.catch() now logs / notifies / closes instead of silently nulling state.
  5. Move DIALOG_OPEN_KEY / DIALOG_STATE_KEY into per-module constants.js; init.js and .vue share via require() instead of duplicated string literals.
  6. Add RedHerbFrontendModulesHookTest to pin the module-name contract.
  7. Drop unused mediawiki.skin.variables.less imports from both dialog components.
  8. Replace wfMessage(...) with $skin->msg(...) in RedHerbSidebarHook (context-aware lookup instead of RequestContext::getMain()); test stubs updated to mock Skin::msg() via a shared newSkinStub( Title $title ) helper that also dedupes the previous inline stubs.

Not addressed

Manual Browser Check

  1. Visit Special:RedHerbSubjectFinder. Type a schema name, select a subject from the lookup, confirm the infobox renders.
  2. On a content page with a main subject, click Create child Company in the sidebar. Fill the dialog, save. Confirm the success notification and the new subject on ?action=subjects.
  3. Same page, click Edit main subject. Change the label, save. Confirm the existing infobox re-renders without reload.
  4. Confirm the browser network tab on the special page loads ext.redherb-subject-finder (renamed), not ext.redherb-sidebar.
  5. Optional error path: take the API offline and load the special page; pick a subject — confirm an error notification fires instead of a silent half-load.

Verification

Local run on this branch (NeoWiki dev container, MW REL1_43, PHP 8.3):

  • make phpunitOK, 858 tests, 1636 assertions, 7 skipped (28s)
  • vendor/bin/phpcs — clean, 328 files (5s)
  • vendor/bin/phpstan[OK] No errors, 150 files

Browser pass (Chrome DevTools, against the running dev wiki on this branch):

  • Step 1Special:RedHerbSubjectFinder with Schema = Company, picked ACME Inc., the Infobox renders all properties (Founded at, Websites, Products, Status, World domination progress).
  • Step 2Create child Company opens the SubjectEditor-backed dialog; Status = Active, label Test Subsidiary, Create returns 201 from POST /rest.php/neowiki/v0/page/24/childSubjects; dialog auto-closes; ?action=subjects shows Test Subsidiary Company • 1 statement.
  • Step 3Edit main subject opens pre-populated with all ACME Inc. statements (label, founded, websites, products, status, progress). Changed label to ACME Incorporated; on save the page-side Infobox <h2> reactively updates from ACME Inc.ACME Incorporated with no reload, and Updated main subject. mw-notify fires. This is the cross-app shared-Pinia path Add frontend-extensibility probes to RedHerb #781 is meant to prove out.
  • Step 4 — network shows load.php?...modules=ext.redherb-create-child,redherb-edit-main-subject,redherb-subject-finder...; no stale ext.redherb-sidebar reference.
  • Step 5 (offline error path) skipped — invasive on the dev environment; the unit-tested .catch() handlers in commits 3 and 4 cover the same code path.

@alistair3149 alistair3149 force-pushed the redherb-sidebar-panel-review-fixes branch from 764719e to 59544cd Compare April 28, 2026 04:39
@alistair3149 alistair3149 changed the title Address review feedback on RedHerb integration probes RedHerb integration probes clean ups (PR #781 follow-up) Apr 28, 2026
@alistair3149 alistair3149 changed the title RedHerb integration probes clean ups (PR #781 follow-up) RedHerb integration probes cleanups (PR #781 follow-up) Apr 28, 2026
@alistair3149 alistair3149 force-pushed the redherb-sidebar-panel-review-fixes branch from 85b0092 to 213201d Compare April 28, 2026 04:50
@alistair3149 alistair3149 marked this pull request as ready for review April 28, 2026 04:57
@alistair3149 alistair3149 requested a review from malberts April 28, 2026 04:57
Base automatically changed from redherb-sidebar-panel to frontend-extensibility April 28, 2026 15:13
@malberts malberts force-pushed the frontend-extensibility branch from cf6af02 to 1635dc3 Compare April 29, 2026 00:07
alistair3149 and others added 8 commits April 29, 2026 02:20
The module is loaded only by Special:RedHerbSubjectFinder and bundles
the finder UI; the old name suggested it was for the wiki sidebar.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
testRegistersResourceLoaderModules called execute() on a SpecialPage
without setting a context, falling back to RequestContext::getMain()'s
shared OutputPage and making the test order-dependent.

Construct a DerivativeContext + OutputPage explicitly, mirroring what
SpecialPageExecutor does for the other test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
loadSubjectsAndSchemas had no .catch(); a network failure left the
panel half-loaded with no user feedback. Log and notify on failure to
match the pattern used in CreateChildDialog's save path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The loadSchema .catch() silently set loadedSchema = null, leaving the
dialog open with the editor v-if=false and no user feedback. Log,
notify, and close the dialog on failure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The provide/inject string was duplicated between init.js and the dialog
component in both createChild and editMainSubject; drift would cause
inject to return undefined and silently break the dialog. Move each
key to a per-module constants.js required from both sides.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The hook is the single source of truth for which RedHerb dialog modules
load on every NeoWiki page; pin the contract so a typo or rename in
extension.json fails the test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Neither dialog uses any LESS variable; the *-mount classes only set
display: contents. Drop the mediawiki.skin.variables.less imports.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Hook handlers should use the context-aware msg() method when a Skin or
IContextSource is in scope, rather than the wfMessage() global which
resolves through RequestContext::getMain().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@malberts malberts force-pushed the redherb-sidebar-panel-review-fixes branch from 213201d to 08ce879 Compare April 29, 2026 00:22
The unprefixed RawMessage class is a class_alias shim; the canonical
name in MW 1.43 is MediaWiki\Language\RawMessage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@malberts malberts merged commit 2fa0c7a into frontend-extensibility Apr 29, 2026
6 checks passed
@malberts malberts deleted the redherb-sidebar-panel-review-fixes branch April 29, 2026 09:35
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.

2 participants