Skip to content

chore(skill): improve port-widget audit and add --gaps mode#7020

Open
aymeric-giraudet wants to merge 2 commits into
masterfrom
chore/port-widget-skill-gaps-mode
Open

chore(skill): improve port-widget audit and add --gaps mode#7020
aymeric-giraudet wants to merge 2 commits into
masterfrom
chore/port-widget-skill-gaps-mode

Conversation

@aymeric-giraudet
Copy link
Copy Markdown
Member

Summary

  • Fix accuracy bugs in audit_widget_coverage.py: also looks for .ts JS widgets (was missing dynamic-widgets), treats variants (range-input, menu-select, range-slider) as reusing their upstream connector/hook instead of flagging them as missing, and matches Vue placeholder strings that don't follow PascalCase (e.g. singular RelatedProduct for related-products).
  • Add --gaps mode that lists every widget with open porting work, grouped by flavor, and separates real porting gaps from low-priority test-suite-only follow-ups.
  • Refresh SKILL.md around an audit-first workflow, add a variants table, a precedent picker, and a current-gap-shape snapshot.
  • Add a concrete annotated render-function template to references/vue-flavor.md (distilled from Hits.js/Feeds.js) that covers the recommendation/chat widgets still missing in Vue.
  • Drop an incorrect MenuSelect.tsx precedent reference from references/react-flavor.md.

Test plan

  • python3 .claude/skills/port-widget/scripts/audit_widget_coverage.py --gaps lists the expected React (numeric-menu, menu-select, rating-menu) and Vue (chat, filter-suggestions, frequently-bought-together, looking-similar, related-products, trending-facets, trending-items, autocomplete) gaps.
  • python3 .claude/skills/port-widget/scripts/audit_widget_coverage.py menu-select range-input dynamic-widgets related-products shows variant/special notes and the correct placeholder string for related-products.
  • python3 .claude/skills/port-widget/scripts/audit_widget_coverage.py refinement-list reports a fully covered widget with no notes.

The audit script previously missed widgets like `dynamic-widgets` (uses `.ts`,
not `.tsx`) and falsely flagged variants like `range-input`/`menu-select` as
missing their connector/hook. It also looked for Vue placeholders by exact
PascalCase match, missing irregular names like `RelatedProduct` (singular).
Adds a `--gaps` mode so contributors can see all open porting work across
flavors at a glance, and refreshes the skill docs around an audit-first
workflow with a Vue render-function template for the recommendation/chat
family of widgets.
Copilot AI review requested due to automatic review settings May 11, 2026 09:03
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 11, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 11, 2026

More templates

algoliasearch-helper

npm i https://pkg.pr.new/algolia/instantsearch/algoliasearch-helper@7020

instantsearch-ui-components

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch-ui-components@7020

instantsearch.css

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.css@7020

instantsearch.js

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.js@7020

react-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch@7020

react-instantsearch-core

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-core@7020

react-instantsearch-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-nextjs@7020

react-instantsearch-router-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-router-nextjs@7020

vue-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/vue-instantsearch@7020

commit: 7b8ec4e

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the “port-widget” skill’s repository audit tooling and documentation, aiming to make widget porting status across JS / React / Vue more accurate and actionable (including a new --gaps summary mode).

Changes:

  • Enhanced audit_widget_coverage.py to handle variant widgets, special layouts (e.g. dynamic-widgets), Vue placeholder name irregularities, and added a --gaps grouped summary mode.
  • Updated SKILL.md to promote an audit-first workflow and document variant/precedent guidance.
  • Refreshed Vue/React flavor reference docs (Vue render-function template + updated precedent lists).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
.claude/skills/port-widget/SKILL.md Updates workflow guidance, variant table, and adds a “precedent picker” to support audit-driven porting.
.claude/skills/port-widget/scripts/audit_widget_coverage.py Fixes audit accuracy and adds --gaps mode to summarize missing artifacts by flavor.
.claude/skills/port-widget/references/vue-flavor.md Expands Vue precedents and adds an annotated render-function wrapper template for shared UI factories.
.claude/skills/port-widget/references/react-flavor.md Adjusts React UI precedent list (removes incorrect MenuSelect.tsx reference).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +70 to +72
For these, the audit will show `no` on connector/hook rows by design. Skip
connector/hook creation, import the upstream hook directly, and only port the
wrapper plus wrapper tests.
Comment on lines +27 to +35
- Use `createSuitMixin({ name: '<Pascal>' })` for BEM classes. When the widget
delegates all rendering to a shared `createXxxComponent` factory, the suit
mixin's `suit()` method goes unused but the `classNames` prop it provides is
still convenient. Pass `this.classNames` directly to the shared component's
`classNames` prop (semantic keys like `{ root, container }`, not BEM keys).
- Expose connector params through a computed `widgetParams()` object.
- When reusing shared UI factories, wrap the render function with `renderCompat(...)` and map `this.classNames` into the `classNames` prop expected by the shared component.
- Prefer `getScopedSlot` or `getDefaultSlot` helpers over direct slot access when matching render-function components.
- In render-function callbacks that reference connector state (e.g. `onSubmit`, `onInput`), read from `this.state.xxx` instead of destructured locals. Vue batches re-renders, so destructured values become stale between synchronous user interactions (type then click).
- When reusing shared UI factories, wrap the render function with
`renderCompat(...)` and map `this.classNames` into the `classNames` prop
expected by the shared component.
Comment on lines +21 to +27
# Widgets that reuse another widget's connector/hook.
# A variant's connector and hook entries are expected to be absent.
VARIANTS: dict[str, str] = {
"menu-select": "menu", # uses connectMenu / useMenu
"range-input": "range", # uses connectRange / useRange
"range-slider": "range", # JS-only widget that uses connectRange
}
Comment on lines +48 to +53
# Vue widgets known to ship as `.js` render-function wrappers around a shared
# UI factory rather than `.vue` SFCs. Useful as precedents when porting newer
# recommendation/chat widgets.
VUE_RENDER_FUNCTION_PRECEDENTS = ("Hits.js", "Highlighter.js", "DynamicWidgets.js", "Feeds.js")


Comment on lines +147 to +150
hook_owner = variant_of
else:
connector_owner = widget
hook_owner = widget
Adds a "Pitfalls discovered while porting recommendation widgets" section
to the Vue reference, covering the Fragment shim, status tracking via
`createRecommendMixin`, async state delivery in test setups, Vue's
swallowed connector throws, and flavored test suites that need real Vue
widgetParams.

Captured while implementing the actual ports in a separate PR; surfacing
the lessons here so the next contributor doesn't have to rediscover them.
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