Skip to content

refactor: strip organizations, billing, and Terraform cloud features#73

Merged
vieiralucas merged 2 commits intomainfrom
refactor/strip-cloud-features
Mar 2, 2026
Merged

refactor: strip organizations, billing, and Terraform cloud features#73
vieiralucas merged 2 commits intomainfrom
refactor/strip-cloud-features

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Mar 2, 2026

Summary

  • Remove all organization, billing (Stripe), and Terraform AWS infrastructure code added in PRs Add email verification for user registration #49-Add cloud vs self-hosted landing page #63
  • Refocus the project as an OSS self-hostable secrets manager without SaaS cloud features
  • Add drop migrations for both SQLite and PostgreSQL to clean up existing databases
  • Preserve useful self-hosted infrastructure: email verification, Prometheus metrics, Helm charts, Amber Terminal web UI

What's removed

Layer Files Lines
Proto (gRPC RPCs + messages) zopp.proto ~265
Server handlers organizations.rs, billing.rs, mod.rs, backend.rs ~2,160
CLI commands organization.rs, cli.rs, main.rs, mod.rs ~700
Store trait + impls store.rs, lib.rs (storage, sqlite, postgres, noop) ~1,630
Types organizations.rs, ids.rs, roles.rs, mod.rs ~240
Billing crate zopp-billing/ (entire crate) ~1,015
Terraform infra infra/terraform/ (entire directory) ~1,090
Stale .sqlx metadata 43 query JSON files ~1,800
Total 82 files ~8,900

Migration strategy

  • Original org/billing "up" migrations are kept (required by sqlx migration tracking on existing DBs)
  • New 20260302000001_drop_cloud_features.sql added for both backends to reverse the schema changes
  • Fresh databases: tables are created then immediately dropped during migration
  • Existing databases: tables are dropped cleanly

Test plan

  • cargo fmt --all — clean
  • cargo clippy — 0 errors (pre-existing warnings only in zopp-web)
  • cargo test — 178 tests pass across zopp-storage, zopp-store-sqlite, zopp-proto, zopp-server
  • .sqlx/ metadata regenerated for both SQLite and PostgreSQL
  • Fresh SQLite migration verified — no org/billing tables remain
  • Fresh PostgreSQL migration verified — no org/billing tables remain
  • CI pipeline (clippy, tests, fmt, e2e)

Summary by cubic

Remove all organization, billing (Stripe), and Terraform AWS code to refocus the project on a self-hosted OSS secrets manager. Add drop migrations for SQLite and Postgres; keep email verification, Prometheus metrics, Helm charts, and the Amber Terminal web UI.

  • Refactors

    • Removed organization/billing across proto RPCs/messages, server handlers, store trait/impls, and CLI org commands.
    • Deleted zopp-billing crate and Stripe dependencies; cleaned up stale .sqlx metadata.
    • Removed Terraform infra (infra/terraform/); retained self-hosted components.
    • Dropped organization-related types (e.g., OrganizationRole, OrganizationId).
    • Updated bytes to 1.11.1 to address RUSTSEC-2026-0007.
  • Migration

    • Added 20260302000001_drop_cloud_features.sql for SQLite and Postgres to drop org/billing tables and the workspace organization_id column.
    • Kept prior “up” migrations for sqlx tracking; existing DBs drop cleanly, fresh DBs create then immediately drop these tables during migration.

Written for commit aa45bfc. Summary will update on new commits.

Remove all SaaS/cloud features that were added in PRs #49-#63 to refocus
the project as an OSS self-hostable secrets manager. Preserves useful
self-hosted infrastructure (email verification, Prometheus metrics, Helm
charts, Amber Terminal web UI).

Removed:
- Organization and billing gRPC RPCs, messages, and proto definitions
- Organization/billing server handlers and backend delegation
- CLI `org` subcommand and organization command module
- Store trait organization methods + SQLite/PostgreSQL/NoopStore implementations
- Organization types (OrganizationId, OrganizationRole, Plan, SubscriptionStatus, etc.)
- zopp-billing crate (Stripe integration)
- Terraform AWS infrastructure (infra/terraform/)
- Drop migrations added for both backends to clean up existing databases
- Stale .sqlx query metadata for removed org/billing queries regenerated
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 82 files

Confidence score: 3/5

  • Potential migration failure risk: ALTER TABLE ... DROP COLUMN in crates/zopp-store-sqlite/migrations/20260302000001_drop_cloud_features.sql lacks IF EXISTS, so a missing column could permanently block upgrades.
  • SQLite migration order drops organizations before removing the workspaces.organization_id FK column, which can break the migration compared to the PostgreSQL order.
  • These are medium-severity migration issues that could impact users on upgrade, so there’s some risk despite being isolated to schema changes.
  • Pay close attention to crates/zopp-store-sqlite/migrations/20260302000001_drop_cloud_features.sql - migration ordering and defensive checks for missing columns.

Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="crates/zopp-store-sqlite/migrations/20260302000001_drop_cloud_features.sql">

<violation number="1" location="crates/zopp-store-sqlite/migrations/20260302000001_drop_cloud_features.sql:24">
P2: The `organizations` parent table is dropped before removing the `workspaces.organization_id` FK column that references it. The PostgreSQL migration correctly drops the column first, then the parent table. Reorder to match: drop child tables → drop `organization_id` column from `workspaces` → drop `organizations`.</violation>

<violation number="2" location="crates/zopp-store-sqlite/migrations/20260302000001_drop_cloud_features.sql:27">
P2: `ALTER TABLE ... DROP COLUMN` in SQLite has no `IF EXISTS` support, unlike every other statement in this migration. If the column is missing for any reason, the migration fails permanently. Consider a defensive check using `pragma_table_info` or at minimum document this as a known non-idempotent step.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

DROP TABLE IF EXISTS organizations;

-- Drop organization_id column from workspaces (supported in SQLite 3.35.0+)
ALTER TABLE workspaces DROP COLUMN organization_id;
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Mar 2, 2026

Choose a reason for hiding this comment

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

P2: ALTER TABLE ... DROP COLUMN in SQLite has no IF EXISTS support, unlike every other statement in this migration. If the column is missing for any reason, the migration fails permanently. Consider a defensive check using pragma_table_info or at minimum document this as a known non-idempotent step.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/zopp-store-sqlite/migrations/20260302000001_drop_cloud_features.sql, line 27:

<comment>`ALTER TABLE ... DROP COLUMN` in SQLite has no `IF EXISTS` support, unlike every other statement in this migration. If the column is missing for any reason, the migration fails permanently. Consider a defensive check using `pragma_table_info` or at minimum document this as a known non-idempotent step.</comment>

<file context>
@@ -0,0 +1,27 @@
+DROP TABLE IF EXISTS organizations;
+
+-- Drop organization_id column from workspaces (supported in SQLite 3.35.0+)
+ALTER TABLE workspaces DROP COLUMN organization_id;
</file context>
Fix with Cubic

@@ -0,0 +1,27 @@
-- Drop cloud features: organizations, billing, and related infrastructure
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Mar 2, 2026

Choose a reason for hiding this comment

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

P2: The organizations parent table is dropped before removing the workspaces.organization_id FK column that references it. The PostgreSQL migration correctly drops the column first, then the parent table. Reorder to match: drop child tables → drop organization_id column from workspaces → drop organizations.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/zopp-store-sqlite/migrations/20260302000001_drop_cloud_features.sql, line 24:

<comment>The `organizations` parent table is dropped before removing the `workspaces.organization_id` FK column that references it. The PostgreSQL migration correctly drops the column first, then the parent table. Reorder to match: drop child tables → drop `organization_id` column from `workspaces` → drop `organizations`.</comment>

<file context>
@@ -0,0 +1,27 @@
+DROP TABLE IF EXISTS organization_settings;
+DROP TABLE IF EXISTS organization_invites;
+DROP TABLE IF EXISTS organization_members;
+DROP TABLE IF EXISTS organizations;
+
+-- Drop organization_id column from workspaces (supported in SQLite 3.35.0+)
</file context>
Fix with Cubic

Fixes integer overflow vulnerability in BytesMut::reserve that could
cause out-of-bounds memory access in release builds.
@vieiralucas vieiralucas merged commit c21b978 into main Mar 2, 2026
19 checks passed
@vieiralucas vieiralucas deleted the refactor/strip-cloud-features branch March 2, 2026 15:14
vieiralucas added a commit that referenced this pull request Mar 3, 2026
Leftover from the SaaS cloud offering (#51) that was stripped in #73.
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