Skip to content

Lovable sync 1780254455#550

Closed
adm01-debug wants to merge 19 commits into
mainfrom
lovable-sync-1780254455
Closed

Lovable sync 1780254455#550
adm01-debug wants to merge 19 commits into
mainfrom
lovable-sync-1780254455

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

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

📋 Descrição

🎯 Tipo de mudança

  • 🚀 feat — nova funcionalidade
  • 🐛 fix — correção de bug
  • ♻️ refactor — refatoração (sem mudança de comportamento)
  • 🔧 chore — manutenção, deps, config
  • 📚 docs — documentação
  • ⚡ perf — performance
  • 🔒 security — segurança
  • 🚨 hotfix — correção urgente em produção
  • 💥 breaking change — quebra compatibilidade

🔗 Issues relacionadas

Closes #
Refs #

🌐 Sistemas afetados

  • Bitrix24 (CRM, SPAs, BizProc)
  • Supabase (DB, Edge Functions, RLS, migrations)
  • n8n (workflows)
  • Evolution API / WhatsApp
  • Bling (NFe, OAuth)
  • Cloudflare (Workers, Images, Tunnels)
  • Frontend (UI, dashboards)
  • CI / GitHub Actions
  • Outro: ____

🧪 Como testar

✅ Checklist pré-merge

Qualidade

  • Código segue style guide (ESLint passa)
  • npx tsc --noEmit passa sem erros
  • Testes passam (npm run test)
  • Adicionei testes para novas funcionalidades quando aplicável
  • CodeRabbit revisou o PR (ou justificativa para skip)

Segurança

  • Sem secrets, tokens ou credenciais hardcoded
  • Variáveis de ambiente novas documentadas
  • Sem console.log com payloads sensíveis (usar logger.*)
  • RLS revisado se houve mudança em tabelas
  • Edge functions: input validado com Zod

Documentação

  • Atualizei docs (README / CHANGELOG / docs/) se necessário
  • Memória atualizada (mem://) se a mudança afetar arquitetura/regras
  • Migrations com backup em _backup_*_YYYYMMDD se destrutivas

UI

  • Componentes usam tokens semânticos (sem cores hardcoded)
  • Screenshots / vídeo anexados (se mudança visual)

📸 Screenshots (se UI)

🔄 Plano de rollback

⚠️ Notas para o reviewer


Summary by cubic

Introduces a virtualized Novidades grid with pagination and better accessibility, plus broader visual/a11y test coverage. Improves performance, avoids layout shifts, and adds robust error handling to prevent stock dashboard white screens.

  • New Features

    • Virtualized novelty grid with pagination, keyboard support, ARIA roles, and consistent card heights; updated page header.
    • Expanded Playwright suites for novelties (multi-viewport visual, Axe a11y, skeleton, pagination, card edge cases) and a stock regression check; CI shards visual tests and runs 2 workers.
    • Stock dashboard error UI with retry; clearer 410/Gone handling in the stock fetcher; useVariantStock now exposes error; added REST-native table whitelisting.
  • Bug Fixes

    • Reduced layout shifts in skeletons; uniform card alignment and min-heights.
    • Removed the Supabase connection debug card from Auth.

Written for commit abc7d10. Summary will update on new commits.

Review in cubic

lovable-dev Bot and others added 19 commits May 31, 2026 18:47
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-2861a40d-d258-4d19-aa54-31352a773f86
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-dcfc3e5b-15a6-4368-9747-c1e2a3a946b2
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-a613bb01-3be5-4e73-afb3-e58acf636175
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-6fa19df9-0496-4719-b1c5-a88eab685b36
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-70a1ae4f-e6ec-41f0-873e-f30970596f1d
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-f6465b77-0411-4059-9764-f972bb93fbed
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 31, 2026 19:59
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 31, 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 36 minutes and 22 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: cf06f3c3-fde6-4e1d-9671-2d147b1dee44

📥 Commits

Reviewing files that changed from the base of the PR and between e5c1c5c and abc7d10.

📒 Files selected for processing (15)
  • .github/workflows/visual-tests.yml
  • e2e/routes/app/novelty-card-variations.spec.ts
  • e2e/routes/app/novelty-grid-visual.spec.ts
  • playwright.config.ts
  • src/components/inventory/StockDashboard.tsx
  • src/components/loading/ModernSkeletons.tsx
  • src/components/novelties/NoveltyCards.tsx
  • src/components/novelties/NoveltyProductGrid.tsx
  • src/components/novelties/VirtualizedNoveltyGrid.tsx
  • src/hooks/products/useVariantStock.ts
  • src/hooks/stock/stockFetcher.ts
  • src/lib/external-db/rest-native.ts
  • src/pages/auth/Auth.tsx
  • src/pages/products/NoveltiesPage.tsx
  • tests/e2e/stock-regression.spec.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lovable-sync-1780254455

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

@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 2026

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

Project Deployment Actions Updated (UTC)
we-dream-big Ready Ready Preview, Comment May 31, 2026 7:59pm

@supabase
Copy link
Copy Markdown

supabase Bot commented May 31, 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 ↗︎.

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 adds a virtualized/paginated Novidades grid, improves stock-dashboard error handling, and expands Playwright visual/a11y coverage for the Novidades UI and stock regression paths.

Changes:

  • Adds a virtualized Novidades grid, pagination state, refreshed header styling, and keyboard handlers for novelty cards.
  • Surfaces stock-fetch errors in the dashboard and changes stock bridge failures to throw user-facing errors.
  • Adds/updates Playwright visual/a11y/regression specs and shards the visual-test workflow.

Reviewed changes

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

Show a summary per file
File Description
src/components/novelties/NoveltyProductGrid.tsx Adds pagination and switches grid rendering to the virtualized grid.
src/components/novelties/VirtualizedNoveltyGrid.tsx Introduces virtualized row rendering for novelty cards.
src/components/novelties/NoveltyCards.tsx Adds keyboard activation and ARIA metadata to novelty grid cards.
src/pages/products/NoveltiesPage.tsx Updates Novidades page header layout and test ids.
src/components/loading/ModernSkeletons.tsx Adjusts product-card skeleton sizing to reduce layout shift.
src/hooks/products/useVariantStock.ts Exposes React Query errors and limits retry attempts.
src/hooks/stock/stockFetcher.ts Throws clearer stock-fetch errors, including 410/Gone handling.
src/components/inventory/StockDashboard.tsx Adds an error state with retry UI.
src/lib/external-db/rest-native.ts Extends REST-native safe table whitelist.
src/pages/auth/Auth.tsx Removes Supabase connection debug UI from Auth.
playwright.config.ts Increases CI Playwright workers from 1 to 2.
.github/workflows/visual-tests.yml Shards visual tests and includes new Novidades visual specs.
e2e/routes/app/novelty-grid-visual.spec.ts Adds Novidades visual, accessibility, skeleton, and pagination checks.
e2e/routes/app/novelty-card-variations.spec.ts Adds visual checks for novelty card edge cases.
tests/e2e/stock-regression.spec.ts Adds stock dashboard regression coverage.

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

Comment on lines +605 to +608
{totalPages > 1 && (
<div className="mt-6 flex justify-center py-4">
<Pagination>
<PaginationContent>
Comment on lines +93 to +97
onClick={handleClick}
role="article"
aria-label={`${product.product_name} — ${getStockStatusLabel(stockStatus)}, ${formatPrice(product.base_price ?? 0)}`}
aria-selected={selectionMode ? isSelected : undefined}
tabIndex={0}
Comment on lines +1 to +3
import { test, expect } from '@playwright/test';

test.describe('Estoque Dashboard E2E', () => {
Comment on lines +127 to +131
await page.route('**/api/external-db', async route => {
if (route.request().postDataJSON()?.operation === 'select') {
await new Promise(resolve => setTimeout(resolve, 2000));
}
await route.continue();
Comment on lines +6 to +10
await context.route('**/functions/v1/novelties**', async route => {
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify([
Comment on lines +46 to +48
const header = page.locator('div.flex.flex-col.gap-4').first();
const title = header.locator('[data-testid="page-title-novidades"]');
const desc = header.locator('[data-testid="novelty-description"]');
Comment on lines +11 to +15
// Check for loading state first (if it appears)
const loadingState = page.locator('text=Sincronizando estoque');
if (await loadingState.isVisible()) {
// Wait for loading to finish
await expect(loadingState).not.toBeVisible({ timeout: 30000 });
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abc7d108f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

</div>
</div>

{totalPages > 1 && (
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Render pagination outside the fetching overlay

With more than 20 novelties, renderContent() now always passes only paginatedProducts to the grid, but these controls are nested inside the isFetching && products.length > 0 overlay above. After the initial load settles (isFetching is false), the grid remains capped to page 1 and users have no visible way to reach the remaining products; during refetch the controls also sit inside a pointer-events-none overlay, so they cannot be used then either.

Useful? React with 👍 / 👎.

Comment on lines +98 to +102
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
handleClick();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop card key handling from double-toggling the checkbox

When selection mode is active and a keyboard user focuses the SelectionCheckbox, pressing Space/Enter bubbles the keydown to this card handler, which toggles selection, and then the button's own click handler toggles it again. This makes the checkbox effectively unusable from the keyboard in the grid; the card-level handler should ignore events originating from nested controls or the checkbox should stop key propagation.

Useful? React with 👍 / 👎.

@@ -0,0 +1,49 @@
import { test, expect } from '@playwright/test';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Move the stock regression spec under the configured testDir

This new Playwright regression spec is placed in tests/e2e, but I checked playwright.config.ts and the configured testDir is ./e2e, with project testMatch patterns scoped under that directory. As a result, normal npx playwright test/CI discovery will not run this regression test, so the intended stock-dashboard coverage is currently absent unless someone invokes the file path manually.

Useful? React with 👍 / 👎.


test('Pagination & Alignment Check', async ({ page }) => {
// Mock enough products for multiple pages
await page.route('**/api/external-db', async route => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Mock the endpoint the novelties page actually calls

These pagination/variation tests depend on mocked novelty data, but the novelties hook reads the products table through invokeExternalDb/REST-native Supabase calls, not an **/api/external-db endpoint. In CI or local runs this route therefore will not intercept the page's data fetch, so the tests exercise whatever real/fallback data is returned and assertions such as waiting for a paginator with 45 mocked products will fail or become non-deterministic.

Useful? React with 👍 / 👎.

);
}

if (error) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve cached stock data on refresh errors

After the dashboard has successfully loaded, a later manual refresh or invalidation can fail while React Query still has the previous stock data cached. This unconditional error branch replaces the entire dashboard with the failure card in that scenario, hiding otherwise usable stale stock data; gate the full-page error on the absence of data or use the query's error status so refetch failures can be surfaced without blanking the dashboard.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Closing in favour of #553, which implements all features from this PR (and from #547, #549, #551, #552) on current main with three critical bugs fixed that were present across the Lovable-generated set:

  1. React Rules of Hooks violation in VariantStockTable — early return was placed between hook calls.
  2. Pagination trapped inside isFetching overlay in NoveltyProductGrid — pagination was invisible during normal browsing.
  3. Ellipsis logic collapsed navigable page buttons — fixed to use currentPage ± 2 boundary.

This branch also had merge conflicts with main due to the older base SHA.


Generated by Claude Code

@adm01-debug adm01-debug mentioned this pull request May 31, 2026
33 tasks
@adm01-debug adm01-debug mentioned this pull request May 31, 2026
33 tasks
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