system-prompts-and-models-o.../salesflow-saas/backend/app/models/__init__.py
Claude 38e9d02075
feat(dealix): close ALL 4 Tier-1 runtime gaps (Programs E, F, G, K, J)
Program F — Multi-Tenancy RLS (Row-Level Security):
  alembic 20260417_0002_add_rls.py: Enables RLS on 23 tenant-scoped tables.
  database_rls.py: set_tenant_context() helpers for SET LOCAL app.tenant_id.
  middleware/tenant_rls.py: Extracts tenant_id from JWT on every request.
  Default-deny when no context. PostgreSQL only (CI safe on SQLite).
  Result: OWASP A01:2025 — access control enforced at DB layer.

Program G — Idempotency Standard:
  models/idempotency_key.py: IdempotencyKey table with TTL + SHA256 hash.
  services/idempotency_service.py: get_existing/store with request fingerprint.
  middleware/idempotency.py: HTTP middleware on POST/PUT/PATCH.
  Result: Duplicate side effects prevented on retry.

Program E — Persistent Durable Execution:
  models/durable_checkpoint.py: DurableCheckpoint with sequence_num + status.
  services/durable_runtime.py: start_run/checkpoint/complete/resume/list_incomplete.
  Result: Workflows survive crashes — resume from last persisted checkpoint.

Program K — OpenTelemetry:
  observability/otel.py: init/span/inject_correlation_id with graceful
    degradation when OTel packages absent.
  openclaw/gateway.py: Wraps execute() in span, binds correlation_id to
    trace_id. Bridge between business correlation and production observability.

Program J — Release Gate Hardening:
  docs/governance/release-gates.md: Documents 3 mandatory gates.
  .github/workflows/dealix-ci.yml: Adds release_readiness_matrix as CI step.
  release_readiness_matrix.py: Updated to check 41/41 components.

Verification:
  architecture_brief.py:     40/40 PASS
  release_readiness_matrix.py: 41/41 PASS

https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
2026-04-17 10:12:04 +00:00

53 lines
2.6 KiB
Python

from app.models.base import BaseModel, TenantModel
from app.models.tenant import Tenant
from app.models.user import User
from app.models.lead import Lead
from app.models.customer import Customer
from app.models.deal import Deal
from app.models.activity import Activity
from app.models.message import Message
from app.models.proposal import Proposal
from app.models.notification import Notification
from app.models.subscription import Subscription
from app.models.template import IndustryTemplate
from app.models.property import Property
from app.models.audit_log import AuditLog
from app.models.operations import ApprovalRequest, DomainEvent, IntegrationSyncState
from app.models.affiliate import AffiliateMarketer, AffiliatePerformance, AffiliateDeal
from app.models.ai_conversation import AIConversation, AutoBooking
from app.models.company import Company, Contact
from app.models.call import Call
from app.models.commission import Commission, Payout
from app.models.dispute import Dispute
from app.models.guarantee import GuaranteeClaim
from app.models.compliance import Consent, Complaint, Policy
from app.models.knowledge import KnowledgeArticle, SectorAsset
from app.models.advanced import TrustScore, Prospect, Scorecard, AIRehearsal
from app.models.consent import PDPLConsent, PDPLConsentAudit, DataRequest
from app.models.sequence import Sequence, SequenceStep, SequenceEnrollment, SequenceEvent
from app.models.strategic_deal import CompanyProfile, StrategicDeal, DealMatch
from app.models.api_key import APIKey, AppSetting
from app.models.contradiction import Contradiction
from app.models.evidence_pack import EvidencePack
from app.models.compliance_control import ComplianceControl
from app.models.idempotency_key import IdempotencyKey
from app.models.durable_checkpoint import DurableCheckpoint
__all__ = [
"BaseModel", "TenantModel", "Tenant", "User", "Lead", "Customer",
"Deal", "Activity", "Message", "Proposal", "Notification",
"Subscription", "IndustryTemplate", "Property", "AuditLog",
"DomainEvent", "ApprovalRequest", "IntegrationSyncState",
"AffiliateMarketer", "AffiliatePerformance", "AffiliateDeal",
"AIConversation", "AutoBooking",
"Company", "Contact", "Call", "Commission", "Payout",
"Dispute", "GuaranteeClaim", "Consent", "Complaint", "Policy",
"KnowledgeArticle", "SectorAsset",
"TrustScore", "Prospect", "Scorecard", "AIRehearsal",
"PDPLConsent", "PDPLConsentAudit", "DataRequest",
"Sequence", "SequenceStep", "SequenceEnrollment", "SequenceEvent",
"CompanyProfile", "StrategicDeal", "DealMatch",
"Contradiction", "EvidencePack", "ComplianceControl",
"IdempotencyKey", "DurableCheckpoint",
]