Files
resolutionflow/CURRENT-STATE.md
Michael Chihlas 50cb0fc7f0 feat: admin invite codes with plan assignment + user detail page
- Migration 030: add email, assigned_plan, trial_duration_days, email_sent_at
  to invite_codes with CHECK constraints
- Resend email integration (graceful degradation when API key not set)
- Invite codes now support plan assignment (free/pro/team) and trial duration (1-90 days)
- Registration applies invite code plan/trial to new subscription
- Auto-downgrade expired trials on authenticated access
- Enriched GET /admin/users/{id} with account, subscription, sessions, audit logs
- New endpoints: PUT /admin/users/{id}/subscription/plan and extend-trial
- Frontend: enhanced invite codes page with email, plan, trial fields
- Frontend: new user detail page at /admin/users/:userId
- Fixed API path drift: /invite-codes -> /invites
- 11 new backend tests, 416 total passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 21:42:58 -05:00

5.3 KiB

Current State

Purpose: Quick-reference file showing exactly where the project stands. For Claude Code: Read this first to understand what's done and what's next. Last Updated: February 11, 2026


Active Phase: Phase 2.5 - Step Library Foundation (In Progress)


What's Complete

Backend (100%)

  • FastAPI project structure with 25+ API endpoints
  • PostgreSQL database with Docker, 29+ Alembic migrations
  • User authentication (JWT, register, login, refresh, logout, invite codes)
  • Refresh token rotation with JTI-based revocation
  • Trees CRUD with full-text search (FTS index)
  • Sessions tracking with decisions, outcomes, and variables
  • Export API (Markdown, Text, HTML)
  • Role-based access control (super_admin, team_admin, engineer, viewer)
  • Production-ready logging with correlation IDs
  • 100+ integration tests
  • Rate limiting on auth endpoints (disabled in DEBUG)
  • Audit log table with JSONB details
  • Soft delete for trees with cascade cleanup

Frontend (Phase 2 Complete)

  • React 19 + Vite + TypeScript + Tailwind setup
  • Authentication UI (login, register)
  • Tree library/browsing page with grid/list/table views
  • Tree navigation interface (session player)
  • Session management with history and detail pages
  • Export functionality (download)
  • Tree Editor — Form-based with visual preview, Zustand + immer + zundo (undo/redo)
  • Markdown rendering in session player and node editor
  • Monochrome Design System — Dark-only, glass-morphism cards, Inter font, theme toggle removed
  • Tree Organization — Categories, tags (autocomplete), user folders (3-level hierarchy), filters
  • RBAC & PermissionsusePermissions hook, ProtectedRoute with role guards, permission-based UI hiding
  • Session Scratchpad — Floating overlay (Ctrl+/), auto-save, markdown preview
  • Admin Panel — 8 pages (dashboard, users, invite codes, audit logs, plan limits, feature flags, settings, categories)
  • Session Quick Wins (Issues #51-#55):
    • Session timer (useSessionTimer hook, MM:SS / HH:MM:SS)
    • Keyboard hints (Tab focuses notes)
    • Repeat Last Session (prefills metadata from localStorage)
    • Session auto-recovery (resume incomplete sessions)
    • Copy step to clipboard
    • Delete tree button in all view modes
  • Session Outcomes — Outcome modal on session completion, step timing tracking
  • Settings page at /settings — Default export format preference

Security Hardening (Phases A-D Complete)

  • Registration role hardcoded to engineer
  • HTML export XSS fix (html.escape)
  • Secret key validator (rejects default when DEBUG=False)
  • Role CHECK constraint on users table
  • Tree access check on session start
  • Centralized permissions in permissions.py
  • is_active field on User model, enforced in auth
  • Admin user management endpoints (6 endpoints)
  • Refresh token rotation with JTI-based revocation
  • Password complexity validation (uppercase, lowercase, digit, min 10 chars)
  • Soft delete cascade cleanup (folder/tag junctions)
  • SQL wildcard escaping in tag search

Backend Schema Features (Not Yet in Frontend)

  • Tree Forking (migration 022) — parent_tree_id, root_tree_id, fork_depth, fork_reason
  • Session Sharing (migration 023) — session_shares, session_share_views, allow_public_shares
  • Tree Sharing (migration 024) — tree share links
  • Tree Status (migration 025) — status field on trees
  • Admin Panel Tables (migration 026) — plan limits, feature flags
  • Session Variables (migration 028) — variable tracking in sessions
  • Session Outcomes (migration 029) — outcome tracking

Documentation

  • CLAUDE.md (project context for Claude Code)
  • LESSONS-LEARNED.md (bugs and fixes reference)
  • Design system guide, component examples
  • Feature specifications through Phase 4
  • Rebrand implementation guide

What's In Progress

Task Status Notes
Step Library Frontend In Progress Backend complete, frontend UI pending
Custom Step Flow In Progress Integration with tree navigation
Tree Forking UI Planning Backend schema complete (migration 022)
Session Sharing UI Planning Backend schema complete (migration 023)

What's Next (Priority Order)

Immediate (Phase 2.5 Completion)

  1. Step Library Frontend UI (browse, search, rate/review)
  2. Custom Step Integration in tree navigation
  3. Tree Forking UI and workflow
  4. Session/Tree Sharing UI

Soon (Phase 3)

  • File attachments for sessions
  • Offline capability
  • Client context system
  • Advanced analytics dashboard

Later (Phase 4)

  • PSA integrations (ConnectWise, Kaseya)
  • PowerShell automation framework
  • Enterprise features (SSO, white-label)

Environment Quick Reference

Start Development

docker start patherly_postgres
cd backend && .\venv\Scripts\activate && uvicorn app.main:app --reload
cd frontend && npm run dev

URLs

Run Tests

cd backend && pytest --override-ini="addopts="

Blockers / Known Issues

Issue Workaround Status
pytest-asyncio version conflict Use 0.24.0 Documented
No local psql on Windows Use docker exec Documented