refactor: strip organizations, billing, and Terraform cloud features#73
refactor: strip organizations, billing, and Terraform cloud features#73vieiralucas merged 2 commits intomainfrom
Conversation
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
There was a problem hiding this comment.
2 issues found across 82 files
Confidence score: 3/5
- Potential migration failure risk:
ALTER TABLE ... DROP COLUMNincrates/zopp-store-sqlite/migrations/20260302000001_drop_cloud_features.sqllacksIF EXISTS, so a missing column could permanently block upgrades. - SQLite migration order drops
organizationsbefore removing theworkspaces.organization_idFK 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; |
There was a problem hiding this comment.
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>
| @@ -0,0 +1,27 @@ | |||
| -- Drop cloud features: organizations, billing, and related infrastructure | |||
There was a problem hiding this comment.
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>
Fixes integer overflow vulnerability in BytesMut::reserve that could cause out-of-bounds memory access in release builds.
Summary
What's removed
zopp.protoorganizations.rs,billing.rs,mod.rs,backend.rsorganization.rs,cli.rs,main.rs,mod.rsstore.rs,lib.rs(storage, sqlite, postgres, noop)organizations.rs,ids.rs,roles.rs,mod.rszopp-billing/(entire crate)infra/terraform/(entire directory)Migration strategy
20260302000001_drop_cloud_features.sqladded for both backends to reverse the schema changesTest plan
cargo fmt --all— cleancargo 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 PostgreSQLSummary 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
Migration
Written for commit aa45bfc. Summary will update on new commits.