Prepare for a live account: separate the indexes, and probe new routes live
With .env pointing at the real account, testing against the local instance became dangerous: process env beats --env-file, so a local smoke run would crawl fixtures straight into the live index, where a per-course refresh carries them forward indefinitely. mcp-env.sh now pins its own database (schulcloud_local) and mirror as well as the instance. The override publishes the server on MCP_HOST_PORT and takes CRAWL_INTERVAL_MS from .env, since what_changed can only report what happened between crawls. The build context leaves out tmp/, which holds a mirror of the account's files, and local-instance/. probe checks live what the gap fixes established locally: the /api/v1 course and user routes, classes, room allowedOperations as an object, and the preview enums on a real file. A failure there means a feature degrades rather than breaks. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -193,6 +193,21 @@ eval "$(./scripts/mcp-env.sh)" # as the demo student
|
||||
cd .. && npm run smoke # 39 checks against the local instance
|
||||
```
|
||||
|
||||
`mcp-env.sh` points the index at its own database, `schulcloud_local`, and the
|
||||
mirror at `tmp/mirror-local` — not just the instance at this one. The root
|
||||
`.env` normally targets the live account, and process env beats `--env-file`, so
|
||||
without that a local smoke run would crawl these fixtures into the live index,
|
||||
where a per-course refresh then carries them forward indefinitely. Create the
|
||||
database once:
|
||||
|
||||
```bash
|
||||
docker exec schulcloud-mcp-db psql -U schulcloud -d postgres \
|
||||
-c "CREATE DATABASE schulcloud_local OWNER schulcloud"
|
||||
```
|
||||
|
||||
Without it the server does not fail; it runs live-only, and smoke reports the
|
||||
smaller, index-free check count.
|
||||
|
||||
It also builds a **room** ("Raum"): rooms are a separate space from courses,
|
||||
and the naming misleads — the sidebar's *Kurse* entry points at
|
||||
`/rooms/courses-overview` while *Räume* points at `/rooms`. The fixture adds the
|
||||
|
||||
@@ -23,8 +23,19 @@ token=$(curl -fsS -X POST "$URL/api/v3/authentication/local" \
|
||||
"$(printf '%s' "$PASS" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')")" \
|
||||
| python3 -c 'import json,sys; print(json.load(sys.stdin)["accessToken"])')
|
||||
|
||||
# The index and mirror are pinned too, not just the instance. The repo's .env
|
||||
# normally points at the live account, and process env beats --env-file, so
|
||||
# without these a local smoke run would crawl this throwaway instance straight
|
||||
# into the live index — and a per-course refresh carries everything outside its
|
||||
# scope forward, so the fixtures would outlive the run. Fixtures in real data
|
||||
# is exactly the accident the store tests' "test" guard exists to prevent.
|
||||
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
|
||||
|
||||
cat <<ENV
|
||||
export TSC_URL=$URL
|
||||
export TSC_JWT_COOKIE=$token
|
||||
export MCP_AUTH_TOKEN=local-instance-token
|
||||
export DATABASE_URL=postgresql://schulcloud:schulcloud@127.0.0.1:55432/schulcloud_local
|
||||
export MIRROR_DIR=$ROOT/tmp/mirror-local
|
||||
export INDEX_PERSONAL_FILES=true
|
||||
ENV
|
||||
|
||||
Reference in New Issue
Block a user