Skip to content

Lovable sync 1777320812#71

Closed
adm01-debug wants to merge 2 commits into
mainfrom
lovable-sync-1777320812
Closed

Lovable sync 1777320812#71
adm01-debug wants to merge 2 commits into
mainfrom
lovable-sync-1777320812

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

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

Pull Request

📝 Descrição

🎯 Tipo de mudança

  • 🐛 Bug fix (mudança não-breaking que corrige um problema)
  • ✨ Nova feature (mudança não-breaking que adiciona funcionalidade)
  • 💥 Breaking change (correção/feature que quebra compatibilidade)
  • 📚 Documentação
  • 🎨 Refatoração (sem mudança funcional)
  • ⚡ Performance
  • 🔒 Segurança

🔗 Issue relacionada

✅ Checklist

  • Código segue o style guide do projeto (ESLint passa)
  • npx tsc --noEmit passa sem erros
  • Testes passam (npm run test)
  • Adicionei testes para novas funcionalidades quando aplicável
  • Atualizei a documentação (README/CHANGELOG/docs/) se necessário
  • Não há console.log em código de produção (apenas logger.*)
  • Não há secrets/credenciais hardcoded
  • RLS revisado se houve mudança em tabelas
  • Edge functions: input validado com Zod
  • Componentes UI: tokens semânticos (sem cores hardcoded)
  • Memória atualizada (mem://) se a mudança afetar arquitetura/regras

🧪 Como testar

📸 Screenshots (se UI)

⚠️ Notas para o reviewer

Summary by CodeRabbit

  • Tests
    • Improved server-side rendering validation accuracy
    • Enhanced component lifecycle tracking for better stability testing of overlay components

lovable-dev Bot and others added 2 commits April 27, 2026 20:13
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-08f3b3dd-f7ac-4f3a-adf4-06338789639a
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 22:15
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

📝 Walkthrough

Walkthrough

Two test files refactored to improve validation approach: SSR test simplified by removing HTML comment detection, and stability test reworked to track component lifecycle events (mount/unmount) instead of render counts.

Changes

Cohort / File(s) Summary
SSR Validation
tests/components/DevInfraGateHydration.test.tsx
Removed check for HTML comments in server-rendered output; retains strict assertion that SSR output equals empty string.
Lifecycle Tracking
tests/components/DevInfraGateStability.test.tsx
Replaced render-count mechanism with lifecycle event tracking using mocked BridgeMetricsOverlay with useEffect hooks. Added beforeEach reset hook. Reworked assertions to verify component mounts once on state transition, remains mounted across rerenders, and unmounts on state change back to false.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A test's gentle dance, now clean and bright,
Lifecycle events tracked with pure delight,
No more counting renders in the night,
Just mount, unmount—the truth shines right!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is entirely an empty template with no concrete information about what changes were made, why they were made, or how to test them. Fill in the description section with actual details: summarize the test refactoring in 1-3 sentences, select the appropriate change type, and complete the checklist items.
Title check ❓ Inconclusive The PR title 'Lovable sync 1777320812' is vague and generic, using an automated sync identifier that conveys no meaningful information about the actual changes to test files. Replace the title with a descriptive summary of the main changes, such as 'Refactor DevInfraGate tests to track lifecycle events instead of render counts' or similar.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lovable-sync-1777320812
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch lovable-sync-1777320812

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

This PR updates the DevInfraGate test suite to validate anti-flicker behavior using React lifecycle signals (mount/unmount) instead of render counting, and simplifies SSR assertions while keeping the same intent (no overlay output on the server).

Changes:

  • Refactors the stability/anti-flicker test to track overlay mount/unmount events and assert no remount during stable state transitions.
  • Simplifies the hydration/SSR test by removing redundant SSR output assertions while retaining the empty SSR HTML guarantee.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/components/DevInfraGateStability.test.tsx Reworks anti-flicker coverage to assert lifecycle integrity (no unmount/remount) across rerenders and state transitions.
tests/components/DevInfraGateHydration.test.tsx Removes redundant SSR assertions while keeping the SSR output requirement ('').

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
tests/components/DevInfraGateStability.test.tsx (2)

56-60: Make the “stable rerender” step actually change state.

This rerender uses the same useDevGate() return value, so it only proves a plain parent rerender does not remount the stub. If the intent is to cover the auth-refresh path described in the comment, drive the hook through a different-but-still-allowed state instead.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/components/DevInfraGateStability.test.tsx` around lines 56 - 60, The
"stable rerender" should actually change the AuthContext value (or the
useDevGate return object) while keeping isAllowed true so we exercise a
change-of-reference scenario instead of a no-op rerender; update the test to
call rerender with a new AuthContext.Provider value (or re-mock useDevGate to
return a new object instance with isAllowed: true but different other fields)
when rerendering <DevOnlyBridgeOverlay /> so useDevGate returns a
different-but-still-allowed value and the overlay's stability is verified.

15-24: This mock can hide regressions in the real overlay.

The lifecycle assertions are driven by a stubbed BridgeMetricsOverlay, so the test only proves the mock mounts/unmounts. If the production overlay starts remounting or suspending differently, this will still pass.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/components/DevInfraGateStability.test.tsx` around lines 15 - 24, The
test currently stubs BridgeMetricsOverlay (mock in
DevInfraGateStability.test.tsx) which only proves the mock's lifecycle instead
of the real component; change the mock to wrap/forward to the real module so
lifecycleEvents record the actual BridgeMetricsOverlay behavior: use
vi.importActual to get the real '@/components/dev/BridgeMetricsOverlay' and
return a wrapper default export that runs the same useEffect (pushing
'mount'/'unmount') and then renders the real component (forwarding props and
children) so the test asserts the real overlay's mount/unmount behavior rather
than a pure stub.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/components/DevInfraGateStability.test.tsx`:
- Around line 56-60: The "stable rerender" should actually change the
AuthContext value (or the useDevGate return object) while keeping isAllowed true
so we exercise a change-of-reference scenario instead of a no-op rerender;
update the test to call rerender with a new AuthContext.Provider value (or
re-mock useDevGate to return a new object instance with isAllowed: true but
different other fields) when rerendering <DevOnlyBridgeOverlay /> so useDevGate
returns a different-but-still-allowed value and the overlay's stability is
verified.
- Around line 15-24: The test currently stubs BridgeMetricsOverlay (mock in
DevInfraGateStability.test.tsx) which only proves the mock's lifecycle instead
of the real component; change the mock to wrap/forward to the real module so
lifecycleEvents record the actual BridgeMetricsOverlay behavior: use
vi.importActual to get the real '@/components/dev/BridgeMetricsOverlay' and
return a wrapper default export that runs the same useEffect (pushing
'mount'/'unmount') and then renders the real component (forwarding props and
children) so the test asserts the real overlay's mount/unmount behavior rather
than a pure stub.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e7e9c17a-5bb2-4a4b-86b1-f8a7536767c0

📥 Commits

Reviewing files that changed from the base of the PR and between 0a5784e and 2f13699.

📒 Files selected for processing (2)
  • tests/components/DevInfraGateHydration.test.tsx
  • tests/components/DevInfraGateStability.test.tsx
💤 Files with no reviewable changes (1)
  • tests/components/DevInfraGateHydration.test.tsx

@adm01-debug
Copy link
Copy Markdown
Owner Author

❌ Encerrado por conflito

mergeable_state: dirty após os merges desta sessão (#41-44, #69, #70, #72).

PR só refatora 2 arquivos de teste do DevInfraGate (não há mudança de produção). Ganho marginal — pode ser refeito facilmente em PR nova após git pull da main atual, se desejado.

Branch original lovable-sync-1777320812 preservada no remote.

@adm01-debug adm01-debug deleted the lovable-sync-1777320812 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