Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
992b0d4
Harden src/services/tasks.ts ownership and identity
ADAMDEV01 Nov 6, 2026
acd882a
Harden src/auth/AuthProvider.tsx ownership and identity
ADAMDEV01 Nov 6, 2026
e78fde7
Harden src/hooks/useTasks.ts ownership and identity
ADAMDEV01 Nov 6, 2026
8ff3aca
Preserve Supabase password sign-in
ADAMDEV01 Nov 6, 2026
9c1caf4
Extract testable task search, filters and sorting
ADAMDEV01 Nov 6, 2026
6bc9fc7
Test demo authentication identity lifecycle
ADAMDEV01 Nov 6, 2026
673f971
Test task search filters and sorting
ADAMDEV01 Nov 6, 2026
ea979b9
Use tested task search and filtering utility
ADAMDEV01 Nov 6, 2026
093ae1d
Test full demo task CRUD and owner isolation
ADAMDEV01 Nov 6, 2026
29f9d1e
Test query hooks and optimistic rollback
ADAMDEV01 Nov 6, 2026
7eea338
Add executable two-user pgTAP RLS regression suite
ADAMDEV01 Nov 6, 2026
fd0571b
Configure reproducible local Supabase CI environment
ADAMDEV01 Nov 6, 2026
572da66
Add standalone TypeScript validation script
ADAMDEV01 Nov 6, 2026
c92dee3
Test Supabase session refresh and expiration lifecycle
ADAMDEV01 Nov 6, 2026
1d8d9cd
Stabilize Playwright CI execution
ADAMDEV01 Nov 6, 2026
12214b8
Add deterministic npm, TypeScript, Playwright and Supabase RLS CI
ADAMDEV01 Nov 6, 2026
06abbcc
Clarify browser-local demo data and identity isolation
ADAMDEV01 Nov 6, 2026
12a7567
Exercise demo persistence, logout and account switching
ADAMDEV01 Nov 6, 2026
4d84738
Document demo identity boundaries, RLS suite and CI workflow
ADAMDEV01 Nov 6, 2026
4b168f6
Clean up Supabase auth lifecycle test types
ADAMDEV01 Nov 6, 2026
be4aae2
Add tested client-side task pagination helper
ADAMDEV01 Nov 6, 2026
e526543
Cover task list pagination behavior
ADAMDEV01 Nov 6, 2026
44298ab
Use tested pagination helper in task list
ADAMDEV01 Nov 6, 2026
b22c883
Cover query error state and retry surface
ADAMDEV01 Nov 6, 2026
899185d
Correct cross-account CRUD ownership regression fixtures
ADAMDEV01 Nov 6, 2026
22d72f8
Publish generated npm lockfile for reproducible installs
ADAMDEV01 Nov 6, 2026
974e034
Assert Supabase updates and deletes include owner filters
ADAMDEV01 Nov 6, 2026
eeb617d
Verify blocked RLS writes using privileged fixture assertions
ADAMDEV01 Nov 6, 2026
af120e8
Use simple query-chain mocks without thenable objects
ADAMDEV01 Nov 6, 2026
808dfe6
Add explicit package-lock synchronization command
ADAMDEV01 Nov 6, 2026
8a11074
Persist resolved lockfile and install with npm ci
ADAMDEV01 Nov 6, 2026
b7d7a92
chore: synchronize npm lockfile
github-actions[bot] Nov 6, 2026
abdabf7
Document lockfile maintenance for reproducible npm ci
ADAMDEV01 Nov 6, 2026
fbc00b9
Use committed lockfile directly with npm ci in CI
ADAMDEV01 Nov 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,42 @@ on:
branches: [main]
permissions:
contents: read

jobs:
quality:
frontend:
name: Frontend quality and browser tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm install --no-audit --no-fund
- run: npm ci --no-audit --no-fund
- run: npm run lint
- run: npm test
- run: npm run typecheck
- run: npm test -- --reporter=verbose
- run: npm run build
- run: npx playwright install --with-deps chromium
- run: npm run test:e2e
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
if-no-files-found: ignore
retention-days: 7

database-rls:
name: Supabase PostgreSQL RLS integration tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: supabase/setup-cli@v1
with:
version: latest
- run: supabase start -x studio,imgproxy,edge-runtime,logflare,vector,supavisor
- run: supabase db reset
- run: supabase test db
53 changes: 30 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Taskflow

A responsive task-management workspace built with React, TypeScript, Vite, TanStack Query and Supabase. Includes task CRUD, status/priority tracking, due dates, search, filters and profile settings.
A responsive task-management workspace built with React, TypeScript, Vite, TanStack Query and Supabase. Includes task CRUD, status/priority tracking, due dates, search, filters, sorting, list/Kanban views and profile settings.

## Try the demo
## Demo mode versus Supabase mode

Run without Supabase variables:
Run without Supabase environment variables:

```bash
npm install
npm ci
npm run dev
```

**Demo mode: data is saved only in your browser. Any email address is accepted; no account is required.** Demo records stay in this browser's localStorage and are not uploaded or shared. Do not enter sensitive information. Clear this site's local storage to reset the demo.
**Browser-only demo:** any email can sign in without a real account. Each normalized email receives its own persistent demo identity. Tasks and profile settings are stored in this browser's local storage, remain after sign-out, and are restored when that same email signs in again. Different demo emails cannot see or modify each other's tasks. Demo data is not uploaded to Supabase; do not enter sensitive information.

With Supabase credentials configured, the app uses Supabase Auth and PostgreSQL instead.
**Supabase mode:** when both public Supabase variables are configured, authentication and task data use Supabase Auth and PostgreSQL. Supabase session refresh/expiration is handled by the Supabase client and its auth-state events.

## Supabase setup

Expand All @@ -28,36 +28,43 @@ VITE_SUPABASE_ANON_KEY=your-anon-key

Only the public URL and anon/publishable key belong in browser variables. Never expose a service-role key.

## Schema

```mermaid
erDiagram
AUTH_USERS ||--|| PROFILES : owns
AUTH_USERS ||--o{ TASKS : owns
PROFILES {\n uuid id PK\n text display_name\n text avatar_url\n }\n TASKS {\n uuid id PK\n uuid user_id FK\n text title\n text status\n text priority\n date due_date\n }
```

## Row-level security

RLS is enabled on `profiles` and `tasks`. Profile SELECT/INSERT/UPDATE policies require `auth.uid() = id`. Task SELECT/INSERT/UPDATE/DELETE policies require `auth.uid() = user_id`; UPDATE also uses `WITH CHECK` so ownership cannot be reassigned. See `supabase/tests/rls_isolation.sql` for the two-user isolation regression script.
RLS is enabled on `profiles` and `tasks`. Every task operation is scoped by the authenticated `user_id` in the client query as well as by database RLS. Task UPDATE policies use both `USING` and `WITH CHECK` to prevent cross-user writes and ownership reassignment.

## Production demo
The two-user pgTAP integration suite in `supabase/tests/rls_isolation.sql` provisions independent Auth identities and asserts:
- User A can only read A's tasks, not B's.
- A cannot update or delete B's task.
- A cannot transfer a task to B by changing `user_id`.

A live Supabase-backed demo needs a real Supabase project, deployed environment variables, and a deliberately provisioned demo account. Those are owner-controlled settings and no credentials are committed here. Vercel variables: `VITE_SUPABASE_URL` and `VITE_SUPABASE_ANON_KEY`.

## Development
## Development and tests

```bash
npm install
npm ci
npm run dev
npm run lint
npm run typecheck
npm test
npm run build
npm run test:e2e
```

CI runs lint, unit tests, Playwright demo E2E and the production build. E2E does not require Supabase.
When dependencies change, run `npm run lockfile:sync` and commit the resulting `package-lock.json`; clean installs then use `npm ci`.

RLS integration tests run locally with Docker and the Supabase CLI:

```bash
supabase start
supabase db reset
supabase test db
```

GitHub Actions runs frontend lint, standalone TypeScript checking, Vitest, production build and Playwright against a fixed Chromium server. A separate job starts a clean local Supabase/PostgreSQL stack, applies migrations, and runs pgTAP RLS tests. Playwright reports are uploaded as CI artifacts when available.

## Data pagination

The task list currently uses client-side “Load more” pagination after fetching the user's task set. For larger workspaces, move filtering, sorting and pagination into a database query using a stable cursor (for example `created_at,id`) rather than offset pagination.

## Screenshots

Capture the real running app and add these images under `docs/screenshots/`: `tasks.png` (task list), `dashboard.png` (overview), and `settings.png` (profile settings). Screenshots are not fabricated; capture them from the final UI.
Add genuine screenshots captured from the deployed app under `docs/screenshots/`. No placeholder screenshots are committed; a live Supabase-backed demo requires project credentials and a deliberately provisioned demo account.
40 changes: 27 additions & 13 deletions e2e/demo.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
import { test, expect } from '@playwright/test'
test('visitor can use the browser-only demo without a Supabase account',async({page})=>{
await page.goto('/')
await page.getByLabel('Email address').fill('visitor@example.test')
await page.getByLabel('Password').fill('demo-password')
await page.getByRole('button',{name:'Sign in'}).click()
await expect(page.getByText('Demo mode',{exact:true})).toBeVisible()
await expect(page.getByText(/data is saved only in your browser/i)).toBeVisible()
await page.getByRole('button',{name:/new task/i}).click()
await page.getByPlaceholder('e.g. Prepare launch notes').fill('E2E demo task')
await page.getByRole('button',{name:'Add task'}).click()
await expect(page.getByRole('heading',{name:'E2E demo task'})).toBeVisible()
await page.reload()
await expect(page.getByRole('heading',{name:'E2E demo task'})).toBeVisible()

async function signIn(page: import('@playwright/test').Page, email: string) {
await page.getByLabel('Email address').fill(email)
await page.getByLabel('Password').fill('demo-password')
await page.getByRole('button', { name: 'Sign in' }).click()
}

test('browser-only demo persists data and isolates different email identities', async ({ page }) => {
await page.goto('/')
await signIn(page, 'visitor-a@example.test')
await expect(page.getByText('Browser-only demo')).toBeVisible()
await expect(page.getByText(/each email has a separate demo workspace/i)).toBeVisible()

await page.getByRole('button', { name: /new task/i }).click()
await page.getByPlaceholder('e.g. Prepare launch notes').fill('Private A task')
await page.getByRole('button', { name: 'Add task' }).click()
await expect(page.getByRole('heading', { name: 'Private A task' })).toBeVisible()
await page.reload()
await expect(page.getByRole('heading', { name: 'Private A task' })).toBeVisible()

await page.getByRole('button', { name: 'Sign out' }).click()
await signIn(page, 'visitor-b@example.test')
await expect(page.getByRole('heading', { name: 'Private A task' })).toHaveCount(0)

await page.getByRole('button', { name: 'Sign out' }).click()
await signIn(page, 'visitor-a@example.test')
await expect(page.getByRole('heading', { name: 'Private A task' })).toBeVisible()
})
Loading
Loading