Skip to content

docs(designs): Add OSS/EE convergence assessment and schema parity plan#4669

Open
jp-agenta wants to merge 7 commits into
mainfrom
docs/oss-ee-convergence-design
Open

docs(designs): Add OSS/EE convergence assessment and schema parity plan#4669
jp-agenta wants to merge 7 commits into
mainfrom
docs/oss-ee-convergence-design

Conversation

@jp-agenta

@jp-agenta jp-agenta commented Jun 12, 2026

Copy link
Copy Markdown
Member

Context

OSS today is hard single-org and ignores the four AGENTA_ACCESS_* env vars it already parses. We want OSS to support multiple organizations with the same access-control semantics as EE (goal A), and the OSS schema to become a strict subset of the EE schema (goal B). Before changing code, this assessment maps the full blast radius.

Changes

Design docs only, no code:

  • assessment-a-oss-multi-org.md: the assessment. Current single-org mechanisms, the five changes needed, a file-level inventory (EE to OSS moves, OSS and EE modifications, web gate relaxations), the two-step schema parity plan (drift fixes on kept tables, then dropping 20 dead legacy tables), documentation impact, and sequencing.
  • oss_core.txt, ee_core.txt, oss_tracing.txt, ee_tracing.txt: live schema dumps of both editions' databases, with diff_core.txt and diff_tracing.txt. The tracing delta is zero; the core delta backs the parity plan.
  • dump_pg_schema.sh: the script that produced the dumps.
  • pr-plan.md: execution plan. The work ships as this PR plus five implementation PRs, one per sequencing step.

Notes

  • The implementation PRs reference this folder; review the assessment first.

🤖 Generated with Claude Code

@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Jun 12, 2026
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 14, 2026 1:12pm

Request Review

@dosubot dosubot Bot added the documentation Improvements or additions to documentation label Jun 12, 2026
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a multi-org convergence assessment, deterministic Postgres schema-dump script, EE/OSS schema dumps and diffs, and a six-PR execution plan to migrate membership models, add OSS org-creation/signup parity, enforce AGENTA_ACCESS_* in OSS, and achieve schema parity.

Changes

OSS/EE Convergence: Multi-Org & Schema Parity Design

Layer / File(s) Summary
Assessment and convergence design
docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md
Defines current OSS single-org constraints, enumerates EE-gated enforcement gaps for AGENTA_ACCESS_*, and prescribes five workstreams: membership table migration/backfill, OSS org-creation endpoint parity, signup flow convergence, enforcing access env vars in OSS, and singleton/front-end gate cleanup.
PR execution topology and checklist
docs/designs/oss-ee-convergence/pr-plan.md
Six-PR GitButler topology and per-PR worklogs (PR0–PR5), lane/branch sequencing and merge-order constraints, final-phase docs/checklist, and a test-phase itemization for post-merge verification.
Schema dump utility script
docs/designs/oss-ee-convergence/dump_pg_schema.sh
Bash CLI producing deterministic, diff-friendly Postgres schema dumps with connection options, optional exact per-table row counts, and labeled sections for server, extensions, enums, sequences, columns/order, constraints, indexes, triggers, views, and Alembic version.
Core database schema evolution
docs/designs/oss-ee-convergence/diff_core.txt, docs/designs/oss-ee-convergence/oss_core.txt
Schema diffs and full OSS core dump showing tenant-scoping columns (organization_id/workspace_id), new multi-tenant tables (memberships, domains, providers, subscriptions, meters, evaluations, environments, testsets, deployments), meters_type enum, NOT NULL api_keys changes, reordered COLUMN-ORDER, updated FK/PK/constraints, and added indexes.
Tracing database schema evolution
docs/designs/oss-ee-convergence/diff_tracing.txt, docs/designs/oss-ee-convergence/ee_tracing.txt, docs/designs/oss-ee-convergence/oss_tracing.txt
Tracing schema header rename and full schema dumps for EE and OSS tracing databases with alembic_version, events/spans tables, column ordering, PKs, and JSONB/GIN/FTS indexes.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 60.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding design documentation for OSS/EE convergence assessment and schema parity planning.
Description check ✅ Passed The description is clearly related to the changeset, explaining the context (OSS single-org limitations), the changes (design docs with schema dumps and execution plan), and the objectives (multi-org support with EE semantics and schema parity).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/oss-ee-convergence-design

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jp-agenta jp-agenta changed the title docs(designs): OSS/EE convergence assessment — multi-org OSS + schema parity docs(designs): Add OSS/EE convergence assessment and schema parity plan Jun 12, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 66ad328a-1574-45a9-9be8-8cf26723decd

📥 Commits

Reviewing files that changed from the base of the PR and between a2e9150 and 3c545d9.

📒 Files selected for processing (9)
  • docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md
  • docs/designs/oss-ee-convergence/diff_core.txt
  • docs/designs/oss-ee-convergence/diff_tracing.txt
  • docs/designs/oss-ee-convergence/dump_pg_schema.sh
  • docs/designs/oss-ee-convergence/ee_core.txt
  • docs/designs/oss-ee-convergence/ee_tracing.txt
  • docs/designs/oss-ee-convergence/oss_core.txt
  • docs/designs/oss-ee-convergence/oss_tracing.txt
  • docs/designs/oss-ee-convergence/pr-plan.md

Comment thread docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md
Comment on lines +259 to +262
Goal-B follow-through on the dumps above: after both steps, the OSS core schema is
**identical** to the EE core schema minus exactly four EE-only tables (`meters` +
`meters_type` enum, `subscriptions`, `organization_domains`,
`organization_providers`); the membership tables become shared (change 1); tracing

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix the parity-count wording here.

This says “exactly four EE-only tables,” but the parenthesized list includes meters_type, which is an enum, not a table. Rephrase as “four EE-only schema objects” or “three tables plus one enum.”

Comment thread docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md
Comment on lines +93 to +99
> TABLE public.organization_members COLUMN created_at timestamp with time zone
> TABLE public.organization_members COLUMN id uuid NOT NULL
> TABLE public.organization_members COLUMN organization_id uuid
> TABLE public.organization_members COLUMN role character varying NOT NULL DEFAULT 'viewer'::character varying
> TABLE public.organization_members COLUMN updated_at timestamp with time zone
> TABLE public.organization_members COLUMN updated_by_id uuid
> TABLE public.organization_members COLUMN user_id uuid

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Lock membership rows to one user/scope pair.

These tables only have surrogate id PKs; user_id and the scope FK remain nullable, and there is no uniqueness on (user_id, organization_id/workspace_id/project_id). That allows duplicate or orphan memberships, which makes the new access checks and membership queries ambiguous. Add NOT NULL plus a unique constraint (or composite PK) per membership table.

Also applies to: 116-123, 136-142

Comment on lines +810 to +813
TABLE public.projects CONSTRAINT fk_projects_organization_id FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE SET NULL
TABLE public.projects CONSTRAINT fk_projects_workspace_id FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE SET NULL
TABLE public.projects CONSTRAINT projects_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE
TABLE public.projects CONSTRAINT projects_pkey PRIMARY KEY (id)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove the conflicting projects.organization_id foreign key.

The snapshot shows both fk_projects_organization_id ... ON DELETE SET NULL and projects_organization_id_fkey ... ON DELETE CASCADE on the same column. Those actions conflict, so the dump no longer describes a single, unambiguous delete rule for projects.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: da0c7d2c-a16d-4b70-8519-bbfd3d16660d

📥 Commits

Reviewing files that changed from the base of the PR and between 3c545d9 and b58fc10.

📒 Files selected for processing (9)
  • docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md
  • docs/designs/oss-ee-convergence/diff_core.txt
  • docs/designs/oss-ee-convergence/diff_tracing.txt
  • docs/designs/oss-ee-convergence/dump_pg_schema.sh
  • docs/designs/oss-ee-convergence/ee_core.txt
  • docs/designs/oss-ee-convergence/ee_tracing.txt
  • docs/designs/oss-ee-convergence/oss_core.txt
  • docs/designs/oss-ee-convergence/oss_tracing.txt
  • docs/designs/oss-ee-convergence/pr-plan.md
✅ Files skipped from review due to trivial changes (5)
  • docs/designs/oss-ee-convergence/diff_tracing.txt
  • docs/designs/oss-ee-convergence/oss_tracing.txt
  • docs/designs/oss-ee-convergence/ee_tracing.txt
  • docs/designs/oss-ee-convergence/oss_core.txt
  • docs/designs/oss-ee-convergence/pr-plan.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/designs/oss-ee-convergence/dump_pg_schema.sh
  • docs/designs/oss-ee-convergence/diff_core.txt

Comment thread docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md (1)

72-75: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Clarify the backfill mapping before freezing the plan.

Both spots still rely on an underspecified “backfill or delete” / “member of the oss-default org/workspace/project” rule. That can collapse scope and assign the wrong org/workspace membership when more than one candidate exists. Please pin a deterministic source-of-truth for each row before the migration sequence is finalized.

Also applies to: 275-301


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d5632826-1536-4737-9bc4-99d020b71878

📥 Commits

Reviewing files that changed from the base of the PR and between b58fc10 and 5b43a1c.

📒 Files selected for processing (9)
  • docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md
  • docs/designs/oss-ee-convergence/diff_core.txt
  • docs/designs/oss-ee-convergence/diff_tracing.txt
  • docs/designs/oss-ee-convergence/dump_pg_schema.sh
  • docs/designs/oss-ee-convergence/ee_core.txt
  • docs/designs/oss-ee-convergence/ee_tracing.txt
  • docs/designs/oss-ee-convergence/oss_core.txt
  • docs/designs/oss-ee-convergence/oss_tracing.txt
  • docs/designs/oss-ee-convergence/pr-plan.md
✅ Files skipped from review due to trivial changes (4)
  • docs/designs/oss-ee-convergence/diff_tracing.txt
  • docs/designs/oss-ee-convergence/oss_core.txt
  • docs/designs/oss-ee-convergence/ee_tracing.txt
  • docs/designs/oss-ee-convergence/pr-plan.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/designs/oss-ee-convergence/oss_tracing.txt
  • docs/designs/oss-ee-convergence/dump_pg_schema.sh
  • docs/designs/oss-ee-convergence/diff_core.txt

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 28ddac35-a9f7-488d-aa9d-4fd7c7e0c956

📥 Commits

Reviewing files that changed from the base of the PR and between 5b43a1c and 6fafd77.

📒 Files selected for processing (9)
  • docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md
  • docs/designs/oss-ee-convergence/diff_core.txt
  • docs/designs/oss-ee-convergence/diff_tracing.txt
  • docs/designs/oss-ee-convergence/dump_pg_schema.sh
  • docs/designs/oss-ee-convergence/ee_core.txt
  • docs/designs/oss-ee-convergence/ee_tracing.txt
  • docs/designs/oss-ee-convergence/oss_core.txt
  • docs/designs/oss-ee-convergence/oss_tracing.txt
  • docs/designs/oss-ee-convergence/pr-plan.md
✅ Files skipped from review due to trivial changes (4)
  • docs/designs/oss-ee-convergence/diff_tracing.txt
  • docs/designs/oss-ee-convergence/oss_core.txt
  • docs/designs/oss-ee-convergence/oss_tracing.txt
  • docs/designs/oss-ee-convergence/pr-plan.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/designs/oss-ee-convergence/ee_tracing.txt
  • docs/designs/oss-ee-convergence/dump_pg_schema.sh

Comment on lines +87 to +97
- `db_manager.create_organization()`: drop the `not is_ee()` ON CONFLICT branch;
generate unique slugs (keep `oss-default` as the legacy slug of the bootstrap org,
no special meaning afterwards).
- Move the org-creation orchestration (`create_organization_for_user`,
`can_create_organization` from `api/ee/src/services/commoners.py`) into OSS shared
code; EE wraps it to add subscription/trial setup. This follows the established
pattern: EE is additive over OSS.
- Mount the create endpoint in the OSS organization router (mirror
`api/ee/src/routers/organization_router.py:380`, minus billing).
- Lift the admin-API block (`accounts/service.py:1058`) to accept explicit
org/workspace/project/memberships like EE does.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Specify the slug-collision rule for new orgs.

generate unique slugs is too vague for the new create-org path. Please state how the slug is derived, how duplicates are retried, and whether the existing EE helper is reused verbatim; otherwise concurrent org creates can still fail on duplicate slugs.

🧰 Tools
🪛 LanguageTool

[locale-violation] ~89-~89: In American English, ‘afterward’ is the preferred variant. ‘Afterwards’ is more commonly used in British English and other dialects.
Context: ...the bootstrap org, no special meaning afterwards). - Move the org-creation orchestration...

(AFTERWARDS_US)

Comment thread docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md
Comment thread docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md
Comment thread docs/designs/oss-ee-convergence/diff_core.txt Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (3)
docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md (3)

87-89: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Define a slug-collision retry rule before removing the singleton branch.

On Lines 87-89, “generate unique slugs” is still too vague for concurrent org creation. Please spell out the slug derivation and retry behavior so two creates can’t race into a duplicate-key failure.


297-301: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Spell out the EE backfill tie-breaker, not just “resolve via the project's members.”

On Lines 297-301, this still does not define how to choose a single org/workspace when multiple members qualify (or none do). Lock the exact selection rule before the NOT NULL/CASCADE migration, or the backfill can assign rows to the wrong tenant.


378-382: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use the canonical allowlist name in the upgrade warning.

On Lines 378-382, ALLOWED_OWNER_EMAILS is still ambiguous; operators need the full AGENTA_ACCESS_ALLOWED_OWNER_EMAILS name (or an explicit legacy-alias list) to avoid misconfiguring the closed-signup path.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: be1f1353-9972-4ab7-8a58-380035216cb9

📥 Commits

Reviewing files that changed from the base of the PR and between 6fafd77 and 4791d6d.

📒 Files selected for processing (9)
  • docs/designs/oss-ee-convergence/assessment-a-oss-multi-org.md
  • docs/designs/oss-ee-convergence/diff_core.txt
  • docs/designs/oss-ee-convergence/diff_tracing.txt
  • docs/designs/oss-ee-convergence/dump_pg_schema.sh
  • docs/designs/oss-ee-convergence/ee_core.txt
  • docs/designs/oss-ee-convergence/ee_tracing.txt
  • docs/designs/oss-ee-convergence/oss_core.txt
  • docs/designs/oss-ee-convergence/oss_tracing.txt
  • docs/designs/oss-ee-convergence/pr-plan.md
✅ Files skipped from review due to trivial changes (5)
  • docs/designs/oss-ee-convergence/diff_tracing.txt
  • docs/designs/oss-ee-convergence/ee_tracing.txt
  • docs/designs/oss-ee-convergence/oss_tracing.txt
  • docs/designs/oss-ee-convergence/pr-plan.md
  • docs/designs/oss-ee-convergence/oss_core.txt
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/designs/oss-ee-convergence/dump_pg_schema.sh
  • docs/designs/oss-ee-convergence/diff_core.txt

… parity

Assessment for making OSS multi-organization with AGENTA_ACCESS_* enforcement,
plus the two-step schema parity plan (drift fixes on kept tables, legacy table
drop). Includes live schema dumps of both editions' core/tracing DBs, their
diffs, the dump script, and the PR execution plan.
…ble chain ids

Record the v0.103.5 propagation (b3c4d5e6f7a9 re-point, App-class collision in
_admin_detach_user_references, db_manager_ee import/symbol churn) and the
12-char park/oss/ee revision-id rename. Update checkpoint ids and the chain
layout diagram. Flag the committed schema dumps as stale (predate the
workflow_revisions repair).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Same scheme as core (no t-prefix); tracing has its own database so the version
tables (alembic_version_tracing_oss/_ee) and ids do not collide. tracing_ee is
root+proof only (no EE-only tracing tables to adopt on a switch). Update the
layout note and runner order.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e core

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dump_pg_schema.sh used ${vt^^} (bash 4+ uppercase expansion) which fails on
macOS system bash 3.2 with 'bad substitution'; replace with a portable tr.
Delete the committed schema dumps and diffs (oss/ee core+tracing, diff_*) —
they predate the v0.103.5 workflow_revisions repair and are regenerated from
replays, so the stale copies are misleading.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant