refactor: remove the billing tier model (P0.1)
The community edition has no monetization (ADR-0001). Remove the tier model (packages/shared/src/tiers.ts), the requireTier middleware and every tier gate, GET/PATCH /api/tier and the trial start, and the Stripe integration, which depends on the tier model. Personal features a tier used to limit are open to everyone: unlimited workspaces and connectors, every embedding provider including LiteLLM, per-workspace costs, Approvals. The workspace session cap is one constant (100). Team and enterprise surfaces are hidden instead of unlocked (team dock zone, Settings Team/Enterprise/Plan tabs, workspace Team tab); cloud sync reports unavailable, as it did for free users. The sidecar ignores the tier keys in config.json but does not delete them: both editions may still share ~/.waggle. Web billing UI is deleted: plan cards, upgrade and trial modals, payment success route, the KVARK sales block, tier 403 handling.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Embedding routing API tests (steal #10) —
|
||||
* GET /api/embedding/status (enriched: configuredProvider + envOverride)
|
||||
* POST /api/embedding/provider (validate → tier-gate → persist → restartRequired)
|
||||
* POST /api/embedding/provider (validate → persist → restartRequired)
|
||||
*
|
||||
* Note: vitest.setup.ts pins EMBEDDING_PROVIDER='mock' for the whole suite, so the
|
||||
* env-override branch would otherwise 409 every write. We clear it per-test to
|
||||
@@ -28,7 +28,6 @@ describe('Embedding routing API', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-embrouting-test-'));
|
||||
// No `tier` field → effective tier resolves to FREE (litellm gated off).
|
||||
fs.writeFileSync(path.join(tmpDir, 'config.json'), JSON.stringify({}));
|
||||
fs.mkdirSync(path.join(tmpDir, 'skills'), { recursive: true });
|
||||
fs.writeFileSync(path.join(tmpDir, 'skills', '.starter-installed'), 'test');
|
||||
@@ -86,19 +85,16 @@ describe('Embedding routing API', () => {
|
||||
expect(res.statusCode).toBe(400);
|
||||
});
|
||||
|
||||
it('POST /api/embedding/provider tier-gates litellm on FREE with 403', async () => {
|
||||
it('POST /api/embedding/provider accepts litellm (every provider is selectable)', async () => {
|
||||
const res = await injectWithAuth(server, {
|
||||
method: 'POST',
|
||||
url: '/api/embedding/provider',
|
||||
payload: { provider: 'litellm' },
|
||||
});
|
||||
expect(res.statusCode).toBe(403);
|
||||
expect(res.statusCode).toBe(200);
|
||||
const body = JSON.parse(res.body);
|
||||
expect(body.error).toBe('TIER_REQUIRED');
|
||||
expect(body.requiredTier).toBeDefined();
|
||||
expect(body.currentTier).toBe('FREE');
|
||||
// Rejected write must not have persisted.
|
||||
expect(readConfig().embedding).toBeUndefined();
|
||||
expect(body.configuredProvider).toBe('litellm');
|
||||
expect((readConfig().embedding as { provider?: string }).provider).toBe('litellm');
|
||||
});
|
||||
|
||||
it('POST /api/embedding/provider persists "auto" (no restart required)', async () => {
|
||||
@@ -114,11 +110,11 @@ describe('Embedding routing API', () => {
|
||||
expect((readConfig().embedding as { provider?: string }).provider).toBe('auto');
|
||||
});
|
||||
|
||||
it('POST /api/embedding/provider persists a tier-allowed provider with restartRequired', async () => {
|
||||
it('POST /api/embedding/provider persists an explicit provider with restartRequired', async () => {
|
||||
const res = await injectWithAuth(server, {
|
||||
method: 'POST',
|
||||
url: '/api/embedding/provider',
|
||||
payload: { provider: 'inprocess' }, // FREE allows inprocess
|
||||
payload: { provider: 'inprocess' },
|
||||
});
|
||||
expect(res.statusCode).toBe(200);
|
||||
const body = JSON.parse(res.body);
|
||||
|
||||
Reference in New Issue
Block a user