Skip to content

feat: sign in / sign up - #81

Merged
AlyaEngineer merged 7 commits into
developfrom
feature/2-signIn-signUp
Jul 12, 2026
Merged

feat: sign in / sign up#81
AlyaEngineer merged 7 commits into
developfrom
feature/2-signIn-signUp

Conversation

@AlyaEngineer

@AlyaEngineer AlyaEngineer commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

Implements authentication end-to-end: Supabase client setup, route protection (401 for private routes, redirect for logged-in users on auth routes, expired-token handling), and working Sign In / Sign Up forms with client-side validation.

Changes Made

  • added Supabase browser and server clients (src/lib/client.ts, src/lib/server.ts)
  • integrated Supabase session refresh into src/proxy.ts alongside next-intl locale handling, plus AUTH_ROUTES redirect for already-authenticated users
  • added getAuthenticatedUser() and the unauthorized.tsx boundary, delivering a real 401 on private routes and redirecting unauthenticated users to the Main page
  • added Zod validation schemas for Sign In / Sign Up (email format, password strength: 8+ chars, letter, digit, special character, Unicode-aware)
  • built AuthCard, ControlledTextField, SignInForm, and SignUpForm, connected to supabase.auth.signInWithPassword() / signUp() with toast feedback and redirect to Main on success
  • added .env.example, updated .gitignore and README with setup instructions
  • added unit tests across the auth flow: clients, proxy redirects, getAuthenticatedUser, the schemas, and both forms

Related issue

Closes #21

Feature

Feature 1: App Header
Feature 2: Sign In / Sign Up
Feature 7: General Requirements

Acceptance criteria

Feature 1: App Header
  • Non-auth users see Sign In / Sign Up in header (upper right) — 15
  • Auth users see History / Sign Out in header — 10
  • About link in header and footer — 10
  • Expired/invalid token → redirect from private routes to Main — 10
  • Sign In / Sign Up buttons redirect to respective form route — 15
Feature 2: Sign In / Sign Up
  • Sign In / Sign Up / Sign Out buttons present everywhere they should be — 10
  • Client-side validation (email, password: 8+ chars, letter+digit+special, Unicode) — 20
  • Successful login → redirect to Main — 10
  • Logged-in user on Sign In / Sign Up routes → redirect to Main — 10
Feature 3: Swagger Editor
  • Load/paste schema in JSON and YAML — 25
  • Auto-detect input format (JSON vs YAML) — 20
  • Format switch with JSON ↔ YAML conversion, no data loss — 20
  • Schema validation with error indication — 15
  • Auth users save schema; restored on next login — 10
  • Viewer auto-populates with endpoints on valid schema — 10
  • Responsive split view (horizontal/vertical by orientation) — 20
Feature 4: Swagger Viewer
  • Endpoint list organized by path/method — 20
  • Details: method, path, all param types (path/query/header/cookie) — 25
  • Request schema and example payloads displayed — 20
  • Response schema, examples, all status codes displayed — 25
  • Try-It-Out: fill params/headers/body, execute, show response — 20
  • Generate cURL + copy-to-clipboard — 10
Feature 5: History and Analytics
  • SSR-generated; empty state with links to editor/viewer — 15
  • Requests sorted by timestamp (most recent first) — 10
  • Server-side analytics: duration, status, timestamp, method, request size, response size, error details, endpoint/URL — 45
Feature 6: About Page
  • Public route, accessible to all — 5
  • Info about RS School course — 5
  • Team info (names, roles, GitHub links) — 10
  • Design consistent with the app — 5
Feature 7: General Requirements
  • i18n: 2+ languages with toggler in header — 30
  • Sticky header with animation on stick — 10
  • User-friendly error display — 10
  • Private routes protected (401 if not authenticated) — 5
Feature 8: YouTube Video
  • 5–7 min YouTube walkthrough linked, covers all criteria — 50

Screenshots

Sign up form
Снимок экрана 2026-07-12 021821

Sign in form
Снимок экрана 2026-07-12 021800

Header before signing in
Снимок экрана 2026-07-12 123218

Header after signing in + saving form button
Снимок экрана 2026-07-12 021847

401 response when an unauthenticated user tries to access /history
401

Redirect from /history to the Main page after signing out
redirect_from_history

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would break existing functionality)
  • Documentation update

Checklist

  • Self-review done
  • No console errors / warnings / logs
  • No any / @ts-ignore
  • Tests added / updated and passing

Summary by CodeRabbit

  • New Features
    • Added localized About, History, Sign-in, and Sign-up pages with validated auth forms, password show/hide, and toast-driven success/error feedback.
    • Introduced an authentication context wrapper and auth-aware navigation, plus an “unauthorized/redirecting” screen.
    • Added middleware-based auth routing and session refresh behavior.
  • Bug Fixes
    • Swagger “Save” controls now properly respect authentication state.
  • Documentation
    • Updated README for the Swagger Editor App and included required environment variable guidance; ensured the env example is commit-ready.
  • Tests
    • Expanded coverage for auth providers, forms, validation, routing, client/server behavior, and UI components.

* chore: install the @supabase/supabase-js and @supabase/ssr helper packages

* feat: add Supabase browser client

* feat: add Supabase server client

* docs: add .env.example

* chore: add .env.local to gitignore

* docs: update README with project description, setup instructions, and environment variables

* feat: integrate Supabase session refresh into proxy

* test: add tests for Supabase browser client, server client, and proxy

* chore: ensure .env.example is tracked

* fix: log getClaims errors in proxy

* test: fix after review

* fix: pass response headers through setAll in proxy and add test coverage

* feat: proxy route protection (#75)

* feat: add page stubs for about, history, sign-in, and sign-up routes

* feat: redirect authenticated users away from sign-in/sign-up routes

* feat: protect private routes with 401 and redirect expired/invalid sessions

* test: add tests for getAuthenticatedUser, Unauthorized page, and proxy auth-route redirects

* fix: stricter route matching, error handling, cookie and locale preservation on redirect

* fix: wrap getClaims() in try/catch in getAuthenticatedUser

* refactor: use ROUTES constants and simplify locale/route matching

* fix: forward setAll headers on auth-route redirect

* docs: link to Supabase SSR guide in browser and server client files
* feat: add AuthProvider with signOut and reactive auth state

* test: add unit tests for AuthProvider and AuthNavigation component

* refactor: update ru sign-up label

* chore: install zod, react-hook-form, @hookform/resolvers

* feat: add sign-in and sign-up forms with zod validation

* feat: connect SignIn and SignUp forms to Supabase auth

* fix: redirect to home after sign out to leave protected routes

* test: cover auth-schemas, auth-card, controlled-text-field, sign-in and sign-up forms

* fix: handle rejected Supabase calls in auth flows
@AlyaEngineer
AlyaEngineer requested a review from lexarudak July 12, 2026 10:35
@AlyaEngineer AlyaEngineer added the feature-2-auth Feature 2: Sign In / Sign Up registration and authentication using email and password label Jul 12, 2026
@AlyaEngineer AlyaEngineer linked an issue Jul 12, 2026 that may be closed by this pull request
@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
swagger-editor-app Ready Ready Preview, Comment Jul 12, 2026 1:56pm

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 701261ab-f0ed-43ee-ab92-c350af77c204

📥 Commits

Reviewing files that changed from the base of the PR and between 12fb9a3 and 6020b2a.

📒 Files selected for processing (3)
  • src/app/[locale]/unauthorized.test.tsx
  • src/proxy.test.ts
  • src/proxy.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/app/[locale]/unauthorized.test.tsx
  • src/proxy.ts

📝 Walkthrough

Walkthrough

Adds Supabase authentication with sign-in/sign-up forms, validation, auth context, route protection, localized UI, authenticated history access, and auth-aware Swagger schema saving. Configuration, environment setup, documentation, and tests are updated.

Changes

Authentication foundation

Layer / File(s) Summary
Runtime and project foundation
.env.example, .gitignore, README.md, next.config.ts, package.json
Adds Supabase environment configuration, dependencies, Next.js options, and project-specific setup documentation.
Supabase clients and auth contracts
src/lib/*, src/utils/auth/*
Adds browser/server Supabase clients, cookie handling, Zod authentication schemas, authenticated-user enforcement, and tests.

Auth flow and application integration

Layer / File(s) Summary
Auth state and route protection
src/providers/auth-provider/*, src/proxy.*
Adds authentication context, sign-out routing, Supabase claim checks, localized redirects, cookie propagation, and middleware tests.
Authentication forms and navigation
src/components/auth-*/*, src/components/controlled-text-field/*, src/components/sign-*-form/*, src/app/[locale]/{sign-in,sign-up,unauthorized}/*, src/i18n/messages/*
Adds localized sign-in/sign-up forms, password visibility controls, auth navigation, unauthorized redirects, translations, and interaction tests.
Authenticated app integration
src/app/[locale]/{layout,about,history}/*, src/components/swagger-*/*
Wraps localized content with AuthProvider, adds placeholder routes, protects history access, and gates Swagger schema saving by authentication state.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SignInForm
  participant Supabase
  participant AuthProvider
  participant Router
  User->>SignInForm: Submit email and password
  SignInForm->>Supabase: signInWithPassword(credentials)
  Supabase-->>SignInForm: Authentication result
  SignInForm->>Router: Navigate to home on success
  Supabase-->>AuthProvider: Auth state change
  AuthProvider-->>Router: Redirect after sign-out
Loading

Possibly related PRs

Suggested reviewers: YuliaDemir, Ivan-khodorov, lexarudak

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and clearly summarizes the main sign-in/sign-up authentication work.
Linked Issues check ✅ Passed The PR adds auth controls, client-side validation, redirects, and route protection that satisfy issue #21.
Out of Scope Changes check ✅ Passed No clearly unrelated code changes stand out; the added pages, config, docs, and tests support the auth feature.
✨ 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 feature/2-signIn-signUp

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (8)
src/utils/auth/get-authenticated-user.test.ts (1)

8-10: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Mock should throw to match real unauthorized() control-flow behavior.

unauthorized() actually throws in production (see companion comment on get-authenticated-user.ts). Mocking it as a no-op here means the test suite can't detect if unauthorized() calls end up being caught by an enclosing try/catch, which is precisely the bug found in the implementation.

♻️ Suggested mock update
 vi.mock('next/navigation', () => ({
-  unauthorized: vi.fn(),
+  unauthorized: vi.fn(() => {
+    throw new Error('NEXT_HTTP_ERROR_FALLBACK;401');
+  }),
 }));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/auth/get-authenticated-user.test.ts` around lines 8 - 10, The
next/navigation unauthorized mock should throw when invoked to match production
control flow. Update the vi.mock definition for unauthorized in
get-authenticated-user tests so calls raise an error rather than acting as a
no-op, allowing tests to detect accidental interception by enclosing try/catch
logic.
src/lib/client.ts (1)

5-10: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider validating required env vars instead of using non-null assertions.

process.env.NEXT_PUBLIC_SUPABASE_URL! and ...PUBLISHABLE_KEY! silently pass undefined into createBrowserClient if unset, producing a confusing error deep inside the Supabase SDK rather than a clear failure at the call site. The same pattern is duplicated in src/lib/server.ts.

♻️ Suggested validation helper
+function getSupabaseEnv() {
+  const url = process.env.NEXT_PUBLIC_SUPABASE_URL;
+  const key = process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY;
+
+  if (!url || !key) {
+    throw new Error('Missing NEXT_PUBLIC_SUPABASE_URL or NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY');
+  }
+
+  return { url, key };
+}
+
 export function createClient() {
-  return createBrowserClient(
-    process.env.NEXT_PUBLIC_SUPABASE_URL!,
-    process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,
-  );
+  const { url, key } = getSupabaseEnv();
+  return createBrowserClient(url, key);
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/client.ts` around lines 5 - 10, Update createClient and the
corresponding server client setup to validate NEXT_PUBLIC_SUPABASE_URL and
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY before calling createBrowserClient or its
server equivalent. Replace the non-null assertions with explicit checks that
fail immediately using a clear configuration error when either variable is
missing, while preserving the existing client construction for valid values.
src/components/swagger-control/swagger-control.test.tsx (1)

25-31: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Make the auth mock configurable and cover signed-out behavior.

The hardcoded authenticated state prevents tests from exercising SwaggerControl’s unauthenticated branch, where the save control must be hidden and saving must be rejected. Mock useAuth with vi.fn() and set its return value per test, including a signed-out case.

Suggested mock change
 vi.mock('`@/providers/auth-provider/AuthProvider`', () => ({
-  useAuth: () => ({
-    isAuthenticated: true,
-    isAuthLoading: false,
-    signOut: vi.fn(),
-  }),
+  useAuth: vi.fn(),
 }));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/swagger-control/swagger-control.test.tsx` around lines 25 -
31, Update the AuthProvider mock used by SwaggerControl tests so useAuth is a
vi.fn() with per-test return values instead of a hardcoded authenticated object.
Configure authenticated state for existing tests and add a signed-out test
verifying the save control is hidden and save attempts are rejected.
src/components/controlled-text-field/controlled-text-field.tsx (1)

38-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Localize the password-toggle aria-label.

The rest of the field's text (label, placeholder, error) goes through useTranslations('authForm'), but "toggle password visibility" is a hardcoded English string, leaving RU screen-reader users with untranslated a11y text.

♻️ Proposed fix
-        aria-label="toggle password visibility"
+        aria-label={t('togglePasswordVisibility')}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/controlled-text-field/controlled-text-field.tsx` at line 38,
Update the password visibility toggle in the controlled text field to obtain its
aria-label through the existing useTranslations('authForm') flow instead of a
hardcoded English string, and add or reuse the corresponding authForm
translation key so screen readers receive the localized label.
src/app/[locale]/unauthorized.tsx (1)

11-11: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider using ROUTES.home instead of a hardcoded path.

Other files (e.g. sign-up-form.tsx) reference ROUTES.home for the home route; using the constant here keeps the route source-of-truth consistent.

♻️ Suggested change
+import { ROUTES } from '`@/constants/routes`';
 import { useRouter } from '`@/i18n/navigation`';

 export default function Unauthorized() {
   const router = useRouter();

   useEffect(() => {
-    router.replace('/');
+    router.replace(ROUTES.home);
   }, [router]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/`[locale]/unauthorized.tsx at line 11, Update the redirect in the
unauthorized page to use the shared ROUTES.home constant instead of the
hardcoded "/" path, matching the route source of truth used by sign-up-form.tsx.
src/providers/auth-provider/AuthProvider.test.tsx (1)

17-39: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Object.assign doesn't capture the callback in mockSupabaseClient.

Object.assign(authStateChangeCallback, callback) copies enumerable own properties, not callable behavior — invoking authStateChangeCallback(...) afterward would not run the real listener logic. This parameter is currently unused by any test (only { user } is ever passed), which is why it hasn't caused a failure — the "onAuthStateChange fires" test (Lines 73-100) works around it by hand-rolling a separate mock with a correct capturedCallback = callback assignment instead of reusing this helper.

Fix the assignment and reuse the helper to remove the duplicated mock setup:

🐛 Proposed fix
 function mockSupabaseClient({
   authStateChangeCallback,
   user,
 }: {
-  authStateChangeCallback?: (event: string, session: unknown) => void;
+  authStateChangeCallback?: { current?: (event: string, session: unknown) => void };
   user: unknown;
 }) {
   const unsubscribe = vi.fn();
   const signOut = vi.fn().mockResolvedValue({ error: null });

   return {
     auth: {
       getUser: vi.fn().mockResolvedValue({ data: { user } }),
       onAuthStateChange: vi.fn((callback: (event: string, session: unknown) => void) => {
         if (authStateChangeCallback) {
-          Object.assign(authStateChangeCallback, callback);
+          authStateChangeCallback.current = callback;
         }
         return { data: { subscription: { unsubscribe } } };
       }),
       signOut,
     },
   } as unknown as ReturnType<typeof createClient>;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/providers/auth-provider/AuthProvider.test.tsx` around lines 17 - 39, Fix
mockSupabaseClient so onAuthStateChange stores the supplied callback in a
callable captured reference rather than using Object.assign, then update the
“onAuthStateChange fires” test to reuse this helper instead of its duplicated
hand-rolled Supabase mock. Preserve the existing unsubscribe, getUser, and
signOut behavior.
src/proxy.test.ts (1)

20-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

vi.restoreAllMocks() doesn't reset createServerClient's call history between tests.

unlike mock.mockRestore, vi.restoreAllMocks will not clear mock history or reset the mock implementation for mocks not created via vi.spyOn. Since createServerClient here is a vi.fn() from a vi.mock() factory, its .mock.calls/.mock.results keep growing across tests in this file. Current assertions happen to be robust to this (first test uses index 0, last test uses calls.length - 1, others use mockReturnValueOnce), but it's fragile to test reordering or additions.

♻️ Suggested fix
 describe('proxy', () => {
   afterEach(() => {
-    vi.restoreAllMocks();
+    vi.restoreAllMocks();
+    vi.mocked(createServerClient).mockClear();
   });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/proxy.test.ts` around lines 20 - 22, Update the test cleanup around
createServerClient so its vi.fn call history and mock implementation are reset
between tests, using the mock’s reset/clear API in addition to the existing
vi.restoreAllMocks() cleanup. Keep the existing restore behavior and ensure each
test starts with an isolated createServerClient state.
src/proxy.ts (1)

1-86: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Missing config.matcher — proxy runs on every request, including static assets.

Without a matcher, Proxy runs on every request, including static files (_next/static), image optimizations (_next/image), and assets in the public/ folder. This file has no config export, so every static asset request incurs a Supabase getClaims() call and the next-intl pass unnecessarily.

⚡ Suggested addition
 function matchesRoute(pathname: string, routes: string[]) {
   const segments = pathname.split('/');

   return routes.some((route) => segments.includes(route.replace('/', '')));
 }
+
+export const config = {
+  matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],
+};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/proxy.ts` around lines 1 - 86, Add a Next.js `config` export alongside
`proxy` that defines a matcher excluding static assets, image optimization
requests, and public-file requests while retaining application route handling.
Keep the existing `proxy`, authentication, and internationalization logic
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/`[locale]/unauthorized.tsx:
- Around line 1-15: The Unauthorized component should render the
401/unauthorized UI instead of silently redirecting via router.replace. Remove
the redirect effect and use the project’s existing unauthorized-state component
or presentation within Unauthorized, preserving the page’s client/server
requirements as needed.

In `@src/components/auth-card/auth-card.tsx`:
- Line 1: Remove the unnecessary 'use client' directive from the AuthCard
component so it remains server-compatible; preserve the component implementation
and rely on client callers to establish their own client boundary.

In `@src/components/controlled-text-field/controlled-text-field.tsx`:
- Around line 35-47: Set the password visibility IconButton in
passwordToggleButton to type="button" so it cannot submit surrounding forms;
leave its existing click and mouse-down behavior unchanged.

In `@src/proxy.ts`:
- Around line 13-53: The setAll callback in proxy must recreate intlResponse
with NextResponse.next({ request }) after applying refreshed cookies to
request.cookies, before copying response cookies and headers, so downstream
processing sees the updated session. Update the response variable handling while
preserving the existing cookie and header propagation.

---

Nitpick comments:
In `@src/app/`[locale]/unauthorized.tsx:
- Line 11: Update the redirect in the unauthorized page to use the shared
ROUTES.home constant instead of the hardcoded "/" path, matching the route
source of truth used by sign-up-form.tsx.

In `@src/components/controlled-text-field/controlled-text-field.tsx`:
- Line 38: Update the password visibility toggle in the controlled text field to
obtain its aria-label through the existing useTranslations('authForm') flow
instead of a hardcoded English string, and add or reuse the corresponding
authForm translation key so screen readers receive the localized label.

In `@src/components/swagger-control/swagger-control.test.tsx`:
- Around line 25-31: Update the AuthProvider mock used by SwaggerControl tests
so useAuth is a vi.fn() with per-test return values instead of a hardcoded
authenticated object. Configure authenticated state for existing tests and add a
signed-out test verifying the save control is hidden and save attempts are
rejected.

In `@src/lib/client.ts`:
- Around line 5-10: Update createClient and the corresponding server client
setup to validate NEXT_PUBLIC_SUPABASE_URL and
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY before calling createBrowserClient or its
server equivalent. Replace the non-null assertions with explicit checks that
fail immediately using a clear configuration error when either variable is
missing, while preserving the existing client construction for valid values.

In `@src/providers/auth-provider/AuthProvider.test.tsx`:
- Around line 17-39: Fix mockSupabaseClient so onAuthStateChange stores the
supplied callback in a callable captured reference rather than using
Object.assign, then update the “onAuthStateChange fires” test to reuse this
helper instead of its duplicated hand-rolled Supabase mock. Preserve the
existing unsubscribe, getUser, and signOut behavior.

In `@src/proxy.test.ts`:
- Around line 20-22: Update the test cleanup around createServerClient so its
vi.fn call history and mock implementation are reset between tests, using the
mock’s reset/clear API in addition to the existing vi.restoreAllMocks() cleanup.
Keep the existing restore behavior and ensure each test starts with an isolated
createServerClient state.

In `@src/proxy.ts`:
- Around line 1-86: Add a Next.js `config` export alongside `proxy` that defines
a matcher excluding static assets, image optimization requests, and public-file
requests while retaining application route handling. Keep the existing `proxy`,
authentication, and internationalization logic unchanged.

In `@src/utils/auth/get-authenticated-user.test.ts`:
- Around line 8-10: The next/navigation unauthorized mock should throw when
invoked to match production control flow. Update the vi.mock definition for
unauthorized in get-authenticated-user tests so calls raise an error rather than
acting as a no-op, allowing tests to detect accidental interception by enclosing
try/catch logic.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bbf0b2a8-c575-4e21-b715-99c2e0a41712

📥 Commits

Reviewing files that changed from the base of the PR and between 84dee66 and 7135cce.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (39)
  • .env.example
  • .gitignore
  • README.md
  • next.config.ts
  • package.json
  • src/app/[locale]/about/page.tsx
  • src/app/[locale]/history/page.tsx
  • src/app/[locale]/layout.tsx
  • src/app/[locale]/sign-in/page.tsx
  • src/app/[locale]/sign-up/page.tsx
  • src/app/[locale]/unauthorized.test.tsx
  • src/app/[locale]/unauthorized.tsx
  • src/components/auth-card/auth-card.test.tsx
  • src/components/auth-card/auth-card.tsx
  • src/components/auth-navigation/auth-navigation.test.tsx
  • src/components/auth-navigation/auth-navigation.tsx
  • src/components/controlled-text-field/controlled-text-field.test.tsx
  • src/components/controlled-text-field/controlled-text-field.tsx
  • src/components/sign-in-form/sign-in-form.test.tsx
  • src/components/sign-in-form/sign-in-form.tsx
  • src/components/sign-up-form/sign-up-form.test.tsx
  • src/components/sign-up-form/sign-up-form.tsx
  • src/components/swagger-control/swagger-control.test.tsx
  • src/components/swagger-control/swagger-control.tsx
  • src/components/swagger-editor/swagger-editor.test.tsx
  • src/i18n/messages/en.json
  • src/i18n/messages/ru.json
  • src/lib/client.test.ts
  • src/lib/client.ts
  • src/lib/server.test.ts
  • src/lib/server.ts
  • src/providers/auth-provider/AuthProvider.test.tsx
  • src/providers/auth-provider/AuthProvider.tsx
  • src/proxy.test.ts
  • src/proxy.ts
  • src/utils/auth/auth-schemas.test.ts
  • src/utils/auth/auth-schemas.ts
  • src/utils/auth/get-authenticated-user.test.ts
  • src/utils/auth/get-authenticated-user.ts

Comment thread src/app/[locale]/unauthorized.tsx
Comment thread src/components/auth-card/auth-card.tsx Outdated
Comment thread src/components/controlled-text-field/controlled-text-field.tsx
Comment thread src/proxy.ts
@AlyaEngineer AlyaEngineer added feature-1-header Feature 1: App Header - a header with navigation controls and authentication options feature-7-general Feature 7: General Requirements labels Jul 12, 2026
@AlyaEngineer AlyaEngineer changed the title Feature/2 sign in sign up feat: sign in / sign up Jul 12, 2026
@AlyaEngineer
AlyaEngineer merged commit 87d1003 into develop Jul 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature-1-header Feature 1: App Header - a header with navigation controls and authentication options feature-2-auth Feature 2: Sign In / Sign Up registration and authentication using email and password feature-7-general Feature 7: General Requirements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature 2: Sign In / Sign Up (50 points)

2 participants