feat: Projects backend slice — auth, primitives, backend, UI #3
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/projects-backend"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Auth: - Add useWebAuth hook as the single web-facing auth interface with four states (loading/unauthenticated/authenticated/inconsistent) - Normalize getCurrentUser to return {id: tokenIdentifier, name, email} - Rename requireOwnerId to requireAuthUserId across all backend callers - Set expectAuth:true on ConvexReactClient singleton - Migrate _app, _auth, user-menu, use-personal-organization to useWebAuth - Remove unused @code/auth/server export (zero callers confirmed) Primitives: - Add packages/primitives/src/project.ts with Effect v4 Project domain: URL normalization, six canonical context kinds, strict remote decoding, context write decisioning with revision tracking, and no-op detection - Define PublicGit and ProjectStore replaceable ports - Define ProjectApplication service orchestrating domain+ports with deterministic error mapping - Add comprehensive test suite (28 tests) with in-memory store and fake PublicGit covering normalization, seeds, idempotency, tenant isolation, last-write-wins, and typed error mappingSchema: - Cut projects table to {organizationId, name, description, createdAt, updatedAt} - Add projectSources table with git source metadata and normalized URL index - Add projectContextDocuments table with six canonical kinds, origin, revision - Add by_organizationId index for project enumeration - Remove all GitHub-specific fields (ownerId, provider, repoOwner, etc.) Backend: - Add requireCurrentOrganization and requireProjectMember authz helpers - Migrate signals.ts authorizeProject to organizationId invariant check - Update artifactModel: 8 operational artifacts (removed project/business/design.md) - Add projectStore.ts with query/mutation/action store adapters - Rewrite projects.ts to thin generic application calls - Update projectIssues/projectArtifacts to use requireProjectMember - Update projectEvents.test.ts and signals.test.ts for new project creation All 33 backend tests pass.