Refactor/schemav2#48
Open
Nqv1208 wants to merge 32 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
- Remove unsafe RlsSessionInterceptor (command text mutation) - Add IRlsSessionContext/RlsSessionContext with separate set_config SQL - Add RlsOptions config (Enabled, ApplyPoliciesOnStartup, SetSessionContext) - Rewrite RlsPolicyApplier as ordered script runner (14 SQL files) - Integrate RLS session context into TransactionBehavior after BeginTransaction - Add --rls-apply CLI command and make db-rls target - Update test constructors for new RlsOptions parameter
…rd refactor - Add NotificationCounter entity + EF config for notifications.notification_counters - Add ResourceReadState entity + EF config for collab.resource_read_states - Split DashboardWidget from Dashboard.cs into separate file with IWorkspaceScoped - Add workspace_id to DashboardWidget entity and EF configuration - Rename WidgetType to DashboardWidgetType, split DashboardSourceType enum - Add workspace_id back to SearchDocumentRecord with proper V5 unique constraint - Update DashboardWidgetConfiguration to map workspace_id column - Update seed to create authz.workspace_access_grants and use canonical notification tables - Add RLS verification tests and architecture tests - Update test files for renamed types
- Fix 006: replace owner_user_id with created_by in workspace insert policy - Fix 007: conditional deleted_at filter via PL/pgSQL column existence check - Fix 010: remove deleted_at from notification_recipients (no soft-delete), fix schema for notification_deliveries - Fix 013: allow app SELECT on search.search_documents without workspace filter (table has no workspace_id) - Fix grants: correct table names to match EF schema (member_role_assignments, workspace_feature_usages, collab.notification_deliveries) - Add grants for notification_counters and resource_read_states - Add RLS policies for notification_counters and resource_read_states - Improve RlsPolicyApplier logging with connection and SQL length info - Update RlsSessionContext for cleaner session context application
- Change SearchDocumentRecord.SearchVector from string? to NpgsqlTsVector? - Set column type to tsvector in EF configuration - GIN index on tsvector works without operator class - Fixes 'data type text has no default operator class for access method gin' error
- Add AccountId to all workspace-scoped entities for multi-account support - Update all domain events to include AccountId parameter - Add AccountRootDomainEvent, AccountScopedDomainEvent base classes - Add IAccountScoped interface - Add Auditing/ directory with audit infrastructure - Update all bounded contexts: WorkManagement, Governance, Identity, Billing, Collaboration, Documents, Integrations, Automation, Analytics, Workspaces - Update ResourceType enum with new V5 values - Add new entities: InvoiceLineItem, PlanPrice, SubscriptionItem, EntitlementTargetScope - Add new Account domain: Account aggregate root - Remove legacy Governance/Audit, Governance/Security, Identity/Security entities - Remove legacy Collaboration/Notifications (canonical notifications.* replaces collab.*) - Remove legacy Notifications/NotificationItems, NotificationRecipients, NotificationPreferences
- Add Account, AccountMember, AccountInvitation, AccountDomain, AccountRegion, AccountSettings, AccountIdentityProvider EF configs - Add AccessGrant config (replaces WorkspaceAccessGrant for authz) - Add BillingCustomer, InvoiceLineItem, PlanPrice, SubscriptionItem configs - Add NotificationCounterRecord, NotificationItemRecord, NotificationPreferenceRecord, NotificationRecipientRecord - Update ApplicationDbContext with new DbSets and remove legacy ones - Update all existing EF configurations for V5 schema changes - Remove legacy Audit, Security, Ops, SSO, SCIM, ActivityLog, UnreadCounter configs - Update DI registrations, Messaging, BackgroundJobs, Observability, Realtime - Update SearchDocumentRecord with NpgsqlTsVector for search_vector
- Remove old SchemaCompletionV1 and V2 migrations - Add new SchemaCompletionV2 with tsvector search_vector and account support - Remove legacy Outbox directory (replaced by messaging schema) - Remove legacy Audit data entities - Update model snapshot for new schema
- Update domain tests for AccountId parameter in entity creation - Update event tests for new event signatures with AccountId - Remove legacy notification, audit, security, SSO, SCIM tests - Update integration tests for new schema - Add RLS verification tests - Update architecture tests for new entity patterns - Remove legacy outbox and unread counter tests
…guity - Add MediatR, FluentValidation, EF Core, Logging, Hosting usings to Application GlobalUsings - Add MassTransit, MediatR, EF Core, Npgsql, Redis, JWT, Auth usings to Infrastructure GlobalUsings - Add MediatR, FluentValidation, OpenApi usings to API GlobalUsings - Fix ValidationException ambiguity in ProblemDetailsMapper (use FluentValidation.ValidationException) - dotnet format cleaned up unused usings from individual files
- Replace InMemory provider with Testcontainers PostgreSQL for real RLS testing - Add Testcontainers.PostgreSQL package reference - Fix pg_policies queries to handle text[] roles column with array_to_string - Update role count assertion to match current policy pack (5 roles) - Verify authz schema existence instead of table (table created by separate migration)
…factor - Fix BillingAccountScopedDomainEvent to inherit WorkspaceScopedDomainEvent (not DomainEvent directly) - Fix AccountScopedDomainEvent to inherit WorkspaceScopedDomainEvent - Fix AccountRootDomainEvent to inherit WorkspaceRootDomainEvent - Fix Billing events: change Guid? WorkspaceId to Guid WorkspaceId in positional parameters - Fix Invoice/Subscription/Entitlement entities: use WorkspaceId ?? Guid.Empty when raising events - Fix Subscription/Invoice lifecycle tests: pass workspaceId to Create calls - Remove Notification from DomainEventCompletenessTests (entity deleted in V5 refactor) - All 1258 Domain tests now pass
- Add Application.ValidationException to ProblemDetailsMapper (fixes 500→400) - Add JsonDocument value converter to FeatureUsageDaily/WorkspaceUsageDaily configs - Add AuditLog JsonDocument converters for InMemory provider - Register Account events in DomainEventDispatchPolicy - Suppress model validation warning in DomainEventInterceptor test - API tests: 21/21 pass - Domain tests: 1258/1258 pass
1. Close Schema V2 contract in code: DbSchemas + DbContext + remove legacy mappings. 2. Move the entire Domain to account-rooted: AccountId non-null. 3. Edit Application tenant context: no longer nullable AccountId in handler. 4. Replace the RLS runtime in the branch with the passed RLS V2 split. 5. Separate projection/infra from Application business DbContext exposure. 6. Regenerate migration using EF command, no manual editing. 7. Tighten integration/schema contract/RLS tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.