Skip to content

Added couple of e2e tests - #63

Merged
reijjo merged 8 commits into
mainfrom
front
May 3, 2026
Merged

Added couple of e2e tests#63
reijjo merged 8 commits into
mainfrom
front

Conversation

@reijjo

@reijjo reijjo commented May 2, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Responsive sidebar with navigation links, menu toggle and new navbar (includes logout button)
    • App layout composition updated to wrap content for improved structure
  • Style

    • New global sizing variables and updated layout CSS for full-height pages
    • Navbar, sidebar, footer and button (icon size) styling enhancements for consistent responsive behavior
  • Tests

    • Added end-to-end tests covering login page flows and expected messages

@coderabbitai

coderabbitai Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a responsive sidebar layout (AppContent, Sidebar, AppNavbar) with a Zustand store controlling visibility, global layout CSS tokens, an icon button variant, Playwright E2E login tests, small CI env updates, and a debug log in the Rust registration handler.

Changes

Responsive Layout & Sidebar System

Layer / File(s) Summary
Design Tokens
client/src/app/globals.css
Adds --nav-height and --sidebar-width.
Layout Shell & Wiring
client/src/app/(app)/layout.tsx, client/src/app/(app)/layout.css
Wraps app with <main className="app-layout"><AppContent>…</AppContent></main> and adds .app-layout/.dash-page rules.
Core Component + Behavior
client/src/components/layout/app-content/AppContent.tsx, .../AppContent.css
Introduces AppContent (client) with a resize listener that toggles sidebar at 1250px; grid CSS for sidebar+main and responsive collapse.
Sidebar Implementation
client/src/components/layout/sidebar/Sidebar.tsx, .../Sidebar.css
Adds Sidebar component, logo/link, nav items, and sticky full-height sidebar styles.
Navbar Implementation / Adjustments
client/src/components/layout/navbar/AppNavbar.tsx, .../AppNavbar.css, client/src/components/layout/navbar/Navbar.tsx, .../Navbar.css
Adds AppNavbar (menu icon + logout), moves fixed positioning to .public-nav, keeps z-index on nav.
Layout Grid Placements
client/src/components/layout/footer/Footer.css, client/src/app/(app)/dash/page.tsx
Positions footer grid-row; replaces dash-containerdash-page.
State Management Store
client/src/lib/stores/sidebarStore.ts
Adds useSidebarStore (isOpen, toggle, open, close) via Zustand.
UI primitives
client/src/components/ui/button/Button.tsx, .../Button.css
Adds size: "icon" to ButtonProps and .btn--icon CSS variant.
Dependencies
client/package.json
Bumps zod and adds zustand@^5.0.12.

Tests, CI & Server Debugging

Layer / File(s) Summary
E2E Tests
client/e2e/(auth)/login.spec.ts
Adds Playwright login suite: registered user (expects "account not verified") and unregistered user (expects "user not found").
CI Environment
.github/workflows/tests.yml
Hardcodes FRONTEND_URL=http://localhost:3000; sets NEXT_PUBLIC_DEV_FRONTEND=http://localhost:3001 in e2e job environment.
Server Runtime Log
rust-server/src/features/auth/handlers/register.rs
Adds eprintln!("APP ENV: {}", state.config.app_env); inside register_user.
Imports Cleanup
rust-server/src/middleware/cors.rs
Moves axum::http::{HeaderValue, Method, header} to module imports; logic unchanged.

Sequence Diagram

sequenceDiagram
    participant Browser as Browser
    participant AppContent as AppContent
    participant SidebarStore as Zustand Store
    participant Sidebar as Sidebar Component

    Browser->>AppContent: initial render (client)
    AppContent->>AppContent: attach resize listener
    AppContent->>Browser: read window.innerWidth
    Browser-->>AppContent: innerWidth value
    alt innerWidth >= 1250px
        AppContent->>SidebarStore: open()
    else innerWidth < 1250px
        AppContent->>SidebarStore: close()
    end
    SidebarStore-->>Sidebar: isOpen updates (subscribe)
    Sidebar->>Browser: show or hide sidebar
    Note over Browser,AppContent: on window resize -> same flow repeats
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Added couple of e2e tests' is partially related to the changeset but understates the scope of changes, which includes extensive layout refactoring, new UI components, state management, and dependency updates beyond just E2E tests. Consider a more descriptive title that reflects the primary changes, such as 'Refactor app layout with sidebar, navbar, and add e2e login tests' to give reviewers a complete picture.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 front

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get your free trial and get 200 agent minutes per Slack user (a $50 value).


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@client/playwright.config.ts`:
- Around line 43-44: The Playwright tests and app are using different origins
which breaks cookies/session — change the configuration so both use the same
host; either update the environment vars NEXT_PUBLIC_DEV_BACKEND and
NEXT_PUBLIC_DEV_FRONTEND to use "localhost:3001" / "localhost:3000" or update
the Playwright config's baseURL to "http://127.0.0.1:3000" so the frontend
origin matches the app's env; locate and edit the symbols
NEXT_PUBLIC_DEV_BACKEND, NEXT_PUBLIC_DEV_FRONTEND in the env block and the
baseURL in the Playwright config to ensure they share the identical host
(localhost vs 127.0.0.1).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1c6739e8-708b-4048-81e1-21b3cecc292a

📥 Commits

Reviewing files that changed from the base of the PR and between a57f536 and 8e9cba9.

📒 Files selected for processing (3)
  • .github/workflows/tests.yml
  • client/playwright.config.ts
  • rust-server/src/features/auth/handlers/register.rs

Comment thread client/playwright.config.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 10

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.github/workflows/tests.yml (1)

152-162: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Point the public frontend URL at the actual frontend.

Line 162 now advertises the backend origin as the frontend origin. That conflicts with Line 152 and the probe on Line 239, both of which treat http://localhost:3000 as the frontend. Anything reading config.FRONTEND_URL from client/src/lib/utils/envConfig.ts will now build wrong-origin URLs during E2E.

Suggested fix
-      NEXT_PUBLIC_DEV_FRONTEND: http://localhost:3001
+      NEXT_PUBLIC_DEV_FRONTEND: http://localhost:3000
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/tests.yml around lines 152 - 162, The workflow sets
NEXT_PUBLIC_DEV_FRONTEND to the backend origin (http://localhost:3001) causing
client builds to use the wrong frontend URL; edit the environment block to point
NEXT_PUBLIC_DEV_FRONTEND at the actual frontend (http://localhost:3000 or reuse
FRONTEND_URL) so client code that reads
config.FRONTEND_URL/NEXT_PUBLIC_DEV_FRONTEND (used by
client/src/lib/utils/envConfig.ts) constructs correct E2E URLs; update the
single env var NEXT_PUBLIC_DEV_FRONTEND in the .github/workflows/tests.yml env
list accordingly.
client/src/app/(app)/layout.tsx (1)

14-14: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove the debug console.log — it leaks your auth response to server logs on every request.

As a pro, you need to get into the habit of treating server logs as potentially public. me is the raw getMe() response — it likely carries user identifiers, session tokens, or other sensitive fields. Leaving this in a server component means every authenticated page render silently emits that data to stdout/log aggregators. That's a GDPR/CCPA compliance risk and a free gift to anyone with log access.

🗑️ Proposed fix
- console.log("AppLayout - getMe response:", me);

If you need observability here, log only a boolean or a non-sensitive status field: console.log("AppLayout auth check:", me.success) — but even that is better left to a proper structured logger with log-level control.

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

In `@client/src/app/`(app)/layout.tsx at line 14, Remove the debug console.log in
the server component so sensitive auth data from getMe() isn't emitted to
stdout; locate the console.log("AppLayout - getMe response:", me) in layout.tsx
(or the AppLayout component) and delete it, or replace it with a non-sensitive,
low-volume indicator (e.g., log only a boolean status like me.success) using
your structured logger with level control if you need observability.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/tests.yml:
- Around line 232-239: The "Debug networking" step currently runs curl probes
against ports that may not be up yet and will fail the job; update that step so
probes don't gate the workflow by either making each curl tolerant (append "||
true" to each curl invocation) or set the step-level "continue-on-error: true"
so failed probes don't stop the job, and keep the echo/log lines and the curl
commands in the "Debug networking" step to preserve diagnostics.

In `@client/src/app/`(app)/layout.css:
- Around line 7-9: The .dash-page rule setting min-height: 100dvh causes the
middle grid row to overflow and create an extra scrollbar; change the .dash-page
sizing to use min-height: 100% or remove the min-height rule so it simply
inherits the height of its grid row (which .app-main already sizes with
--nav-height + 1fr + auto). Update the CSS for the .dash-page selector
(referencing the .dash-page rule in layout.css) to either delete the min-height
declaration or replace it with min-height: 100% so the element fills the
available grid row without forcing an extra viewport height.

In `@client/src/components/layout/app-content/AppContent.tsx`:
- Around line 33-36: The layout keeps an empty sidebar column because Activity
mode="hidden" only hides children visually but does not remove the grid column;
update AppContent to toggle a CSS class on the root div based on isOpen (e.g.,
className={`app-content ${isOpen ? '' : 'sidebar-collapsed'}`}) while keeping
Activity and Sidebar, then change the CSS for .app-content.sidebar-collapsed to
collapse the sidebar column (adjust grid-template-columns to remove or set the
sidebar column to 0, or switch to 1fr for the main content). Modify
AppContent.tsx (symbols: AppContent component, isOpen, Activity, Sidebar) and
AppContent.css (add .sidebar-collapsed rules) so the grid actually collapses
when isOpen is false.

In `@client/src/components/layout/navbar/AppNavbar.tsx`:
- Line 2: Remove the global import of "Navbar.css" from AppNavbar.tsx so
public-nav selectors (.nav-wrapper, .nav-logo, .nav-buttons, etc.) no longer
leak into the app shell; instead ensure AppNavbar.tsx only imports its local
"AppNavbar.css" (or equivalent component-scoped styles) and keep all styling for
public navigation confined to the separate public nav component where
"Navbar.css" is intended to be used.
- Around line 7-22: Add the client directive and wire the sidebar toggle: mark
the component as a client component by adding "use client" at the top of
AppNavbar, import and call useSidebarStore to get the toggle action (e.g., const
{ toggle } = useSidebarStore()), and attach that toggle to the Menu button via
an onClick on the Button/Menu element so clicking it invokes toggle; keep the
rest of the JSX (Button, Menu, logout) intact.

In `@client/src/components/layout/sidebar/Sidebar.css`:
- Around line 31-33: The CSS uses nesting syntax in Sidebar.css with the rule
`&:hover`, but PostCSS nesting isn't configured; install and configure PostCSS
(install `postcss` and `postcss-nesting` or `postcss-preset-env`) and add a
`postcss.config.js` in the client directory to enable nesting support so
`&:hover` is transpiled for all targets; ensure the config references
`postcss-nesting` (or `postcss-preset-env` with stage ≤1) and restart the build
to verify Sidebar.css nesting is processed.

In `@client/src/components/layout/sidebar/Sidebar.tsx`:
- Around line 20-33: The Sidebar component currently uses placeholder anchors;
replace the Logout <a href="#"> in Sidebar with a real logout action: either
render a <form> that posts to a Next.js server action (logoutAction) which
clears the session/cookie and redirects to /login, or, if Sidebar is a client
component ("use client"), replace it with a <button> that calls your /api/logout
endpoint (fetch POST) and then redirects client-side; also convert the other nav
anchors to Next.js <Link href="/your-route"> for client-side navigation. Locate
the logout anchor in Sidebar.tsx and update it to call the server-side logout
routine (logoutAction) or the /api/logout handler, ensuring server-side session
invalidation and a redirect to /login.

In `@client/src/components/ui/button/Button.tsx`:
- Around line 5-6: The Button component's props allow size: "icon" without
enforcing an accessible name; update the ButtonProps (the props type used by the
Button component in Button.tsx) to be a discriminated union that requires
aria-label (or aria-labelledby) when size is "icon" (e.g., one variant type {
size: "icon"; "aria-label": string } and another for other sizes), then update
the Button component signature to use that union so TypeScript enforces
providing an accessible name for icon-only buttons.

In `@client/src/lib/stores/sidebarStore.ts`:
- Around line 10-11: The sidebar store currently sets isOpen: false which causes
a visible flash on wide screens; update the store (useSidebarStore /
SidebarStore) to initialize isOpen using a client-only guard so it reflects
viewport width on hydration (e.g., set isOpen to typeof window !== "undefined"
&& window.innerWidth >= 1250) or alternatively rely on CSS media queries for
initial visibility and let the store take over after hydration; ensure the
typeof window guard is present to avoid server runtime errors and that consuming
components remain client components using 'use client' where required.
- Around line 10-15: The store is created with create(...) which breaks
TypeScript inference with middleware; change to the curried generic form by
calling create<SidebarStore>() and then passing the state creator to it so
useSidebarStore is defined via create<SidebarStore>()(...) instead of
create(...); update the useSidebarStore declaration and ensure the SidebarStore
generic is applied to create to preserve correct types when adding middleware
like devtools or persist.

---

Outside diff comments:
In @.github/workflows/tests.yml:
- Around line 152-162: The workflow sets NEXT_PUBLIC_DEV_FRONTEND to the backend
origin (http://localhost:3001) causing client builds to use the wrong frontend
URL; edit the environment block to point NEXT_PUBLIC_DEV_FRONTEND at the actual
frontend (http://localhost:3000 or reuse FRONTEND_URL) so client code that reads
config.FRONTEND_URL/NEXT_PUBLIC_DEV_FRONTEND (used by
client/src/lib/utils/envConfig.ts) constructs correct E2E URLs; update the
single env var NEXT_PUBLIC_DEV_FRONTEND in the .github/workflows/tests.yml env
list accordingly.

In `@client/src/app/`(app)/layout.tsx:
- Line 14: Remove the debug console.log in the server component so sensitive
auth data from getMe() isn't emitted to stdout; locate the
console.log("AppLayout - getMe response:", me) in layout.tsx (or the AppLayout
component) and delete it, or replace it with a non-sensitive, low-volume
indicator (e.g., log only a boolean status like me.success) using your
structured logger with level control if you need observability.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 51ce3d39-ad26-4a27-b3fe-28a5694dd3ec

📥 Commits

Reviewing files that changed from the base of the PR and between 8e9cba9 and c923bf0.

⛔ Files ignored due to path filters (1)
  • client/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (19)
  • .github/workflows/tests.yml
  • client/package.json
  • client/src/app/(app)/dash/page.tsx
  • client/src/app/(app)/layout.css
  • client/src/app/(app)/layout.tsx
  • client/src/app/globals.css
  • client/src/components/layout/app-content/AppContent.css
  • client/src/components/layout/app-content/AppContent.tsx
  • client/src/components/layout/footer/Footer.css
  • client/src/components/layout/navbar/AppNavbar.css
  • client/src/components/layout/navbar/AppNavbar.tsx
  • client/src/components/layout/navbar/Navbar.css
  • client/src/components/layout/navbar/Navbar.tsx
  • client/src/components/layout/sidebar/Sidebar.css
  • client/src/components/layout/sidebar/Sidebar.tsx
  • client/src/components/ui/button/Button.css
  • client/src/components/ui/button/Button.tsx
  • client/src/lib/stores/sidebarStore.ts
  • rust-server/src/middleware/cors.rs

Comment thread .github/workflows/tests.yml Outdated
Comment thread client/src/app/(app)/layout.css
Comment thread client/src/components/layout/app-content/AppContent.tsx
Comment thread client/src/components/layout/navbar/AppNavbar.tsx Outdated
Comment thread client/src/components/layout/navbar/AppNavbar.tsx
Comment thread client/src/components/layout/sidebar/Sidebar.css
Comment thread client/src/components/layout/sidebar/Sidebar.tsx
Comment thread client/src/components/ui/button/Button.tsx
Comment thread client/src/lib/stores/sidebarStore.ts
Comment thread client/src/lib/stores/sidebarStore.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (1)
client/src/components/layout/navbar/AppNavbar.tsx (1)

6-13: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Unresolved from last review: add "use client" and wire the sidebar toggle to the Menu button.

Here's an important Next.js principle worth internalizing: in the App Router, the "use client" boundary is per-file, not per-component tree. Even though AppContent (the parent) is a client component, that boundary doesn't cascade into AppNavbar.tsx. Every file that uses React hooks — including Zustand — must declare "use client" itself. Without it, calling useSidebarStore() here would throw a server-side error.

Right now the Menu button renders fine but is completely inert — clicking it does nothing. The useSidebarStore already exposes a toggle action precisely for this button.

⚡ Proposed fix
+"use client";
 import "./AppNavbar.css";
 import { Menu } from "lucide-react";

+import { useSidebarStore } from "@/lib/stores/sidebarStore";
 import { Button } from "@/components/ui/button/Button";

 export default function AppNavbar() {
+  const { toggle } = useSidebarStore();
+
   return (
     <nav className="app-navbar">
       <div className="app-nav-content wrapper">
         <div className="app-nav-toggle">
-          <Button variant="outline" size="icon" type="button">
+          <Button variant="outline" size="icon" type="button" onClick={toggle}>
             <Menu size={20} />
           </Button>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@client/src/components/layout/navbar/AppNavbar.tsx` around lines 6 - 13, This
file is missing the client boundary and the Menu button isn't wired to the
sidebar store: add the "use client" directive at the top of AppNavbar.tsx,
import and call useSidebarStore inside the AppNavbar component, and pass the
store's toggle action as the onClick handler for the Menu Button (reference:
AppNavbar component, useSidebarStore, toggle, and the Menu Button JSX) so
clicking the button calls toggle.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/tests.yml:
- Line 162: The env var values are inconsistent: FRONTEND_URL is set to
http://localhost:3000 but NEXT_PUBLIC_DEV_FRONTEND is set to
http://localhost:3001; update NEXT_PUBLIC_DEV_FRONTEND to http://localhost:3000
so both FRONTEND_URL and NEXT_PUBLIC_DEV_FRONTEND match and reflect the actual
frontend port (reference the variable names FRONTEND_URL and
NEXT_PUBLIC_DEV_FRONTEND in the workflow to locate and change the entry).

In `@client/src/components/layout/navbar/AppNavbar.tsx`:
- Around line 11-13: The icon-only Button that renders <Menu /> is missing an
accessible label; update the Button in AppNavbar (the instance rendering Button
with Menu) to include an aria-label prop (e.g., aria-label="Open menu" or
"Toggle navigation") so screen readers get a descriptive name; ensure the prop
is passed to the underlying button (the Button component already spreads
...rest) and choose wording consistent with the button's action.
- Around line 15-17: In AppNavbar replace the raw <button> with the
design-system Button and wire it to the existing loggingOut() API: change the
element rendered in AppNavbar to use the Button component (consistent styling),
set its type="button" to avoid implicit submit behavior, and add an onClick
handler that calls the async loggingOut() function from
client/src/lib/api/auth.ts (handle await and catch errors to surface failures or
show a toast). Ensure the Button label remains "logout" and import Button and
loggingOut where needed.

---

Duplicate comments:
In `@client/src/components/layout/navbar/AppNavbar.tsx`:
- Around line 6-13: This file is missing the client boundary and the Menu button
isn't wired to the sidebar store: add the "use client" directive at the top of
AppNavbar.tsx, import and call useSidebarStore inside the AppNavbar component,
and pass the store's toggle action as the onClick handler for the Menu Button
(reference: AppNavbar component, useSidebarStore, toggle, and the Menu Button
JSX) so clicking the button calls toggle.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6f682e74-fab8-4573-bbc6-be9b2cac7c98

📥 Commits

Reviewing files that changed from the base of the PR and between c923bf0 and edf9c26.

📒 Files selected for processing (2)
  • .github/workflows/tests.yml
  • client/src/components/layout/navbar/AppNavbar.tsx

RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=lld"
NEXT_PUBLIC_DEV_BACKEND: http://localhost:3001
NEXT_PUBLIC_DEV_FRONTEND: http://localhost:3000
NEXT_PUBLIC_DEV_FRONTEND: http://localhost:3001

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check where NEXT_PUBLIC_DEV_FRONTEND is consumed and what port the dev server expects

echo "=== Usage of NEXT_PUBLIC_DEV_FRONTEND in frontend code ==="
rg -n "NEXT_PUBLIC_DEV_FRONTEND" --type=ts --type=js -C2

echo -e "\n=== Check playwright config for baseURL or server port ==="
fd -e ts -e js "playwright.config" --exec cat {}

echo -e "\n=== Check package.json for dev/e2e scripts and ports ==="
cat client/package.json | jq -r '.scripts | to_entries[] | select(.key | test("dev|e2e|test")) | "\(.key): \(.value)"'

Repository: reijjo/tarpit2.0

Length of output: 1772


🏁 Script executed:

#!/bin/bash

echo "=== Where is FRONTEND_URL used in frontend code? ==="
rg -n "FRONTEND_URL" --type=ts --type=js client/ -C3

echo -e "\n=== Full envConfig.ts file to understand context ==="
cat client/src/lib/utils/envConfig.ts

echo -e "\n=== Check if FRONTEND_URL is used in any API/fetch calls ==="
rg -n "FRONTEND_URL\s*\+" --type=ts --type=js client/ -C2 || echo "No concatenation found"

Repository: reijjo/tarpit2.0

Length of output: 1420


🏁 Script executed:

#!/bin/bash

echo "=== Where is config imported from envConfig? ==="
rg -n "from.*envConfig|import.*config" --type=ts --type=js client/ -C2

echo -e "\n=== Direct usage of FRONTEND_URL ==="
rg -n "FRONTEND_URL" --type=ts --type=js client/ -C5

echo -e "\n=== Usage of config object ==="
rg -n "config\." --type=ts --type=js client/src -C2 | head -100

Repository: reijjo/tarpit2.0

Length of output: 2344


🏁 Script executed:

#!/bin/bash

echo "=== Search for ALL uses of config.FRONTEND_URL (not just concatenation) ==="
rg -n "config\.FRONTEND_URL|FRONTEND_URL\b" --type=ts --type=js client/src -C3

echo -e "\n=== Check all imports of config and see full context ==="
rg -n "import.*config.*envConfig" --type=ts --type=js client/src -A20 | head -150

Repository: reijjo/tarpit2.0

Length of output: 3227


🏁 Script executed:

#!/bin/bash

echo "=== Is FRONTEND_URL actually necessary? Check if it's only validated but never used ==="
rg -n "FRONTEND_URL" --type=ts --type=js client/ | grep -v "envConfig.ts"

echo -e "\n=== Double-check: search entire repo for any reference to FRONTEND_URL outside of definition ==="
rg -n "FRONTEND_URL" --type=ts --type=js --type=json . -g "!node_modules" | wc -l

echo -e "\n=== Check what happens in workflow - does FRONTEND_URL env var get used by anything? ==="
grep -n "FRONTEND_URL\|NEXT_PUBLIC" .github/workflows/tests.yml

Repository: reijjo/tarpit2.0

Length of output: 550


Fix environment variable inconsistency: Frontend port configuration is wrong.

You've got a configuration mismatch that needs addressing. Your FRONTEND_URL is set to http://localhost:3000 (line 152), but NEXT_PUBLIC_DEV_FRONTEND points to http://localhost:3001 — that's your backend port. Even though the frontend code doesn't currently use this variable (it's validated but never referenced), keeping them consistent is critical for code clarity and future changes.

Think of it this way: these env vars document where your services run. When they contradict each other, it signals confusion about your architecture to anyone reading the workflow. Plus, if you or a teammate ever needs to use FRONTEND_URL for redirects, CORS origins, or callbacks, they'll grab the wrong port.

The fix is straightforward — align them both to port 3000:

🔧 Fix the frontend port
-      NEXT_PUBLIC_DEV_FRONTEND: http://localhost:3001
+      NEXT_PUBLIC_DEV_FRONTEND: http://localhost:3000
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
NEXT_PUBLIC_DEV_FRONTEND: http://localhost:3001
NEXT_PUBLIC_DEV_FRONTEND: http://localhost:3000
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/tests.yml at line 162, The env var values are
inconsistent: FRONTEND_URL is set to http://localhost:3000 but
NEXT_PUBLIC_DEV_FRONTEND is set to http://localhost:3001; update
NEXT_PUBLIC_DEV_FRONTEND to http://localhost:3000 so both FRONTEND_URL and
NEXT_PUBLIC_DEV_FRONTEND match and reflect the actual frontend port (reference
the variable names FRONTEND_URL and NEXT_PUBLIC_DEV_FRONTEND in the workflow to
locate and change the entry).

Comment on lines +11 to +13
<Button variant="outline" size="icon" type="button">
<Menu size={20} />
</Button>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Icon-only button needs an aria-label — screen readers will be silent about its purpose.

A pro habit to build: any button whose visible label is only an icon must carry an aria-label. Without it, a screen reader announces it as an unlabelled button, which is a WCAG 2.1 Level A failure (Success Criterion 4.1.2). The Button component passes ...rest straight to the underlying <button>, so adding it is a single prop:

♿ Proposed fix
-          <Button variant="outline" size="icon" type="button">
+          <Button variant="outline" size="icon" type="button" aria-label="Toggle sidebar">
             <Menu size={20} />
           </Button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Button variant="outline" size="icon" type="button">
<Menu size={20} />
</Button>
<Button variant="outline" size="icon" type="button" aria-label="Toggle sidebar">
<Menu size={20} />
</Button>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@client/src/components/layout/navbar/AppNavbar.tsx` around lines 11 - 13, The
icon-only Button that renders <Menu /> is missing an accessible label; update
the Button in AppNavbar (the instance rendering Button with Menu) to include an
aria-label prop (e.g., aria-label="Open menu" or "Toggle navigation") so screen
readers get a descriptive name; ensure the prop is passed to the underlying
button (the Button component already spreads ...rest) and choose wording
consistent with the button's action.

Comment on lines +15 to +17
<div className="">
<button>logout</button>
</div>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

The logout button is a non-functional placeholder — three problems in one line.

Let me break them down so you understand the "why" behind each:

  1. No onClick handler — the button is visually present but does nothing. The loggingOut() async function already exists in client/src/lib/api/auth.ts and handles the POST /logout call.
  2. type defaults to "submit" — native <button> elements without an explicit type attribute default to type="submit". If this component is ever wrapped in a <form> (common when logging out via a form action), this button would accidentally submit it. Always be explicit.
  3. Inconsistent component use — the rest of the navbar uses the Button component from your design system; this is a raw <button>. Pick one and stick to it — inconsistency makes future style changes painful.
🔌 Proposed fix
+import { loggingOut } from "@/lib/api/auth";
 ...
-        <div className="">
-          <button>logout</button>
-        </div>
+        <div className="">
+          <Button
+            variant="ghost"
+            size="sm"
+            type="button"
+            onClick={async () => {
+              await loggingOut();
+              // TODO: clear auth state / redirect to login
+            }}
+          >
+            Logout
+          </Button>
+        </div>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className="">
<button>logout</button>
</div>
import { loggingOut } from "@/lib/api/auth";
...
<div className="">
<Button
variant="ghost"
size="sm"
type="button"
onClick={async () => {
await loggingOut();
// TODO: clear auth state / redirect to login
}}
>
Logout
</Button>
</div>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@client/src/components/layout/navbar/AppNavbar.tsx` around lines 15 - 17, In
AppNavbar replace the raw <button> with the design-system Button and wire it to
the existing loggingOut() API: change the element rendered in AppNavbar to use
the Button component (consistent styling), set its type="button" to avoid
implicit submit behavior, and add an onClick handler that calls the async
loggingOut() function from client/src/lib/api/auth.ts (handle await and catch
errors to surface failures or show a toast). Ensure the Button label remains
"logout" and import Button and loggingOut where needed.

@reijjo
reijjo merged commit d3e6899 into main May 3, 2026
4 checks passed
This was referenced May 5, 2026
@coderabbitai coderabbitai Bot mentioned this pull request May 29, 2026
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.

1 participant