Skip to content

[REBASED → #482] fix(super-filtro): BUG-15 a BUG-22 + BUG-VOZ#480

Closed
adm01-debug wants to merge 9 commits into
mainfrom
fix/super-filtro-audit-bugs-15-23
Closed

[REBASED → #482] fix(super-filtro): BUG-15 a BUG-22 + BUG-VOZ#480
adm01-debug wants to merge 9 commits into
mainfrom
fix/super-filtro-audit-bugs-15-23

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

@adm01-debug adm01-debug commented May 26, 2026

Fechado: branch rebased sobre HEAD atual do main em rebase/480-super-filtro. PR substituto: #482 (aberto agora). Conflito causado por divergência de 33+ commits do Lovable. Os 8 arquivos únicos foram aplicados limpos, com fix adicional: != null → !== null (eqeqeq lint) em useFiltersPageState.ts. Testes: 27/27 passando.

Copilot AI review requested due to automatic review settings May 26, 2026 20:49
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
we-dream-big Error Error May 26, 2026 9:25pm

@supabase
Copy link
Copy Markdown

supabase Bot commented May 26, 2026

This pull request has been ignored for the connected project doufsxqlfjyuvxuezpln because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Warning

Review limit reached

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

More reviews will be available in 21 minutes and 56 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

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

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1d7130af-2152-4d83-835d-f2b07f9bd6ba

📥 Commits

Reviewing files that changed from the base of the PR and between 8fffcc6 and 318d386.

📒 Files selected for processing (8)
  • docs/bugs-super-filtro-audit-2026-05.md
  • src/components/filters/filter-panel/useFilterPanelState.ts
  • src/hooks/products/useCatalogFiltering.ts
  • src/hooks/products/useCatalogState.ts
  • src/pages/filters/useFiltersPageState.ts
  • src/pages/products/FiltersPage.tsx
  • src/types/product-catalog.ts
  • tests/hooks/super-filtro-bugfix-15-22.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/super-filtro-audit-bugs-15-23

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

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

Corrige uma nova rodada de bugs do módulo “Super Filtro” (FiltersPage + hooks relacionados), garantindo que filtros antes apenas “contados/chipeados” passem a afetar de fato o pipeline de filtragem, além de ajustar thresholds de priceRange e um mapeamento de sort do voice agent.

Changes:

  • Adiciona filtros faltantes no useFiltersPageState (featured, isNew→newArrival, hasPersonalization, gender, sizes) e ajusta a origem da query do fuzzy search.
  • Corrige a ativação/contagem do filtro de preço no catálogo (< 500< 9999) e mitiga stale closure no debounce do painel de filtros via refs.
  • Inclui casos de ordenação faltantes no sortMap do voice agent e adiciona testes/documentação de auditoria.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/hooks/super-filtro-bugfix-15-22.test.ts Adiciona testes de regressão para os bugs 15–22 e voice sorting.
src/types/product-catalog.ts Inclui hasPersonalization no tipo Product.
src/pages/products/FiltersPage.tsx Completa sortMap do voice agent com best-sellers.
src/pages/filters/useFiltersPageState.ts Aplica filtros ausentes (featured/isNew/hasPersonalization/gender/sizes) e ajusta fuzzy query.
src/hooks/products/useCatalogState.ts Corrige contagem de filtro ativo para priceRange (threshold).
src/hooks/products/useCatalogFiltering.ts Corrige ativação do filtro priceRange (threshold).
src/components/filters/filter-panel/useFilterPanelState.ts Evita stale closure no debounce de search via refs.
docs/bugs-super-filtro-audit-2026-05.md Documenta auditoria e bugs corrigidos/TODOs.

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

Comment on lines +399 to +403
if (filters.isNew) result = result.filter((product) => product.newArrival === true);
// BUG-15c FIX (parte 2): hasPersonalization — tipo corrigido em commit anterior; filtro aplicado aqui.
if (filters.hasPersonalization)
result = result.filter((product) => product.hasPersonalization === true);
// BUG-16 FIX: gender era contabilizado/chipeado mas sem bloco de filtro.
Comment on lines +282 to 289
// BUG-20 FIX: usar filters.search como fonte primária (imediata) em vez de
// searchParams.get('search') que fica stale por 1 render frame após setFilters.
// O fallback para searchParams mantém compatibilidade com links diretos via URL.
const fuzzySearchQuery = filters.search || searchParams.get('search') || '';
const { results: fuzzySearchResults, hasSearch: hasFuzzySearch } = useProductFuzzySearch(
realProducts,
searchQuery,
fuzzySearchQuery,
);
Comment on lines +52 to +53
/** BUG-15c: adicionado para suportar filtro hasPersonalization no Super Filtro e Catálogo.
* Mapeado do campo has_personalization na DB (via product mapper). */
Comment on lines +37 to +38
useEffect(() => { filtersRef.current = filters; });
useEffect(() => { onFilterChangeRef.current = onFilterChange; });
Comment on lines +58 to +67
describe('BUG-15a — filtro featured', () => {
it('deve incluir apenas produtos com featured=true quando filtro ativo', () => {
const products = [
makeProduct({ id: '1', featured: true }),
makeProduct({ id: '2', featured: false }),
makeProduct({ id: '3' }), // featured undefined → falsy
];

const result = products.filter((p) => p.featured === true);
expect(result).toHaveLength(1);
Comment on lines +176 to +183
makeProduct({
id: '1',
variations: [{ size_code: 'M', stock: 10 }] as never,
}),
makeProduct({
id: '2',
variations: [{ size_code: 'G', stock: 5 }] as never,
}),
const products = [
makeProduct({ id: '1', featured: true }),
makeProduct({ id: '2', featured: false }),
makeProduct({ id: '3' }), // featured undefined → falsy
@adm01-debug adm01-debug changed the title fix(super-filtro): auditoria round 2 — BUG-15 a BUG-22 + BUG-VOZ (8 bugs, 6 arquivos) [REBASED → #482] fix(super-filtro): BUG-15 a BUG-22 + BUG-VOZ May 26, 2026
adm01-debug added a commit that referenced this pull request May 26, 2026
#485)

Incorpora PR #480 (fix/super-filtro-audit-bugs-15-23) sobre HEAD atual do main.

BUG-15a — featured: contabilizado/chipeado mas sem filtro no useMemo → adicionado
BUG-15b — isNew: filtro usava product.isNew (inexistente) → product.newArrival
BUG-15c — hasPersonalization: ausente do tipo Product → adicionado em product-catalog.ts
BUG-16  — gender: contabilizado mas sem bloco de filtro → adicionado
BUG-17  — sizes: contabilizado mas sem filtro via variations.size_code → adicionado
BUG-19  — stale closure em debouncedSearch: filtersRef+onFilterChangeRef pattern
BUG-20  — fuzzySearchQuery usava searchParams.get stale → usa filters.search
BUG-21  — priceRange threshold < 500 → < 9999 em useCatalogFiltering
BUG-22  — activeFiltersCount priceRange < 500 → < 9999 em useCatalogState
BUG-VOZ — sortMap sem best-seller-supplier/promo → adicionados em FiltersPage.tsx

fix(lint): != null → !== null (eqeqeq) em useFiltersPageState.ts linha 415

Testes: 27/27 passando (super-filtro-bugfix-15-22.test.ts)

Co-authored-by: Claude <noreply@anthropic.com>
@adm01-debug adm01-debug deleted the fix/super-filtro-audit-bugs-15-23 branch May 29, 2026 13:37
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