Files
waggle-os/apps/web/src/test/build-warning-hygiene.test.ts
shumeiko.it fe2eb0f648 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.
2026-10-15 19:31:50 +02:00

68 lines
2.7 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
const sourceRoot = join(process.cwd(), 'src');
describe('build warning hygiene', () => {
it('does not dynamically import shape-selection from the adapter', () => {
const adapterSource = readFileSync(join(sourceRoot, 'lib', 'adapter.ts'), 'utf8');
expect(adapterSource).not.toContain("import('./shape-selection')");
expect(adapterSource).toContain("from './shape-selection'");
});
it('keeps routed app surfaces out of the root app bundle', () => {
const appSource = readFileSync(join(sourceRoot, 'App.tsx'), 'utf8');
expect(appSource).not.toContain('from "@/routes"');
for (const route of ['HomeRoute', 'LauncherRoute', 'SettingsRoute']) {
expect(appSource).toContain(`lazy(() => import("@/routes/${route}"))`);
}
});
it('keeps closed shell overlays out of the root shell bundle', () => {
const shellSource = readFileSync(join(sourceRoot, 'components', 'os', 'AppShell.tsx'), 'utf8');
expect(shellSource).not.toContain("import ChatHost from './ChatHost'");
expect(shellSource).toContain("lazy(() => import('./ChatHost'))");
for (const overlay of [
'CommandCenter',
'CreateWorkspaceDialog',
'PersonaSwitcher',
'SpawnAgentDialog',
'WorkspaceSwitcher',
'NotificationInbox',
'KeyboardShortcutsHelp',
'OnboardingWizard',
'OnboardingTooltips',
'LoginBriefing',
'ContextRail',
]) {
expect(shellSource).not.toContain(`import ${overlay} from './overlays/${overlay}'`);
expect(shellSource).toContain(`lazy(() => import('./overlays/${overlay}'))`);
}
});
it('arms the desktop gate before loading the app graph and keeps analytics lazy', () => {
const mainSource = readFileSync(join(sourceRoot, 'main.tsx'), 'utf8');
const appEntrySource = readFileSync(join(sourceRoot, 'app-entry.tsx'), 'utf8');
const armIndex = mainSource.indexOf('armBootConnection()');
const appImportIndex = mainSource.indexOf("import('./app-entry')");
expect(armIndex).toBeGreaterThanOrEqual(0);
expect(appImportIndex).toBeGreaterThan(armIndex);
expect(mainSource).toMatch(
/^import\s+\{\s*armBootConnection\s*\}\s+from\s+['"]\.\/boot-connect['"];\s*/,
);
expect(mainSource).not.toMatch(/from ['"].*App(?:\.tsx)?['"]/);
expect(mainSource).not.toMatch(/from ['"]\.\/app-entry['"]/);
expect(mainSource).not.toMatch(/posthog/i);
expect(mainSource).not.toMatch(/\bawait\b/);
expect(appEntrySource).not.toMatch(/^\s*import(?!\s*\()[^;\n]*['"]@\/lib\/posthog['"]/m);
expect(appEntrySource).toMatch(/import\(\s*['"]@\/lib\/posthog['"]\s*\)/);
});
});