Skip to content

Hard-cut chat tenancy to client-minted Interchange tenants - #740

Closed
TheGreatAxios wants to merge 4 commits into
mainfrom
cl-intx-chat-cutover
Closed

TheGreatAxios wants to merge 4 commits into
mainfrom
cl-intx-chat-cutover

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Intent

There is no parent bench: the client drives stock Interchange, and chat follows. This branch hard-cuts chat tenancy to client-minted Interchange tenants — deleting the bespoke workbench tenancy layer (workbench-tenancy.ts, tenancy routes, dead migrations) without replacement rather than shimming it.

Key commits

  • 5894a024 feat(chat)!: hard-cut chat tenancy to client-minted Interchange tenants
  • fb50cd99 fix(chat): reuse validated person-DM counterpart instead of re-fetching
  • 1fadffa8 feat(chat)!: purge dead tenancy migrations for hard-refresh cutover
  • c6b1c802 chore(chat): drop stale report-error baseline entries for deleted tenancy surface

Verification

  • Suites (rewrote on this branch): packages/chat/test/routes.test.ts rewritten against the cut surface; workbench-tenancy / workbench-tenancy-routes / provision-space-workbench / agent-dm-warm-mailbox suites deleted with the code; migrations, room-access, workbench-service, agent-turns suites updated; report-error baseline pruned.
  • Depends on the client-driver cutover in PR (1); stacked logically after it.
  • Full bun run check gate runs in CI on this PR.

Notes

  • Linear issue IDs are pending; this branch will be renamed to cl-<id>-<slug> once filed.
  • Merge order is 1 → 2 → 3 with (3) hub last. This is PR (2) of 3 — merge after (1), before (3).

Summary:

- New forward migration 0031 drops chat.workbench_tenancy and its index; history untouched, chat_bench_settings kept (product data, no drop).

- Delete workbench-tenancy.ts, workbench-tenancy-routes.ts (POST /kinds), POST /workbenches/:id/move, and POST /participants/mint-dm.

- Delete mint wrappers (createWorkbenchTenant, mintNativeChildTenant, mintAgentDm, provisionSpaceWorkbench), tenancy compensations, grant planting, addWorkbenchMember conferral, withTenancy annotator, legacy true/false and no_tenancy paths, find-or-reopen.

- Retain pure native principal reads in new neutral module src/native-principal.ts (refId projection for DM 1:1 validation); server mints nothing, settings writes take client-minted ids.

- Update no-product-tenancy structural allowlist (workbench_tenancy removed) and chat-local README.

Verification:

- bun run typecheck (packages/chat): exit 0

- bun test (packages/chat): 928 pass, 0 fail (two consecutive full runs)

- bunx prettier --check on changed files: pass; bunx eslint packages/chat: exit 0

- bun run check:structural no-product-tenancy: ok
Summary: Collapse the second person-DM principal lookup into the pre-mint gate's validated result, reusing it with the full kind/status predicate instead of re-fetching with an undefined-only check. Add pins for agent-kind and cross-bench principalId rejection plus a single-lookup assertion. Clear stale deleted-test-file and workbenchTenancy comment pointers.

Verification: bun test (931 pass, 0 fail), bun run typecheck (exit 0), prettier --check and eslint on touched files (clean).
HARD REFRESH - EXISTING DATABASES MUST RESET (bun run reset). There is
no upgrade path for the removed entries: any dev/test database whose
chat.chat_migrations ledger already contains 0005_channel_tenancy or
0006_channel_tenancy_parent_index will NOT replay them (they no longer
exist in the chain), and must be rebuilt from scratch rather than
migrated forward.

Summary:

- Delete the dead chain rendered moot by 0031_drop_workbench_tenancy:
  0005_channel_tenancy CREATE, 0006_channel_tenancy_parent_index, and the
  three 0018 tenancy rename rows (table/column/index renames that only
  ever served the link table). Fresh databases now build clean with no
  backfill and no legacy rows; the tenancy table is never created.
- Keep 0031 as the forward-drop guard (SQL untouched, table stays
  dropped): a no-op DROP IF EXISTS on fresh databases, still drops the
  leftover table/index on pre-purge databases.
- No other entries touched: audit found no additional backfill or
  no_tenancy-era migrations whose sole purpose dies with the dropped
  table (the only tenancy references in the chain were 0005/0006/0018/
  0031). Ledger names are stable identifiers, so later entries keep
  their numbers - the chain now has gaps at 0005/0006 by design and must
  never be renumbered.
- Update test/migrations.test.ts ledger assertions to the 29-entry
  purged chain. No allowlist change: no-product-tenancy still passes at
  16 tables (workbench_tenancy was already removed there), and its 0018
  comment stays accurate.

Verification:

- bun test test/migrations.test.ts (isolated scratch DBs, never the
  shared DATABASE_URL): 4 pass, 0 fail - fresh replay applies the purged
  chain idempotently, tenancy tables/indexes absent
- bun test (packages/chat): 931 pass, 0 fail
- bun run typecheck (packages/chat): exit 0
- bunx prettier --check on changed files: pass; bunx eslint
  packages/chat: exit 0
- bun run check:structural: 17 ok; check:report-error FAILs on 4 stale
  baseline entries in routes.ts/workbench-service.ts left by the earlier
  cutover commits (pre-existing, unrelated to this change)
TheGreatAxios added a commit that referenced this pull request Sep 16, 2026
Intx cutover: chat tenancy + hub stock composition (combines #740/#741)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant