Skip to content

Commit 57eddbc

Browse files
committed
feat: remove demo
1 parent e10c0a4 commit 57eddbc

70 files changed

Lines changed: 11219 additions & 2228 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/restart-plan/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ A criterion is **not met** until the verification command or check passes in CI.
6262
- [ ] **Spatial polish (Phase 6):** ≥ 80% of `docs/SPATIAL_PARITY_CHECKLIST.md` rows marked done.
6363
- [ ] **Schema completeness:** Phase 3 Yjs schema includes every field from the Phase 1 diff table.
6464
- [x] **Backlinks:** SPA displays incoming page backlinks.
65-
- [x] **Playwright:** E2E smoke test covers demo login → home → page → groups → logout.
65+
- [x] **Playwright:** E2E smoke test covers login → home → page → groups → logout.
6666
- [x] **Package split:** `@deepnotes/session` split into `@deepnotes/session-core`, `@deepnotes/groups`, `@deepnotes/pages`, `@deepnotes/billing`, `@deepnotes/realtime`. Session package now has 8 files (down from 57).
6767
- [x] **Marketing site:** `apps/marketing` has routable pages for `/`, `/pricing`, `/whitepaper`, `/help`, `/privacy-policy`, `/terms-of-service`. Build outputs 20 static HTML files (including 14 help article sub-routes). `pnpm lint`, `pnpm typecheck`, `pnpm build` pass with 0 errors. Dark/light theme toggle, restored legacy assets (logo, whitepaper diagrams, use-case thumbnails), and Shadcn `Switch`/`Input` components integrated.
6868
- [ ] **Staging:** Hyperdrive + Postgres + Redis + WS proven in staging. Load test: 50 concurrent pages, p95 latency < 200 ms, row rate ≤ 20/page.

docs/restart-plan/appendix-auth-migration-evaluation.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
- Authenticator secret and recovery codes encrypted with env keys.
2929
- `devices.trusted = true` set on login when `rememberDevice` is passed and token is valid.
3030
- Failed-login rate-limiting (Redis counters, 4-attempt threshold, 15-min TTL) incremented on bad TOTP or bad recovery code.
31-
- Demo-account rejection (`demo === true``403 FORBIDDEN`).
3231

3332
### What improved
3433

@@ -110,7 +109,6 @@ Single HTTP call (`POST /api/users/me/password`):
110109
| Password change invalidates all sessions ||
111110
| Password change rejects wrong old password ||
112111
| Password change rejects demo user ||
113-
| 2FA enable/finish persists flags ||
114112
| 2FA login succeeds with valid TOTP ||
115113
| 2FA login rejects missing TOTP ||
116114
| 2FA login rejects invalid TOTP ||

docs/restart-plan/phase-7-account-polish.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ All non-editor UX is polished and tested.
5050
- `@deepnotes/billing` — Stripe checkout, portal, webhook processing (`stripe-billing.ts`, `stripe-billing.test.ts`).
5151
- `@deepnotes/collab` — Page collab updates, collab crypto context, snapshots (`page-collab-updates.ts`, `group-collab-crypto-context.ts`).
5252
- `@deepnotes/realtime` — Hash ACL, notify-users (`realtime-hash-acl.ts`, `notify-users.ts`).
53-
- Keep `@deepnotes/session` for auth, login, refresh, register, 2FA, logout, demo, tokens only.
53+
- Keep `@deepnotes/session` for auth, login, refresh, register, 2FA, logout, tokens only.
5454
- Add ESLint rule: `apps/api-worker` route files may import from ≤ 2 domain packages each.
5555
- Exit criteria: no extracted package exceeds 25 files; `@deepnotes/session` ≤ 20 files.
5656

@@ -80,8 +80,8 @@ A full evaluation of TOTP, password change, and email change migration is in [ap
8080

8181
## Verification
8282

83-
- E2E smoke test: demo login → home → starting page → groups → logout.
84-
- `apps/web/e2e/smoke.spec.ts` covers demo login, home page, page editor load, groups list, and logout.
83+
- E2E smoke test: login → home → starting page → groups → logout.
84+
- `apps/web/e2e/smoke.spec.ts` covers login, home page, page editor load, groups list, and logout.
8585
- Full flow (register → create group → create page → invite member → member joins → both edit page → logout) requires group/page creation UI which is not yet implemented in the SPA.
8686
- Playwright config updated to start both `api-worker` and `web` dev servers.
8787
- Integration test: `scheduled-cleanup.integration.test.ts` verifies soft-deleted pages and groups are purged.
@@ -91,7 +91,7 @@ A full evaluation of TOTP, password change, and email change migration is in [ap
9191
## Exit criteria
9292

9393
- [x] Scheduler implemented with Cron Trigger and integration test.
94-
- [x] E2E smoke test covers demo login → home → page → groups → logout (full register → create group → invite → edit flow requires group/page creation UI, which is not in Phase 7 scope).
94+
- [x] E2E smoke test covers login → home → page → groups → logout (full register → create group → invite → edit flow requires group/page creation UI, which is not in Phase 7 scope).
9595
- [x] `TRPC_REST_MAP.md` route audit: every endpoint marked "implemented" has a registered Hono route in `apps/api-worker`.
9696
- [x] Group password management UI (enable/change/disable) exists in `GroupDetailView.vue`.
9797
- [ ] Realtime notification toast or badge surfaces in the app shell (not just the `/notifications` page).
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
import base from "../../eslint.config.js";
22

3-
export default [...base];
3+
export default [
4+
{
5+
ignores: ["dist/**"],
6+
},
7+
...base,
8+
];

new-deepnotes/apps/api-worker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"build": "wrangler build",
88
"dev": "wrangler dev",
9-
"lint": "eslint .",
9+
"lint": "eslint src",
1010
"typecheck": "tsc -p tsconfig.json --noEmit",
1111
"test": "vitest run"
1212
},

new-deepnotes/apps/api-worker/src/index.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ describe("api-worker", () => {
2626
["POST", "/api/sessions/login"],
2727
["POST", "/api/sessions/refresh"],
2828
["POST", "/api/sessions/logout"],
29-
["POST", "/api/sessions/demo"],
3029
["GET", "/api/users/me/groups"],
3130
["GET", "/api/users/me/pages/starting"],
3231
[

new-deepnotes/apps/api-worker/src/routes/pages.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ app.get("/api/pages/:pageId/collab-ws", async (c) => {
344344
const db = getDbForConnectionString(hyper.connectionString);
345345
const cookieHeader = c.req.header("Cookie");
346346

347-
let summary: { userId: string; demo: boolean };
347+
let summary: { userId: string };
348348
try {
349349
const { getAuthenticatedUserSummary, assertPageCollabWsConnectionAllowed } =
350350
await import("@deepnotes/session");
@@ -353,15 +353,6 @@ app.get("/api/pages/:pageId/collab-ws", async (c) => {
353353
env: sessionEnv,
354354
accessCookie: readCookieHeader(cookieHeader, "accessToken"),
355355
});
356-
if (summary.demo) {
357-
return c.json(
358-
{
359-
code: "FORBIDDEN",
360-
message: "Demo sessions cannot use live collab WebSocket.",
361-
},
362-
403,
363-
);
364-
}
365356
await assertPageCollabWsConnectionAllowed({
366357
db,
367358
userId: summary.userId,

new-deepnotes/apps/api-worker/src/routes/realtime.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,14 @@ app.get("/api/realtime-ws", async (c) => {
4242
const db = getDbForConnectionString(hyper.connectionString);
4343
const cookieHeader = c.req.header("Cookie");
4444

45-
let summary: { userId: string; demo: boolean };
45+
let summary: { userId: string };
4646
try {
4747
const { getAuthenticatedUserSummary } = await import("@deepnotes/session");
4848
summary = await getAuthenticatedUserSummary({
4949
db,
5050
env: sessionEnv,
5151
accessCookie: readCookieHeader(cookieHeader, "accessToken"),
5252
});
53-
if (summary.demo) {
54-
return c.json(
55-
{
56-
code: "FORBIDDEN",
57-
message: "Demo sessions cannot use realtime WebSocket.",
58-
},
59-
403,
60-
);
61-
}
6253
} catch (e) {
6354
const { SessionError } = await import("@deepnotes/session");
6455
if (e instanceof SessionError) {

new-deepnotes/apps/api-worker/src/routes/sessions.ts

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ContentfulStatusCode } from "hono/utils/http-status";
2-
import { sessionDemoRequestSchema, sessionLoginRequestSchema } from "@deepnotes/api";
2+
import { sessionLoginRequestSchema } from "@deepnotes/api";
33

44
import type { ApiHono } from "../api-hono.js";
55
import { readCookieHeader } from "../cookies.js";
@@ -163,63 +163,4 @@ app.post("/api/sessions/logout", async (c) => {
163163
return res;
164164
});
165165

166-
app.post("/api/sessions/demo", async (c) => {
167-
const sessionEnv = getSessionEnv(c.env);
168-
if (sessionEnv == null) {
169-
return c.json(serviceUnavailableBody, 503);
170-
}
171-
const hyper = c.env.HYPERDRIVE;
172-
if (hyper == null) {
173-
return c.json(
174-
{
175-
code: "SERVICE_UNAVAILABLE" as const,
176-
message: "HYPERDRIVE binding is not configured.",
177-
},
178-
503,
179-
);
180-
}
181-
182-
let bodyJson: unknown;
183-
try {
184-
bodyJson = await c.req.json();
185-
} catch {
186-
return c.json({ code: "BAD_REQUEST", message: "Expected JSON body." }, 400);
187-
}
188-
189-
const parsed = sessionDemoRequestSchema.safeParse(bodyJson);
190-
if (!parsed.success) {
191-
return c.json(
192-
{
193-
code: "VALIDATION_ERROR",
194-
message: parsed.error.flatten().formErrors.join("; "),
195-
},
196-
400,
197-
);
198-
}
199-
200-
const db = getDbForConnectionString(hyper.connectionString);
201-
202-
try {
203-
const { performSessionStartDemo } = await import("@deepnotes/session");
204-
const { json, cookieLines } = await performSessionStartDemo({
205-
db,
206-
env: sessionEnv,
207-
body: parsed.data,
208-
clientIp: c.req.header("CF-Connecting-IP") ?? "127.0.0.1",
209-
userAgent: c.req.header("User-Agent") ?? "",
210-
});
211-
const res = c.json(json, 200);
212-
appendSetCookies(res, cookieLines);
213-
return res;
214-
} catch (e) {
215-
const { SessionError } = await import("@deepnotes/session");
216-
if (e instanceof SessionError) {
217-
return c.json(
218-
{ code: e.code, message: e.message },
219-
e.status as ContentfulStatusCode,
220-
);
221-
}
222-
throw e;
223-
}
224-
});
225166
}

0 commit comments

Comments
 (0)