Skip to content

Lovable sync 1777291944#16

Merged
adm01-debug merged 0 commit into
mainfrom
lovable-sync-1777291944
Apr 27, 2026
Merged

Lovable sync 1777291944#16
adm01-debug merged 0 commit into
mainfrom
lovable-sync-1777291944

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

@adm01-debug adm01-debug commented Apr 27, 2026

Superseded — main is now at f3e6de1c (was lovable-sync-1777296493 HEAD, the most recent Lovable sync). This PR's branch is an earlier snapshot of the same development line and is fully contained in main now. Closing.

See PR #17 for the analysis of why this consolidation was needed and how it was done.

Copilot AI review requested due to automatic review settings April 27, 2026 12:27
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

Important

Review skipped

Too many files!

This PR contains 299 files, which is 149 over the limit of 150.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 78cf1152-01ed-4c65-8f02-9381c517c0f1

📥 Commits

Reviewing files that changed from the base of the PR and between 930e599 and 41decbc.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (299)
  • .env.e2e.example
  • .github/workflows/ci.yml
  • .github/workflows/e2e.yml
  • .gitignore
  • .lovable/memory/features/simulation-price-source-badge.md
  • .lovable/memory/integrations/connections-hub.md
  • .lovable/plan.md
  • docs/E2E_SMOKE_COVERAGE.md
  • docs/RBAC_HELPERS.md
  • docs/security/RLS_MATRIX.md
  • docs/security/SELLER_SCOPE_CHECKER.md
  • docs/testing/STRICT_REF_WARNING_GATE.md
  • e2e/.gitignore
  • e2e/README.md
  • e2e/admin-conexoes-credentials-active-products.spec.ts
  • e2e/admin-conexoes-zone-collapse.spec.ts
  • e2e/auth.spec.ts
  • e2e/fixtures/auth.setup.ts
  • e2e/fixtures/selectors.ts
  • e2e/fixtures/test-base.ts
  • e2e/fixtures/test-user.ts
  • e2e/flows/01-auth.spec.ts
  • e2e/flows/02-navigation.spec.ts
  • e2e/flows/03-products.spec.ts
  • e2e/flows/04-quotes.spec.ts
  • e2e/flows/05-orders.spec.ts
  • e2e/flows/06-kit-builder.spec.ts
  • e2e/flows/07-collections.spec.ts
  • e2e/flows/08-favorites.spec.ts
  • e2e/flows/09-favorite-from-detail.spec.ts
  • e2e/flows/09-simulator.spec.ts
  • e2e/flows/10-admin.spec.ts
  • e2e/flows/10-favorites-persistence-storage.spec.ts
  • e2e/flows/11-errors.spec.ts
  • e2e/flows/12-cart-checkout.spec.ts
  • e2e/flows/13-favorites-empty-state.spec.ts
  • e2e/flows/14-favorites-remove-persistence.spec.ts
  • e2e/flows/15-favorites-invalid-payload.spec.ts
  • e2e/flows/15-favorites-spa-navigation.spec.ts
  • e2e/flows/16-favorites-storage-persistence.spec.ts
  • e2e/flows/17-favorites-cookies-persistence.spec.ts
  • e2e/flows/18-favorites-clear-reload-cycle.spec.ts
  • e2e/flows/19-favorites-api-intercept.spec.ts
  • e2e/flows/20-all-features-smoke.spec.ts
  • e2e/flows/21-feature-matrix.spec.ts
  • e2e/flows/p0/01-auth-recovery.spec.ts
  • e2e/flows/p0/02-catalog-degraded.spec.ts
  • e2e/flows/p0/03-quote-blocked.spec.ts
  • e2e/flows/p0/04-checkout-blocked.spec.ts
  • e2e/flows/p0/05-admin-down.spec.ts
  • e2e/flows/p0/README.md
  • e2e/flows/p0/_mocks.ts
  • e2e/global-setup.ts
  • e2e/global-teardown.ts
  • e2e/helpers/auth.ts
  • e2e/helpers/cleanup-client.ts
  • e2e/helpers/e2e-resources.ts
  • e2e/helpers/evidence.ts
  • e2e/helpers/favorites.ts
  • e2e/helpers/forms.ts
  • e2e/helpers/nav.ts
  • e2e/helpers/waits.ts
  • e2e/login.spec.ts
  • e2e/routes/README.md
  • e2e/routes/_catalog.ts
  • e2e/routes/_factories.ts
  • e2e/routes/_shared.ts
  • e2e/routes/admin/ai-usage.spec.ts
  • e2e/routes/admin/cadastros.spec.ts
  • e2e/routes/admin/conexoes.spec.ts
  • e2e/routes/admin/limites-desconto.spec.ts
  • e2e/routes/admin/login-attempts.spec.ts
  • e2e/routes/admin/migracao-papeis.spec.ts
  • e2e/routes/admin/permissions.spec.ts
  • e2e/routes/admin/price-freshness.spec.ts
  • e2e/routes/admin/prompts-ia.spec.ts
  • e2e/routes/admin/rate-limit.spec.ts
  • e2e/routes/admin/rls-denials.spec.ts
  • e2e/routes/admin/role-permissions.spec.ts
  • e2e/routes/admin/roles.spec.ts
  • e2e/routes/admin/seguranca-chaves.spec.ts
  • e2e/routes/admin/seguranca.spec.ts
  • e2e/routes/admin/system-status.spec.ts
  • e2e/routes/admin/telemetry.spec.ts
  • e2e/routes/admin/usuarios.spec.ts
  • e2e/routes/admin/video-variants.spec.ts
  • e2e/routes/admin/workflows.spec.ts
  • e2e/routes/app/advanced-price-search.spec.ts
  • e2e/routes/app/business-intelligence.spec.ts
  • e2e/routes/app/carrinhos.spec.ts
  • e2e/routes/app/cliente-comparator.spec.ts
  • e2e/routes/app/colecao-detail.spec.ts
  • e2e/routes/app/colecoes.spec.ts
  • e2e/routes/app/comercial-intelligence.spec.ts
  • e2e/routes/app/comparar.spec.ts
  • e2e/routes/app/dashboard.spec.ts
  • e2e/routes/app/dropbox.spec.ts
  • e2e/routes/app/favoritos.spec.ts
  • e2e/routes/app/kit-builder.spec.ts
  • e2e/routes/app/kit-library.spec.ts
  • e2e/routes/app/magic-up.spec.ts
  • e2e/routes/app/mockup-generator.spec.ts
  • e2e/routes/app/mockup-history.spec.ts
  • e2e/routes/app/novidades.spec.ts
  • e2e/routes/app/pedido-detail.spec.ts
  • e2e/routes/app/pedidos.spec.ts
  • e2e/routes/app/product-match.spec.ts
  • e2e/routes/app/produto-detail.spec.ts
  • e2e/routes/app/produtos.spec.ts
  • e2e/routes/app/replenishments.spec.ts
  • e2e/routes/app/simulador-precos.spec.ts
  • e2e/routes/app/simulador.spec.ts
  • e2e/routes/app/stock-dashboard.spec.ts
  • e2e/routes/app/tendencias.spec.ts
  • e2e/routes/public/approve.spec.ts
  • e2e/routes/public/colecao-publica.spec.ts
  • e2e/routes/public/comparar-publica.spec.ts
  • e2e/routes/public/dossie.spec.ts
  • e2e/routes/public/kit-publico.spec.ts
  • e2e/routes/public/lista-publica.spec.ts
  • e2e/routes/public/login.spec.ts
  • e2e/routes/public/reset-password.spec.ts
  • e2e/routes/quotes/dashboard.spec.ts
  • e2e/routes/quotes/detail.spec.ts
  • e2e/routes/quotes/editar.spec.ts
  • e2e/routes/quotes/kanban.spec.ts
  • e2e/routes/quotes/lista.spec.ts
  • e2e/routes/quotes/novo.spec.ts
  • e2e/routes/quotes/templates.spec.ts
  • e2e/routes/quotes/view.spec.ts
  • eslint.config.js
  • index.html
  • package.json
  • playwright.config.ts
  • scripts/audit-technical-rls.sql
  • scripts/check-aschild-nesting.mjs
  • scripts/check-price-freshness-coverage.mjs
  • scripts/check-route-error-element.mjs
  • scripts/check-route-ref-usage.mjs
  • scripts/check-security-definer-acl.mjs
  • scripts/check-seller-scope.mjs
  • scripts/check-smoke-tags.mjs
  • scripts/consolidate-console-snapshot.mjs
  • scripts/e2e-feature-summary.mjs
  • scripts/e2e-smoke-coverage-doc.mjs
  • scripts/e2e-smoke-summary.mjs
  • scripts/fix-edge-cors-allowlist.mjs
  • scripts/migrate-edge-cors-allowlist.mjs
  • scripts/run-smoke-filtered.mjs
  • scripts/smoke-tests.mjs
  • scripts/typecheck-edge-functions.mjs
  • src/App.tsx
  • src/components/BridgeStatusBanner.tsx
  • src/components/RoleBadge.tsx
  • src/components/access/DevAccessDeniedPage.tsx
  • src/components/admin/DevAccessAuditAlert.tsx
  • src/components/admin/DiscountApprovalHeaderBadge.tsx
  • src/components/admin/DiscountApprovalQueue.tsx
  • src/components/admin/OwnershipRepairDialog.tsx
  • src/components/admin/RlsIntegrationTestsDialog.tsx
  • src/components/admin/connections/AutoTestIntervalCard.tsx
  • src/components/admin/connections/AutoTestJobStatusCard.tsx
  • src/components/admin/connections/Bitrix24Tab.tsx
  • src/components/admin/connections/BridgeProductsPreviewPanel.tsx
  • src/components/admin/connections/CardSourceDiagnostic.tsx
  • src/components/admin/connections/ConnectionDetailsDialog.tsx
  • src/components/admin/connections/ConnectionErrorDetailsDialog.tsx
  • src/components/admin/connections/ConnectionPreflightAlert.tsx
  • src/components/admin/connections/ConnectionRowSourceBadge.tsx
  • src/components/admin/connections/ConnectionStatusBadge.tsx
  • src/components/admin/connections/ConnectionTestDetailsDialog.tsx
  • src/components/admin/connections/ConnectionTestHistoryPanel.tsx
  • src/components/admin/connections/ConnectionTimelineDrawer.tsx
  • src/components/admin/connections/ConnectionsIncidentStrip.tsx
  • src/components/admin/connections/ConnectionsOverviewFilters.tsx
  • src/components/admin/connections/ConnectionsOverviewTable.tsx
  • src/components/admin/connections/ConnectionsPulseBar.tsx
  • src/components/admin/connections/CredentialCacheMetricsPanel.tsx
  • src/components/admin/connections/CredentialSourceBadge.tsx
  • src/components/admin/connections/CredentialsChangedBanner.tsx
  • src/components/admin/connections/CredentialsSourceFilter.tsx
  • src/components/admin/connections/CredentialsSourceFilterContext.tsx
  • src/components/admin/connections/CredentialsSourceIndicator.tsx
  • src/components/admin/connections/DataSourceDebugTab.tsx
  • src/components/admin/connections/ErrorDetailsDialog.tsx
  • src/components/admin/connections/ExpectedKeysMatchPanel.tsx
  • src/components/admin/connections/ExplainModeContext.tsx
  • src/components/admin/connections/ExplainModeToggle.tsx
  • src/components/admin/connections/ExternalConnectionsSyncLogPanel.tsx
  • src/components/admin/connections/FailureWindowCard.tsx
  • src/components/admin/connections/FieldSourceDrillDownDialog.tsx
  • src/components/admin/connections/GitHubCredentialsTester.tsx
  • src/components/admin/connections/GlobalRefreshFromDbButton.tsx
  • src/components/admin/connections/HeaderSeveritySummary.tsx
  • src/components/admin/connections/IncidentDetailsDrawer.tsx
  • src/components/admin/connections/IncidentTimeline72h.tsx
  • src/components/admin/connections/IntegrationsHealthCard.tsx
  • src/components/admin/connections/IssueMcpKeyForm.tsx
  • src/components/admin/connections/JustSavedFlash.tsx
  • src/components/admin/connections/KeysValidationTab.tsx
  • src/components/admin/connections/KpiExplainTooltip.tsx
  • src/components/admin/connections/LastSyncRunPanel.tsx
  • src/components/admin/connections/LastTestLine.tsx
  • src/components/admin/connections/LatencyBadge.tsx
  • src/components/admin/connections/MaskedSuffixBadge.tsx
  • src/components/admin/connections/McpTab.tsx
  • src/components/admin/connections/N8nTab.tsx
  • src/components/admin/connections/RefreshFromDbButton.tsx
  • src/components/admin/connections/RetestButton.tsx
  • src/components/admin/connections/RetestCooldownSelector.tsx
  • src/components/admin/connections/RotateSecretConfirmDialog.tsx
  • src/components/admin/connections/RotationHistoryDialog.tsx
  • src/components/admin/connections/RotationHistoryRow.tsx
  • src/components/admin/connections/SaveSecretConfirmDialog.tsx
  • src/components/admin/connections/SecretErrorAlert.tsx
  • src/components/admin/connections/SecretField.tsx
  • src/components/admin/connections/SecretImpactTooltip.tsx
  • src/components/admin/connections/SecretMaskedDiff.tsx
  • src/components/admin/connections/SecretsManagerHealthPanel.tsx
  • src/components/admin/connections/SeverityFilterContext.tsx
  • src/components/admin/connections/SeverityFilterControl.tsx
  • src/components/admin/connections/SeverityFilterToolbar.tsx
  • src/components/admin/connections/SmokeTestChecklist.tsx
  • src/components/admin/connections/SupabaseConnectionsTab.tsx
  • src/components/admin/connections/TestAllConnectionsButton.tsx
  • src/components/admin/connections/TestProgressIndicator.tsx
  • src/components/admin/connections/WebhooksTab.tsx
  • src/components/admin/connections/ZoneCommandPalette.tsx
  • src/components/admin/connections/ZoneCommandTrigger.tsx
  • src/components/admin/connections/ZoneQuickNav.tsx
  • src/components/admin/connections/ZoneRefreshButton.tsx
  • src/components/admin/connections/ZoneSection.tsx
  • src/components/admin/connections/connectionStatus.ts
  • src/components/admin/connections/incidentZoneMapping.ts
  • src/components/admin/connections/secretErrors.ts
  • src/components/admin/connections/secretImpactMap.ts
  • src/components/admin/connections/secretNormalizers.ts
  • src/components/admin/connections/secretRetry.ts
  • src/components/admin/connections/secretValidators.ts
  • src/components/admin/connections/secretWhitelist.ts
  • src/components/admin/connections/useFocusContext.ts
  • src/components/admin/connections/useIncidentDetails.ts
  • src/components/admin/connections/useIncidentSeverityCounts.ts
  • src/components/admin/connections/useIncidentTimeline72h.ts
  • src/components/admin/connections/usePulseBarStatus.ts
  • src/components/admin/connections/useRecentIncidents.ts
  • src/components/admin/connections/useSeverityChangeNotifier.ts
  • src/components/admin/connections/useZoneCollapse.ts
  • src/components/admin/connections/useZoneVisibility.ts
  • src/components/admin/products/sections/engraving/types.ts
  • src/components/admin/security/RlsAuditPanel.tsx
  • src/components/admin/security/keys/McpKeyDetailsDrawer.tsx
  • src/components/admin/security/keys/McpKeyRow.tsx
  • src/components/admin/security/keys/McpKeysFilters.tsx
  • src/components/admin/security/keys/McpKeysList.tsx
  • src/components/admin/security/keys/RotateMcpKeyDialog.tsx
  • src/components/admin/security/keys/UpdateMcpKeyDialog.tsx
  • src/components/admin/security/keys/audit/AutoRevocationsPanel.tsx
  • src/components/admin/security/keys/audit/McpAuditFeed.tsx
  • src/components/admin/security/keys/audit/McpAuditFilters.tsx
  • src/components/admin/security/keys/audit/McpAuditRow.tsx
  • src/components/admin/security/keys/audit/StepUpAttemptsPanel.tsx
  • src/components/admin/security/keys/audit/useAutoRevocations.ts
  • src/components/admin/security/keys/audit/useMcpAuditFeed.ts
  • src/components/admin/security/keys/audit/useStepUpAttempts.ts
  • src/components/admin/security/keys/diagnostics/FullOpDiagnosticsPanel.tsx
  • src/components/admin/security/keys/useCanGrantMcpFull.ts
  • src/components/admin/security/keys/useMcpKeys.ts
  • src/components/admin/security/role-migration/RoleMigrationPanel.tsx
  • src/components/admin/techniques-manager/TechniqueTable.tsx
  • src/components/admin/telemetry/BreakerStatusCard.tsx
  • src/components/admin/telemetry/BridgeAlertsCard.tsx
  • src/components/admin/telemetry/BridgeCallDetailDrawer.tsx
  • src/components/admin/telemetry/BridgesLiveCard.tsx
  • src/components/admin/telemetry/ColdStartRetriesPanel.tsx
  • src/components/admin/telemetry/ColdVsWarmCrmCard.tsx
  • src/components/admin/telemetry/EdgeFunctionLogsPanel.tsx
  • src/components/admin/telemetry/HighLimitTelemetryCard.tsx
  • src/components/admin/telemetry/InstrumentationToggleButton.tsx
  • src/components/admin/telemetry/OptimizationMetricsCards.tsx
  • src/components/admin/telemetry/OptimizationQueuePanel.tsx
  • src/components/admin/telemetry/PlatformFailureAlertBanner.tsx
  • src/components/admin/telemetry/PlatformFailureCards.tsx
  • src/components/admin/telemetry/ProductsListingLatencyAlert.tsx
  • src/components/admin/telemetry/RegressionGuardrailBanner.tsx
  • src/components/admin/telemetry/ResolveProductsSelectComparisonCard.tsx
  • src/components/admin/users/CreateUserDialog.tsx
  • src/components/admin/users/PromotionDialog.tsx
  • src/components/admin/users/RoleAuditLogPanel.tsx
  • src/components/admin/users/RoleChangeDialog.tsx
  • src/components/admin/users/UserStatsCards.tsx
  • src/components/admin/users/UserTable.tsx
  • src/components/admin/users/types.tsx
  • src/components/admin/users/useUserManagement.ts
  • src/components/auth/ForgotPasswordForm.tsx
  • src/components/auth/StepUpAuthDialog.tsx
  • src/components/cart/CartCompanyPickerDialog.tsx
  • src/components/cart/CartHeaderButton.tsx
  • src/components/cart/CartTabsRich.tsx

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lovable-sync-1777291944

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.

Copy link
Copy Markdown

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR introduces a more robust admin “connections” experience (credential-source visibility, preflight validation, refresh UX), and significantly expands CI safety rails and E2E test infrastructure (route-based suites, smoke filtering, and security/quality gates).

Changes:

  • Adds admin UI components for credential-source filtering/badges, connection preflight alerts, realtime “credentials changed” banner, and auto-test interval configuration.
  • Adds multiple CI/dev tooling scripts (edge function typecheck, security/RLS gates, seller-scope checker, route-error-element checker, asChild nesting checker) and expands E2E coverage with new fixtures/helpers and route-based specs.
  • Updates ESLint configuration and E2E npm scripts (smoke vs regression split, smoke filtering wrapper, coverage gates).

Reviewed changes

Copilot reviewed 182 out of 853 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/components/admin/connections/CredentialsSourceFilterContext.tsx Adds URL-param-backed context for filtering secrets by source.
src/components/admin/connections/CredentialsSourceFilter.tsx Adds UI chips + keyboard shortcut for credential source filtering.
src/components/admin/connections/CredentialsChangedBanner.tsx Adds realtime banner reacting to DB credential changes + refresh action.
src/components/admin/connections/CredentialSourceBadge.tsx Adds per-secret source badge with tooltip.
src/components/admin/connections/ConnectionTimelineDrawer.tsx Adds controlled/open props and optional trigger hiding for drawer.
src/components/admin/connections/ConnectionStatusBadge.tsx Extends badge statuses with never_tested.
src/components/admin/connections/ConnectionRowSourceBadge.tsx Adds aggregated credential-source badge per connection row.
src/components/admin/connections/ConnectionPreflightAlert.tsx Adds inline alert listing preflight validation issues.
src/components/admin/connections/Bitrix24Tab.tsx Enhances tab with last-test hydration, preflight gating, and richer test UX.
src/components/admin/connections/AutoTestIntervalCard.tsx Adds admin UI to view/change connections auto-test interval via RPC.
src/components/admin/RlsIntegrationTestsDialog.tsx Adds dialog to invoke RLS integration tests edge function and display results.
src/components/admin/DiscountApprovalQueue.tsx Adds // rls-allow: annotations for seller-scope checker allowlisting.
src/components/admin/DiscountApprovalHeaderBadge.tsx Adds // rls-allow: annotation for seller-scope checker allowlisting.
src/components/admin/DevAccessAuditAlert.tsx Adds dev-only RBAC mismatch alert + drill-down list.
src/components/RoleBadge.tsx Adds canonical reusable role badge component using shared role visuals.
src/components/BridgeStatusBanner.tsx Adds global banner/toasts for external-db-bridge degraded/unavailable/recovered events.
scripts/typecheck-edge-functions.mjs Adds Deno-based typecheck runner for all edge functions.
scripts/run-smoke-filtered.mjs Adds wrapper to run smoke suite with an additional grep filter.
scripts/migrate-edge-cors-allowlist.mjs Adds one-shot codemod to migrate edge CORS headers to shared allowlist helper.
scripts/fix-edge-cors-allowlist.mjs Adds patch script to reintroduce corsHeaders declaration when missing.
scripts/consolidate-console-snapshot.mjs Adds snapshot consolidation + gate for React ref-warning collection.
scripts/check-seller-scope.mjs Adds CI gate ensuring seller-scoped queries for critical tables or inline allowlist.
scripts/check-security-definer-acl.mjs Adds CI gate validating Security Definer function ACLs via RPC audit.
scripts/check-route-error-element.mjs Adds CI gate preventing data-router APIs in declarative Routes contexts.
scripts/check-price-freshness-coverage.mjs Adds per-file coverage threshold gate for price freshness logic/UI.
scripts/check-aschild-nesting.mjs Adds CI gate detecting nested asChild triggers without DOM wrapper.
package.json Updates E2E commands (smoke vs regression), adds multiple new CI checker scripts.
index.html Clarifies which security headers belong in HTTP headers vs meta tags; removes ineffective meta headers.
eslint.config.js Refactors ESLint config by area (src/e2e/tests/scripts) and TS project usage.
e2e/routes/quotes/view.spec.ts Adds route-suite spec for quote view route.
e2e/routes/quotes/templates.spec.ts Adds route-suite spec for quote templates route.
e2e/routes/quotes/novo.spec.ts Adds route-suite spec for quote wizard route.
e2e/routes/quotes/lista.spec.ts Adds route-suite spec for quote list route.
e2e/routes/quotes/kanban.spec.ts Adds route-suite spec for quote kanban route.
e2e/routes/quotes/editar.spec.ts Adds route-suite spec for quote edit route.
e2e/routes/quotes/detail.spec.ts Adds route-suite spec for quote detail route.
e2e/routes/quotes/dashboard.spec.ts Adds route-suite spec for quote dashboard route.
e2e/routes/public/reset-password.spec.ts Adds public route tests for reset password.
e2e/routes/public/login.spec.ts Adds public route tests for login.
e2e/routes/public/lista-publica.spec.ts Adds token-based public route test for favorites list.
e2e/routes/public/kit-publico.spec.ts Adds token-based public route test for kit sharing.
e2e/routes/public/dossie.spec.ts Adds token-based public route test for BI dossier.
e2e/routes/public/comparar-publica.spec.ts Adds token-based public route test for comparison sharing.
e2e/routes/public/colecao-publica.spec.ts Adds token-based public route test for collection sharing.
e2e/routes/public/approve.spec.ts Adds token-based public route test for quote approval flow.
e2e/routes/app/tendencias.spec.ts Adds authed route-suite spec for trends.
e2e/routes/app/stock-dashboard.spec.ts Adds authed route-suite spec for stock dashboard.
e2e/routes/app/simulador.spec.ts Adds authed route-suite spec for simulator.
e2e/routes/app/simulador-precos.spec.ts Adds authed route-suite spec for price simulator.
e2e/routes/app/replenishments.spec.ts Adds authed route-suite spec for replenishments.
e2e/routes/app/produtos.spec.ts Adds authed route-suite spec for products.
e2e/routes/app/produto-detail.spec.ts Adds authed route-suite spec for product detail.
e2e/routes/app/product-match.spec.ts Adds authed route-suite spec for match.
e2e/routes/app/pedidos.spec.ts Adds authed route-suite spec for orders.
e2e/routes/app/pedido-detail.spec.ts Adds authed route-suite spec for order detail.
e2e/routes/app/novidades.spec.ts Adds authed route-suite spec for news.
e2e/routes/app/mockup-history.spec.ts Adds authed route-suite spec for mockup history.
e2e/routes/app/mockup-generator.spec.ts Adds authed route-suite spec for mockup generator.
e2e/routes/app/magic-up.spec.ts Adds authed route-suite spec for magic-up.
e2e/routes/app/kit-library.spec.ts Adds authed route-suite spec for kit library.
e2e/routes/app/kit-builder.spec.ts Adds authed route-suite spec for kit builder.
e2e/routes/app/favoritos.spec.ts Adds authed route-suite spec for favorites.
e2e/routes/app/dropbox.spec.ts Adds authed route-suite spec for dropbox.
e2e/routes/app/dashboard.spec.ts Adds authed route-suite spec for dashboard.
e2e/routes/app/comparar.spec.ts Adds authed route-suite spec for comparison.
e2e/routes/app/comercial-intelligence.spec.ts Adds authed route-suite spec for commercial intelligence.
e2e/routes/app/colecoes.spec.ts Adds authed route-suite spec for collections.
e2e/routes/app/colecao-detail.spec.ts Adds authed route-suite spec for collection detail.
e2e/routes/app/cliente-comparator.spec.ts Adds authed route-suite spec for BI client comparator.
e2e/routes/app/carrinhos.spec.ts Adds authed route-suite spec for carts.
e2e/routes/app/business-intelligence.spec.ts Adds authed route-suite spec for BI home.
e2e/routes/app/advanced-price-search.spec.ts Adds authed route-suite spec for price search.
e2e/routes/admin/workflows.spec.ts Adds authed admin route-suite spec for workflows.
e2e/routes/admin/video-variants.spec.ts Adds authed admin route-suite spec for video variants.
e2e/routes/admin/usuarios.spec.ts Adds authed admin route-suite spec for users.
e2e/routes/admin/telemetry.spec.ts Adds authed admin route-suite spec for telemetry.
e2e/routes/admin/system-status.spec.ts Adds authed admin route-suite spec for system status.
e2e/routes/admin/seguranca.spec.ts Adds authed admin route-suite spec for security events.
e2e/routes/admin/seguranca-chaves.spec.ts Adds authed admin route-suite spec for security keys.
e2e/routes/admin/roles.spec.ts Adds authed admin route-suite spec for roles.
e2e/routes/admin/role-permissions.spec.ts Adds authed admin route-suite spec for role permissions.
e2e/routes/admin/rls-denials.spec.ts Adds authed admin route-suite spec for RLS denials.
e2e/routes/admin/rate-limit.spec.ts Adds authed admin route-suite spec for rate limit.
e2e/routes/admin/prompts-ia.spec.ts Adds authed admin route-suite spec for AI prompts.
e2e/routes/admin/price-freshness.spec.ts Adds authed admin route-suite spec for price freshness settings.
e2e/routes/admin/permissions.spec.ts Adds authed admin route-suite spec for permissions.
e2e/routes/admin/migracao-papeis.spec.ts Adds authed admin route-suite spec for role migrations.
e2e/routes/admin/login-attempts.spec.ts Adds authed admin route-suite spec for login attempts.
e2e/routes/admin/limites-desconto.spec.ts Adds authed admin route-suite spec for discount limits.
e2e/routes/admin/conexoes.spec.ts Adds authed admin route-suite spec for connections hub.
e2e/routes/admin/cadastros.spec.ts Adds authed admin route-suite spec for cadastros.
e2e/routes/admin/ai-usage.spec.ts Adds authed admin route-suite spec for AI usage.
e2e/routes/_shared.ts Adds shared route-suite mocks/utilities and re-exports route idle helper alias.
e2e/routes/README.md Documents the route-based E2E suite structure and standard scenarios.
e2e/login.spec.ts Migrates login E2E spec to SSOT helpers/selectors.
e2e/helpers/nav.ts Adds SSOT navigation/wait helpers to reduce flakes and ban sleeps/networkidle reliance.
e2e/helpers/forms.ts Adds generic form helpers for E2E.
e2e/helpers/favorites.ts Adds favorites storage snapshot/restore and robust reload-and-assert helper.
e2e/helpers/evidence.ts Adds evidence collector for failed Playwright tests (screenshots, DOM, console).
e2e/helpers/e2e-resources.ts Adds E2E resource naming guards + creation helpers to enforce cleanup safety.
e2e/helpers/auth.ts Adds SSOT auth helpers (loginViaUI/loginAs) and auth assertions.
e2e/global-teardown.ts Adds teardown that purges E2E data after suite finishes (best-effort).
e2e/global-setup.ts Adds setup purge for stale E2E data before suite begins.
e2e/flows/p0/_mocks.ts Adds mocks for P0 runbook E2E skeletons.
e2e/flows/p0/README.md Documents P0 flow mapping and that these are currently skipped.
e2e/flows/p0/05-admin-down.spec.ts Adds (skipped) P0 admin-down scenario skeletons.
e2e/flows/p0/04-checkout-blocked.spec.ts Adds (skipped) P0 checkout-blocked scenario skeletons.
e2e/flows/p0/03-quote-blocked.spec.ts Adds (skipped) P0 quote-blocked scenario skeletons.
e2e/flows/p0/02-catalog-degraded.spec.ts Adds (skipped) P0 catalog-degraded scenario skeletons.
e2e/flows/p0/01-auth-recovery.spec.ts Adds (skipped) P0 auth-recovery scenario skeletons.
e2e/flows/21-feature-matrix.spec.ts Adds cross-feature navigation matrix smoke assertions.
e2e/flows/15-favorites-invalid-payload.spec.ts Adds robust flow tests for corrupted favorites localStorage payload handling.
e2e/flows/13-favorites-empty-state.spec.ts Adds favorites empty-state flow tests + CTA navigation checks.
e2e/flows/11-errors.spec.ts Adds error-handling flow tests (bridge 503 and offline simulation).
e2e/flows/10-favorites-persistence-storage.spec.ts Adds persistence tests for favorites localStorage ↔ UI hydration contract.
e2e/flows/10-admin.spec.ts Adds admin guard flow tests.
e2e/flows/09-simulator.spec.ts Adds simulator route access flow test.
e2e/flows/09-favorite-from-detail.spec.ts Adds product-detail favorite flow test + persistence + cleanup.
e2e/flows/07-collections.spec.ts Adds collections route smoke flow test.
e2e/flows/06-kit-builder.spec.ts Adds kit-builder access flow test.
e2e/flows/05-orders.spec.ts Adds orders list/open flow tests.
e2e/flows/04-quotes.spec.ts Adds quotes navigation flow tests (list/kanban/dashboard/new).
e2e/flows/03-products.spec.ts Adds products list/search/detail navigation flow tests.
e2e/flows/02-navigation.spec.ts Adds deep-link navigation + 404 + back-navigation flow tests.
e2e/flows/01-auth.spec.ts Adds auth flow tests using SSOT helpers and selectors.
e2e/fixtures/test-user.ts Adds canonical E2E identity + deterministically prefixed naming + user_id resolver.
e2e/fixtures/test-base.ts Adds base fixture with console capture, evidence, scoped resource helpers, and cleanup-on-failure.
e2e/fixtures/auth.setup.ts Adds auth setup creating storageState via SSOT login helper.
e2e/auth.spec.ts Migrates auth E2E spec to SSOT helpers/selectors.
e2e/.gitignore Ignores generated Playwright storage state.
docs/testing/STRICT_REF_WARNING_GATE.md Documents strict global ref-warning gate and snapshot artifact workflow.
docs/security/SELLER_SCOPE_CHECKER.md Documents seller-scope static checker rules and usage.
docs/RBAC_HELPERS.md Documents semantic RBAC helper functions for RLS policies.
docs/E2E_SMOKE_COVERAGE.md Adds generated smoke coverage audit doc (dated).
.lovable/memory/integrations/connections-hub.md Updates connections hub memory documentation with new features/behavior.
.lovable/memory/features/simulation-price-source-badge.md Adds memory doc for simulation price-source badge feature.
.env.e2e.example Adds example env file for configuring Playwright E2E creds/base URL.

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

Comment thread eslint.config.js
Comment on lines +14 to +20
const tsParserOptions = {
ecmaFeatures: { jsx: true },
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.eslint.json'],
tsconfigRootDir: import.meta.dirname,
};
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

import.meta.dirname is not a standard Node ESM field and will be undefined in most Node versions, which can break ESLint config loading. Compute the directory from import.meta.url (e.g., via fileURLToPath + path.dirname) and use that value for tsconfigRootDir.

Copilot uses AI. Check for mistakes.
Comment on lines +47 to +58
const status: "active" | "error" | "unconfigured" = !credsOk
? "unconfigured"
: last?.ok === false ? "error" : "active";

const onTest = async () => {
setPhase("running");
setPendingStartedAt(new Date().toISOString());
const r = await test("bitrix24");
setLast({ ok: r.ok, tested_at: r.tested_at ?? new Date().toISOString(), latency_ms: r.latency_ms, message: r.error ?? r.message, status: r.status, error_kind: r.error_kind ?? null });
setHistoryKey((k) => k + 1);
setPendingStartedAt(null);
setPhase(r.ok ? "completed" : "failed");
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

If test(\"bitrix24\") throws/rejects, pendingStartedAt and phase will never be reset, leaving the UI stuck in a running state. Wrap the body in try/catch/finally to always clear pendingStartedAt and set phase to a terminal state on error. Also, since ConnectionStatusBadge now supports never_tested, consider returning \"never_tested\" when credsOk is true but last is still null to avoid showing active before any test has run.

Suggested change
const status: "active" | "error" | "unconfigured" = !credsOk
? "unconfigured"
: last?.ok === false ? "error" : "active";
const onTest = async () => {
setPhase("running");
setPendingStartedAt(new Date().toISOString());
const r = await test("bitrix24");
setLast({ ok: r.ok, tested_at: r.tested_at ?? new Date().toISOString(), latency_ms: r.latency_ms, message: r.error ?? r.message, status: r.status, error_kind: r.error_kind ?? null });
setHistoryKey((k) => k + 1);
setPendingStartedAt(null);
setPhase(r.ok ? "completed" : "failed");
const status: "active" | "error" | "unconfigured" | "never_tested" = !credsOk
? "unconfigured"
: !last
? "never_tested"
: last.ok === false
? "error"
: "active";
const onTest = async () => {
setPhase("running");
setPendingStartedAt(new Date().toISOString());
try {
const r = await test("bitrix24");
setLast({
ok: r.ok,
tested_at: r.tested_at ?? new Date().toISOString(),
latency_ms: r.latency_ms,
message: r.error ?? r.message,
status: r.status,
error_kind: r.error_kind ?? null,
});
setHistoryKey((k) => k + 1);
setPhase(r.ok ? "completed" : "failed");
} catch (error) {
setLast({
ok: false,
tested_at: new Date().toISOString(),
latency_ms: null,
message: error instanceof Error ? error.message : "Failed to test Bitrix24 connection",
error_kind: null,
});
setHistoryKey((k) => k + 1);
setPhase("failed");
} finally {
setPendingStartedAt(null);
}

Copilot uses AI. Check for mistakes.
Comment on lines +25 to +27
useEffect(() => {
const unsubscribe = onBridgeStatus((e: BridgeStatusEvent) => {
if (e.type === 'degraded') {
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

This effect re-subscribes to the bridge event bus every time unavailable changes, which is unnecessary and can lead to subtle issues (missed events between unsubscribe/subscribe or duplicated behavior if onBridgeStatus isn’t perfectly idempotent). Subscribe once ([]) and use a useRef to track the latest unavailable state inside the callback (or use functional setUnavailable patterns) to keep behavior correct without resubscribing.

Copilot uses AI. Check for mistakes.
});
} else if (e.type === 'recovered') {
toast.dismiss(TOAST_ID_DEGRADED);
if (unavailable) {
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

This effect re-subscribes to the bridge event bus every time unavailable changes, which is unnecessary and can lead to subtle issues (missed events between unsubscribe/subscribe or duplicated behavior if onBridgeStatus isn’t perfectly idempotent). Subscribe once ([]) and use a useRef to track the latest unavailable state inside the callback (or use functional setUnavailable patterns) to keep behavior correct without resubscribing.

Copilot uses AI. Check for mistakes.
Comment on lines +62 to +66
});
return () => {
unsubscribe();
};
}, [unavailable]);
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

This effect re-subscribes to the bridge event bus every time unavailable changes, which is unnecessary and can lead to subtle issues (missed events between unsubscribe/subscribe or duplicated behavior if onBridgeStatus isn’t perfectly idempotent). Subscribe once ([]) and use a useRef to track the latest unavailable state inside the callback (or use functional setUnavailable patterns) to keep behavior correct without resubscribing.

Copilot uses AI. Check for mistakes.
Comment on lines +46 to +50
async function save() {
const minutes = Number(draft);
if (!Number.isFinite(minutes)) return;
setSaving(true);
const { data, error } = await supabase.rpc("set_connections_auto_test_interval", { minutes });
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

Since draft is ultimately user-controlled UI state, it’s safer to validate minutes against the allowed option set (INTERVAL_OPTIONS) before calling the RPC. This prevents unexpected values (e.g., via DOM manipulation) from being sent and keeps the client behavior aligned with what the UI presents.

Copilot uses AI. Check for mistakes.
Comment on lines +51 to +54
const decl =
`\n// CORS allowlist — reflete Origin via _shared/cors.ts (fallback ao domínio canônico)\n` +
`const corsHeaders = getCorsHeaders(new Request("https://criar-together-now.lovable.app"));\n`;
lines.splice(lastImport + 1, 0, decl);
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

This script inserts a getCorsHeaders(...) call but does not ensure getCorsHeaders is imported in the target file. If it’s run on a file that references corsHeaders but never went through the migration (or uses a different import style), it can introduce a new reference error. Consider also inserting/patching the import from ../_shared/cors.ts when missing.

Copilot uses AI. Check for mistakes.
Comment thread e2e/routes/_shared.ts
Comment on lines +159 to +163
import { waitForRouteIdle as _waitForRouteIdle } from "../helpers/nav";

export async function waitRouteReady(page: Page, opts: { timeout?: number } = {}) {
await _waitForRouteIdle(page, opts);
}
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

This import is placed mid-file. While valid in ESM, many lint/style setups and some tooling assume imports are grouped at the top for readability and consistent static analysis. Move this import to the top import block and keep the alias export where it is.

Copilot uses AI. Check for mistakes.
Comment thread package.json
"test:run": "vitest run",
"test:coverage": "vitest run --coverage",
"coverage": "vitest run --coverage",
"test:price-freshness": "bash -c 'set -euo pipefail; files=( tests/utils/price-freshness*.test.ts tests/components/PriceFreshnessBadge*.test.tsx ); vitest run \"${files[@]}\" --coverage --coverage.reporter=text --coverage.reporter=json-summary --coverage.reporter=html --coverage.include=src/utils/price-freshness.ts --coverage.include=src/components/products/PriceFreshnessBadge.tsx --coverage.thresholds.statements=0 --coverage.thresholds.branches=0 --coverage.thresholds.functions=0 --coverage.thresholds.lines=0 && node scripts/check-price-freshness-coverage.mjs'",
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

This script hard-requires bash and bash arrays (files=(...)), which will fail on Windows environments (and some minimal CI images). Consider rewriting this as a Node script (or a cross-platform shell approach) so contributors can run it reliably across platforms.

Suggested change
"test:price-freshness": "bash -c 'set -euo pipefail; files=( tests/utils/price-freshness*.test.ts tests/components/PriceFreshnessBadge*.test.tsx ); vitest run \"${files[@]}\" --coverage --coverage.reporter=text --coverage.reporter=json-summary --coverage.reporter=html --coverage.include=src/utils/price-freshness.ts --coverage.include=src/components/products/PriceFreshnessBadge.tsx --coverage.thresholds.statements=0 --coverage.thresholds.branches=0 --coverage.thresholds.functions=0 --coverage.thresholds.lines=0 && node scripts/check-price-freshness-coverage.mjs'",
"test:price-freshness": "node -e \"const { spawnSync } = require('node:child_process'); const files = ['tests/utils/price-freshness*.test.ts', 'tests/components/PriceFreshnessBadge*.test.tsx']; const vitest = process.platform === 'win32' ? 'vitest.cmd' : 'vitest'; const vitestResult = spawnSync(vitest, ['run', ...files, '--coverage', '--coverage.reporter=text', '--coverage.reporter=json-summary', '--coverage.reporter=html', '--coverage.include=src/utils/price-freshness.ts', '--coverage.include=src/components/products/PriceFreshnessBadge.tsx', '--coverage.thresholds.statements=0', '--coverage.thresholds.branches=0', '--coverage.thresholds.functions=0', '--coverage.thresholds.lines=0'], { stdio: 'inherit', shell: true }); if (vitestResult.status !== 0) process.exit(vitestResult.status || 1); const checkResult = spawnSync(process.execPath, ['scripts/check-price-freshness-coverage.mjs'], { stdio: 'inherit' }); process.exit(checkResult.status || 0);\"",

Copilot uses AI. Check for mistakes.
const parsed = JSON.parse(raw);
if (Array.isArray(parsed.entries)) entries.push(...parsed.entries);
} catch (err) {
console.warn(`[consolidate] ignorando ${f}:`, err.message);
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

In Node, catch (err) can be any value; accessing err.message can throw if err is not an object. Convert safely (e.g., err instanceof Error ? err.message : String(err)) to avoid the consolidation script crashing while handling a malformed snapshot.

Suggested change
console.warn(`[consolidate] ignorando ${f}:`, err.message);
console.warn(
`[consolidate] ignorando ${f}:`,
err instanceof Error ? err.message : String(err),
);

Copilot uses AI. Check for mistakes.
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: 41decbc1ef

ℹ️ 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".

Comment on lines +341 to +343
const isSupervisor = has("supervisor") || has("admin"); // admin legado = supervisor
const isAgente = has("agente") || has("vendedor"); // vendedor legado = agente
const isSupervisorOrAbove = isDev || isSupervisor;
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 Include legacy manager in supervisor-or-above mapping

This role mapping drops legacy manager users from the elevated path: isSupervisor only checks supervisor/admin, so isSupervisorOrAbove and canManage become false for users who still have only manager (which is still listed as a supported legacy role in this file). In that scenario, admin/supervisor-gated routes now redirect to / and management capabilities disappear unexpectedly.

Useful? React with 👍 / 👎.


try {
const authHeader = req.headers.get("Authorization");
if (!authHeader?.startsWith("Bearer ")) {
return new Response(JSON.stringify({ error: "Unauthorized" }), {
status: 401,
headers: { ...corsHeaders, "Content-Type": "application/json" },
status: 401, headers: { ...corsHeaders, "Content-Type": "application/json" },
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 Define request CORS headers before error responses

Non-OPTIONS paths spread corsHeaders in response headers, but no corsHeaders variable is defined in scope anymore after this refactor. The first unauthorized/validation/error response will throw a ReferenceError, causing connection-tester calls to fail at runtime instead of returning the intended JSON error payload.

Useful? React with 👍 / 👎.

@adm01-debug adm01-debug merged commit 0a675b6 into main Apr 27, 2026
1 check passed
@adm01-debug adm01-debug deleted the lovable-sync-1777291944 branch May 9, 2026 15:09
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