Skip to content

Commit 95c9fa4

Browse files
authored
remove datasets and products modules, reset migrations (#96)
* remove datasets and products modules, reset migration history The datasets and products example modules are removed from the workspace along with all wiring (host pyproject, root pyproject, CLI catalog) and the integration/e2e tests that exercised them as their CRUD subject. Dashboard's product-count tile and the workspace dep on simple_module_products are also dropped. To avoid leaving frozen migrations referencing deleted modules, every file under host/migrations/versions/ is replaced by a single autogenerated 77162e7b184b_initial_schema.py. The fresh schema contains tables for the remaining 8 modules (auth/users/permissions/dashboard/settings/feature_flags/ file_storage/background_tasks) and `alembic check` reports no drift. Verified: 943 Python tests pass, 8 JS tests pass, make lint clean, doctor exits 0, host boots and /health reports the new revision as current. * exempt host/migrations/versions from 300-line file cap Alembic autogen rolls every installed module's tables into a single initial migration. The current 77162e7b184b lands at 382 lines and growing the schema will only push it higher. Migrations aren't hand-authored, so the cap doesn't add value here.
1 parent 6bc4dff commit 95c9fa4

116 files changed

Lines changed: 459 additions & 7236 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.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ make migrate
4444
make dev
4545
```
4646

47-
Hit `http://localhost:8000` — you land on the public page. `/users/login` is the email+password login, `/dashboard` is the authenticated home, `/products` is a fully-working example module.
47+
Hit `http://localhost:8000` — you land on the public page. `/users/login` is the email+password login, `/dashboard` is the authenticated home.
4848

4949
## Create a new module
5050

@@ -73,7 +73,7 @@ framework/
7373
core/ # module system, discovery, events, diagnostics
7474
db/ # per-module Base, session, mixins, listeners
7575
hosting/ # app_builder, middleware, settings, Inertia glue
76-
modules/ # plugin modules (auth, dashboard, products, ...)
76+
modules/ # plugin modules (auth, dashboard, users, settings, ...)
7777
host/
7878
main.py # FastAPI entry point
7979
routes.py # host-level routes (landing page)

docs/e2e-testing.md

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
# End-to-End Testing
22

3-
The repo ships Playwright-driven smoke tests at
4-
[tests/e2e/test_smoke.py](../tests/e2e/test_smoke.py). Four tests drive a real
5-
Chromium browser through the core flows:
6-
7-
* **`test_login_and_browse_smoke`** — landing → local email+password login →
8-
dashboard → products browse → logout. Minimal regression guard.
9-
* **`test_products_crud_smoke`** — same login + a full create / edit / delete
10-
round-trip against the products module.
11-
* **`test_password_reset_smoke`****skipped** (see inline comment in the
12-
test file). `fastapi-users` `reset_password()` validates a password
13-
fingerprint (`password_fgpt`) that is only available server-side. The
14-
full HTTP-layer flow is covered by unit tests in
15-
`modules/users/tests/test_api_auth.py`.
16-
* **`test_admin_invite_smoke`** — admin invites a new user via the UI; the
17-
invitee accepts the invite in a fresh browser context and lands on the
18-
dashboard. Token is minted locally using the dev-default verify secret
19-
(equivalent to what the ConsoleMailer logs).
3+
Playwright-driven smoke tests live in [tests/e2e/](../tests/e2e/) — currently
4+
just [`test_settings_ui.py`](../tests/e2e/test_settings_ui.py), which logs in,
5+
navigates to `/settings/modules`, toggles a module setting, and verifies the
6+
change hot-reloads into `app.state` without a server restart.
207

218
End-to-end tests are gated behind the `e2e` pytest marker (declared in
229
[pyproject.toml](../pyproject.toml)) and are **excluded from the default
@@ -62,7 +49,7 @@ uv run pytest -m e2e tests/e2e
6249

6350
## Configuration
6451

65-
The tests read these environment variables (all optional):
52+
When you write e2e tests, read these environment variables (all optional):
6653

6754
| Variable | Default | Notes |
6855
| -------------- | ------------------------- | ------------------------------------------------------------ |
@@ -71,38 +58,6 @@ The tests read these environment variables (all optional):
7158
| `E2E_PASSWORD` | `admin` | Password of the above admin user. |
7259
| `SM_USERS_VERIFICATION_TOKEN_SECRET` | `dev-verify-token-secret-change-me` | Must match the running server's value so locally-minted invite tokens are accepted. |
7360

74-
## What the smoke tests cover
75-
76-
**`test_login_and_browse_smoke`**
77-
78-
1. Landing page renders (`/`) with the "Get Started" CTA.
79-
2. Local email+password login via `/users/login`.
80-
3. Dashboard (`/dashboard/`) renders — proves session cookie + AuthMiddleware +
81-
Inertia resolver + AuthenticatedLayout.
82-
4. Products browse (`/products/`) renders — proves module pages resolve.
83-
5. Logout returns the user to the public landing page.
84-
85-
**`test_products_crud_smoke`**
86-
87-
1. Login as admin.
88-
2. Create a timestamped product via the Create form.
89-
3. Edit its name and verify the new name appears in the list.
90-
4. Delete it through the confirm dialog and verify the row disappears.
91-
92-
The CRUD test relies on the admin user having the `admin` role (created
93-
automatically by `sm-users create-admin` or the bootstrap env vars).
94-
95-
**`test_admin_invite_smoke`**
96-
97-
1. Admin logs in and submits the invite form at `/users/admin/invite`.
98-
2. The test looks up the new user's UUID via the admin API.
99-
3. A verify token is minted locally (same secret the server uses).
100-
4. A fresh browser context navigates to `/users/invite/accept?token=…`, sets
101-
a password, and verifies a redirect to `/dashboard`.
102-
103-
These are **not** pixel-perfect regression tests — the goal is to catch broad
104-
breakage in the auth + render + CRUD spine.
105-
10661
## Debugging
10762

10863
To see what the browser is doing, run headed with the Playwright trace

docs/guide/project-structure.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ simple_module_python/
1212
│ ├── auth/ # session cookie, CSRF defences
1313
│ ├── background_tasks/ # Celery broker + worker integration
1414
│ ├── dashboard/ # authenticated landing page
15-
│ ├── datasets/ # CSV / dataset uploads
1615
│ ├── feature_flags/ # admin UI for flag toggles
1716
│ ├── file_storage/ # pluggable storage backends (local, S3)
1817
│ ├── permissions/ # role/permission admin UI
19-
│ ├── products/ # reference CRUD module (used in examples)
2018
│ ├── settings/ # DB-backed module settings + admin UI
2119
│ └── users/ # email+password auth, invites, bootstrap
2220

docs/guide/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The API and Vite dev servers start side by side. Visit:
2929

3030
- `http://localhost:8000` — landing page
3131
- `http://localhost:8000/users/login` — sign-in screen
32-
- `http://localhost:8000/products`a fully-working example module (CRUD on a `products` table)
32+
- `http://localhost:8000/dashboard`the authenticated home (log in first)
3333
- `http://localhost:8000/settings/modules` — the admin settings UI (log in first)
3434

3535
## 4. Create an admin

docs/release.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,9 @@ simple_module_test
4545
simple_module_auth
4646
simple_module_background_tasks
4747
simple_module_dashboard
48-
simple_module_datasets
4948
simple_module_feature_flags
5049
simple_module_file_storage
5150
simple_module_permissions
52-
simple_module_products
5351
simple_module_settings
5452
simple_module_users
5553
```
@@ -223,11 +221,9 @@ Trusted Publishing is tied to the GitHub repo, not any personal account — so a
223221
| PyPI | `simple_module_auth` | [modules/auth/](../modules/auth/) |
224222
| PyPI | `simple_module_background_tasks` | [modules/background_tasks/](../modules/background_tasks/) |
225223
| PyPI | `simple_module_dashboard` | [modules/dashboard/](../modules/dashboard/) |
226-
| PyPI | `simple_module_datasets` | [modules/datasets/](../modules/datasets/) |
227224
| PyPI | `simple_module_feature_flags` | [modules/feature_flags/](../modules/feature_flags/) |
228225
| PyPI | `simple_module_file_storage` | [modules/file_storage/](../modules/file_storage/) |
229226
| PyPI | `simple_module_permissions` | [modules/permissions/](../modules/permissions/) |
230-
| PyPI | `simple_module_products` | [modules/products/](../modules/products/) — reference CRUD example |
231227
| PyPI | `simple_module_settings` | [modules/settings/](../modules/settings/) |
232228
| PyPI | `simple_module_users` | [modules/users/](../modules/users/) |
233229
| npm | `@simple-module-py/ui` | [packages/ui/](../packages/ui/) |

framework/cli/simple_module_cli/catalog.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ class ModuleEntry:
3636
"Permissions",
3737
requires=("auth", "users"),
3838
),
39-
"products": ModuleEntry("products", "simple_module_products", "Products"),
4039
"dashboard": ModuleEntry(
4140
"dashboard",
4241
"simple_module_dashboard",
4342
"Dashboard",
44-
requires=("users", "products"),
43+
requires=("users",),
4544
),
4645
"settings": ModuleEntry("settings", "simple_module_settings", "Settings"),
4746
"feature_flags": ModuleEntry("feature_flags", "simple_module_feature_flags", "Feature Flags"),
@@ -58,26 +57,13 @@ class ModuleEntry:
5857
requires=("users",),
5958
recipe="background_tasks",
6059
),
61-
"datasets": ModuleEntry(
62-
"datasets",
63-
"simple_module_datasets",
64-
"Datasets",
65-
requires=("file_storage", "background_tasks"),
66-
),
6760
}
6861

6962

70-
# Example modules — `datasets` and `products` are intentionally excluded
71-
# from every default preset because their module names collide with custom
72-
# modules users typically want to register themselves. Pass them via
73-
# `--with datasets,products` (or pick the `examples` preset) to opt in.
74-
_EXAMPLE_MODULES: frozenset[str] = frozenset({"datasets", "products"})
75-
7663
PRESETS: dict[str, tuple[str, ...]] = {
7764
"minimal": ("users",),
7865
"standard": ("users", "dashboard", "permissions"),
79-
"full": tuple(name for name in CATALOG if name not in _EXAMPLE_MODULES),
80-
"examples": tuple(CATALOG),
66+
"full": tuple(CATALOG),
8167
}
8268

8369

framework/cli/simple_module_cli/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def create_host(
4545
str,
4646
typer.Option(
4747
"--with",
48-
help="Comma-separated module names to declare as deps (e.g. Auth,Products).",
48+
help="Comma-separated module names to declare as deps (e.g. Auth,Dashboard).",
4949
),
5050
] = "",
5151
) -> None:

framework/cli/simple_module_cli/new.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class Preset(StrEnum):
2525
minimal = "minimal"
2626
standard = "standard"
2727
full = "full"
28-
examples = "examples"
2928

3029

3130
def new_project(

framework/cli/tests/test_cli_catalog.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,10 @@ def test_expand_deps_pulls_in_transitive_dep() -> None:
4141

4242

4343
def test_expand_deps_pulls_in_chain() -> None:
44-
resolved, added = expand_deps(["datasets"])
45-
assert set(resolved) == {
46-
"datasets",
47-
"file_storage",
48-
"settings",
49-
"background_tasks",
50-
"users",
51-
"auth",
52-
}
44+
resolved, added = expand_deps(["permissions"])
45+
assert set(resolved) == {"permissions", "users", "auth"}
5346
added_names = {a for a, _ in added}
54-
assert added_names == {"file_storage", "settings", "background_tasks", "users", "auth"}
47+
assert added_names == {"users", "auth"}
5548

5649

5750
def test_expand_deps_idempotent_when_input_already_complete() -> None:

framework/cli/tests/test_cli_wizard.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@ def test_wizard_minimal_preset() -> None:
4848
def test_wizard_full_preset_includes_background_tasks() -> None:
4949
_, _, selected, _ = _drive(["", "", "3", ""])
5050
assert "background_tasks" in selected
51-
assert "datasets" not in selected
5251
assert len(selected) >= 7
5352

5453

5554
def test_wizard_custom_picks_only_yes_answers() -> None:
56-
answers = ["", "", "4"] + ["n"] * 8 + ["y", "n", ""]
55+
answers = ["", "", "4"] + ["n"] * 7 + ["y", ""]
5756
_, _, selected, out = _drive(answers)
5857
assert set(selected) == {"background_tasks", "users", "auth"}
5958
assert "Added users (required by background_tasks)" in out

0 commit comments

Comments
 (0)