Skip to content

Commit 06ea581

Browse files
committed
feat(demo): the seed data ships with the extension, and screenshots need no ddev
Three things were tangled together, and untangling them is what this is. THE SEED WAS TIED TO ONE LOCAL TOOL. It lived under .ddev/ as two MySQL dumps plus a raw-PDO script hard-wired to host `db`, database `v14` and root/root. Nothing else could use it: not the functional suite, which runs on SQLite, and not a documentation screenshot run, which needs the same rows to exist somewhere it can serve TYPO3 from. The data now lives in Resources/Private/Demo/DemoData.php and `nrllm:demo:seed` writes it through the ConnectionPool, so the DBMS is whatever the instance uses. Relations are named by IDENTIFIER. The SQL resolved them through MySQL session variables that looked up "whatever is default right now", so the graph depended on insert order and on flags it did not set itself. THE NUMBERS ARE REAL AND REPRODUCIBLE. Every value in the usage history is derived from (seed, day, model) rather than drawn from a seeded global stream. Two things break the global stream and both did: a value depends on how many numbers were drawn before it, so the history changes when iteration order does — and PHP-CS-Fixer rewrites mt_srand/mt_rand to srand/random_int, which is cryptographically seeded and ignores the seed entirely. The reproducible history would have been silently un-reproducible from the first `-s cgl` run. Verified by checksum: cgl now leaves the file byte-identical. The demo graph also gained a priced stream. The local Ollama models are free, so every cost surface read $0.00 — the functional test caught exactly that, and `cost_input`/`cost_output` are CENTS per 1M tokens, which the first formula had wrong by five orders of magnitude. SCREENSHOTS NO LONGER NEED DDEV, AND NO LONGER SHOW THE MENU. Build/Scripts/screenshots.sh installs TYPO3 on SQLite, seeds it, serves it with PHP's built-in server and drives Playwright at it. Every piece already existed; the only local answer to "a running TYPO3" was E2E_BASE_URL pointing at a ddev site, which is why taking a screenshot needed a tool meant for humans. screenshots.spec.ts captures the module IFRAME, not the window. TYPO3 v14 renders module content in an iframe, so that element IS the module without the menu. This is not cosmetic: all sixteen full-window PNGs went stale the day the modules moved into the AI section, because each showed `Administration > LLM` in the sidebar. A module-only shot cannot go stale that way. Five things had to be fixed to make that pipeline run, each found by a failure that named something else: - a router script, because handing index.php to `php -S` makes it the router for /_assets/* too and the backend renders with no stylesheet at all - trustedHostsPattern, because the container reaches the server by a name the install never saw and TYPO3 answers 500, which reads as "server not up" - loginRateLimit off and a fresh database each run, because eight logins from one address plus one early wrong password locks the rest out with a 403 - PHP_CLI_SERVER_WORKERS, because the built-in server is single-threaded and parallel browser workers queue until the navigation times out - --workers=1, for the same reason One upstream bug is worked around rather than fixed here: netresearch/typo3-ci-workflows v1.6.0 uses ${IMAGE_PLAYWRIGHT} at line 715 and assigns it nowhere, while every sibling IMAGE_* is set around line 540 — so `-s e2e` feeds docker an empty image and dies with "invalid reference format". It can never have started a container. screenshots.sh supplies the image, pinned to the version package-lock.json resolves because the image ships matching browsers. Reported separately. Tests: Tests/Functional/Command/SeedDemoDataCommandTest.php, 5 tests / 23 assertions, on SQLite — which is itself the evidence that the seed left ddev. It asserts the counts against the shipped data rather than repeating them, that every relation resolves to a real uid, that a second run updates rather than duplicates, and that the same --days produces identical totals twice. Gates: unit 7318 / 24770, functional (sqlite) for the new class, cgl, phpstan level 10 — all green on PHP 8.4. The screenshot pipeline ran end to end: 8 passed, all eight PNGs rewritten. Rector NOT run: pinned to 8.2, this .Build is resolved at 8.4, platform_check fatals. CI covers it. Assisted-by: claude-code:claude-opus-5 Agent-Session: https://claude.ai/code/session_01MNg1MysJVugv1xo2husknU Agent-Host: 0493f0 Signed-off-by: Sebastian Mendel <sebastian.mendel@netresearch.de>
1 parent 719e652 commit 06ea581

31 files changed

Lines changed: 1477 additions & 1239 deletions

.ddev/AGENTS.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ ddev describe # print URLs and credentials
4343
| Task | Command |
4444
|------|---------|
4545
| Full setup (TYPO3 v14 + extension) | `ddev install-v14` (also `install-v13`, `install-all`, `setup`) |
46-
| Seed provider/model/config demo data | `ddev seed-ollama` |
47-
| Seed task demo data | `ddev seed-tasks` (also `seed-usage`; SQL in `.ddev/sql/`) |
46+
| Seed the demo graph and usage history | `ddev seed-demo [days]` |
4847
| Ollama status / models | `ddev ollama` |
4948
| Render RST docs | `ddev docs` |
5049

5150
### Demo data for screenshots and manual testing
52-
`ddev seed-ollama` creates 1 provider (Local Ollama), 3 models and 4 configurations; `ddev seed-tasks` creates 13 tasks across 4 categories. `ddev install-v14` auto-runs seed-ollama but NOT seed-tasks — run both before documentation screenshots so populated views are visible.
51+
`ddev seed-demo` delegates to the extension's own `nrllm:demo:seed`. The data lives in `Resources/Private/Demo/DemoData.php` and ships with the extension, so the functional suite and a screenshot run seed the same rows — the two MySQL dumps and the raw-PDO script that used to live under `.ddev/` could only ever reach ddev. `ddev install-v14` runs it, so a fresh install already has populated views.
5352
<!-- AGENTS-GENERATED:END commands -->
5453

5554
<!-- AGENTS-GENERATED:START patterns -->

.ddev/commands/host/seed-demo

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
## Description: Seed the demo record graph and usage history (delegates to nrllm:demo:seed)
3+
## Usage: seed-demo [days]
4+
## Example: ddev seed-demo
5+
## Example: ddev seed-demo 30
6+
7+
# A wrapper, not an implementation. The seed used to live here as two MySQL
8+
# dumps plus a raw-PDO script hard-wired to host `db`, database `v14` and
9+
# root/root — which is why nothing but ddev could use it. It now ships with the
10+
# extension in Resources/Private/Demo/ and runs through the ConnectionPool, so
11+
# the functional suite and a screenshot run reach the same rows.
12+
DAYS="${1:-90}"
13+
14+
ddev exec ./.Build/bin/typo3 nrllm:demo:seed --days="${DAYS}"

.ddev/commands/host/seed-ollama

Lines changed: 0 additions & 44 deletions
This file was deleted.

.ddev/commands/host/seed-tasks

Lines changed: 0 additions & 45 deletions
This file was deleted.

.ddev/commands/host/seed-usage

Lines changed: 0 additions & 25 deletions
This file was deleted.

.ddev/commands/web/install-v13

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,10 @@ vendor/bin/typo3 styleguide:generate || echo "Styleguide generation skipped"
9595
# Flush caches
9696
vendor/bin/typo3 cache:flush
9797

98-
# Import Ollama seed data (provider, models, configurations)
99-
echo "Importing Ollama LLM seed data..."
100-
SQL_FILE="/var/www/nr_llm/.ddev/sql/seed-ollama.sql"
101-
if [ -f "$SQL_FILE" ]; then
102-
mysql -h db -u root -proot "$VERSION" < "$SQL_FILE" && echo " Seed data imported" || echo " Seed import skipped"
103-
else
104-
echo " Seed file not found, skipping"
105-
fi
98+
# Seed the demo graph. Ships with the extension now, so this is the same
99+
# command the functional suite and a screenshot run use.
100+
echo "Seeding demo data..."
101+
./.Build/bin/typo3 nrllm:demo:seed --days=90 && echo " Demo data seeded" || echo " Seeding failed"
106102

107103
echo ""
108104
echo "TYPO3 $VERSION installation complete!"

.ddev/commands/web/install-v14

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,10 @@ vendor/bin/typo3 styleguide:generate || echo "⚠️ Styleguide generation skipp
9696
# Flush caches
9797
vendor/bin/typo3 cache:flush
9898

99-
# Import Ollama seed data (provider, models, configurations)
100-
echo "🤖 Importing Ollama LLM seed data..."
101-
SQL_FILE="/var/www/nr_llm/.ddev/sql/seed-ollama.sql"
102-
if [ -f "$SQL_FILE" ]; then
103-
mysql -h db -u root -proot "$VERSION" < "$SQL_FILE" && echo " ✅ Seed data imported" || echo " ⚠️ Seed import skipped"
104-
else
105-
echo " ⚠️ Seed file not found, skipping"
106-
fi
99+
# Seed the demo graph. Ships with the extension now, so this is the same
100+
# command the functional suite and a screenshot run use.
101+
echo "🤖 Seeding demo data..."
102+
./.Build/bin/typo3 nrllm:demo:seed --days=90 && echo " ✅ Demo data seeded" || echo " ⚠️ Seeding failed"
107103

108104
echo ""
109105
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

0 commit comments

Comments
 (0)