Commit Graph

2 Commits

Author SHA1 Message Date
Phil c630993680 refactor: rename tenants.app_name to legacy_app_name; apply agent-comment markers
- Rename Tenant.app_name -> legacy_app_name so the incumbent per-tenant name never
  collides with a shared pool's app_name (which is a single shared value for all
  pooled tenants). It's the value that keeps a tenant's external vector-store
  namespace stable when the tenant moves onto a shared backend.
- Apply the agent-comment-marker convention (# ai: / # region ai) across the
  tenant_id schema, the bootstrap script, and its test: the why (receipts,
  anti-prior gotchas) is foldable-marked; short docstrings carry the what.

Comments/docstrings + one column rename only; the bootstrap integration test
stays green (no behavioral change).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-02 14:11:01 -04:00
Phil ec16f4ad25 test: add shared-tenant schema bootstrap integration test
Runs scripts/bootstrap_shared_schema against a throwaway database and asserts the
partitioned schema it produces: every tenant-scoped table is HASH(tenant_id)-
partitioned with its full partition set, the primary key leads with tenant_id, and
the tenant-scoped composite keys enforce (two tenants can share a workspace name, a
duplicate name within a tenant is rejected, and an unknown tenant_id is rejected by
the FK to tenants). Runs against real Postgres + pgvector, bypassing the app's
create_all fixture (which does not create partitions).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-02 13:42:45 -04:00