Skip to content

Commit 45c867f

Browse files
authored
Merge branch 'v3' into claude/klicker-auto-migrations-90b73c
2 parents 69a6708 + 3872cae commit 45c867f

97 files changed

Lines changed: 6417 additions & 2939 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.

.agents/skills/devrouter/SKILL.md

Lines changed: 254 additions & 0 deletions
Large diffs are not rendered by default.

.agents/skills/klicker-environment-doctor/SKILL.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: Diagnose and repair a broken KlickerUZH development environment. Us
77

88
Run the checks **in order** — later checks assume earlier ones pass. Background facts live in the wiki: [docs/getting-started.md](../../../docs/getting-started.md).
99

10-
Provenance: checks 1–6 were executed and verified on macOS (2026-07-07). Steps marked **config-derived** were read from config, not executed — treat their exact output as unconfirmed.
10+
Provenance: checks 1–5 and 7–9 were executed and verified on macOS (2026-07-07). Check 6's process reconciler was executed in the Linux devcontainer image, and its host-side devrouter lifecycle was verified from a clean linked worktree on macOS (2026-07-13). Other steps marked **config-derived** were read from config, not executed — treat their exact output as unconfirmed.
1111

1212
## Agent ground rules
1313

@@ -32,7 +32,7 @@ Wrong major (e.g. 9.x from a stale Volta shim; `VOLTA_FEATURE_PNPM` unset) **sil
3232
| `ERR_PNPM_LOCKFILE_CONFIG_MISMATCH` under `CI=true` | restore lockfile (check 1), install without `CI=true` |
3333
| ~19 packages fail `pnpm run check` | `pnpm run build` once (generates Prisma client, codegen, dists), then re-check |
3434

35-
Healthy sequence from scratch: `pnpm install``pnpm run build``pnpm run check` (verified ~20s / ~1.5min / clean).
35+
Healthy sequence from scratch inside the devcontainer: `pnpm install``pnpm run build``pnpm run check` (verified ~20s / ~1.5min / clean). The root build script forces `NODE_ENV=production`, including when the devcontainer exports `NODE_ENV=development` for its live apps. A production build can replace Next.js dev output; run `devrouter ensure .` afterward so the exact checkout runtime is health-checked and recovered when needed.
3636

3737
## Check 3 — stale GraphQL codegen
3838

@@ -53,22 +53,25 @@ If `apps/analytics` complains about schema drift or a schema edit isn't visible:
5353
lsof -nP -iTCP:5432 -sTCP:LISTEN # repeat for 6379 6380 6381 7077 8888 80 443
5454
```
5555

56-
`Bind for :::5432 failed: port is already allocated` means another stack holds the port — stop it or don't start the colliding service. Plain localhost and legacy host-based paths publish fixed ports, so only one such stack runs per machine. For parallel devcontainer worktrees, keep the base `.devcontainer/docker-compose.yml` port-free and use `.devcontainer/docker-compose.devrouter.yml`, which exposes `${WORKSPACE:-klicker-uzh}-app` / `${WORKSPACE:-klicker-uzh}-db` aliases on `devnet`. Start/register linked worktrees with the same token, e.g. `WORKSPACE=<slug> devpod up .` and `devrouter app run <app> --workspace <slug>`. Use `.devcontainer/docker-compose.localhost.yml` only for the one-at-a-time localhost fallback. If manage media uploads fail with an Azure Blob CORS error while GraphQL auth still works, check the storage account before changing app CORS. The media library uploads directly from the browser to Azure Blob Storage via SAS, so the Blob service CORS rule must allow the actual devrouter origin (`https://manage.klicker.localhost` or `https://manage.klicker.<workspace>.localhost`). Use exact origins for production/staging accounts; for a dedicated dev storage account, a dev-only `https://*.localhost` rule keeps parallel worktrees usable.
56+
`Bind for :::5432 failed: port is already allocated` means another stack holds the port — stop it or don't start the colliding service. Plain localhost and legacy host-based paths publish fixed ports, so only one such stack runs per machine. Parallel devcontainer worktrees use the port-free base compose file plus `.devcontainer/docker-compose.devrouter.yml`; the one-at-a-time fallback uses `.devcontainer/docker-compose.localhost.yml`. If manage media uploads fail with an Azure Blob CORS error while GraphQL auth still works, check the storage account before changing app CORS. The media library uploads directly from the browser to Azure Blob Storage via SAS, so its CORS rule must allow the actual local origin. Use exact origins for production/staging accounts and dev-only localhost rules for a dedicated dev storage account.
5757

5858
## Check 6 — infra bring-up / server status (headless-safe)
5959

6060
Depending on your environment path:
6161

62-
### Path A: Inside Devcontainer
62+
### Path A: Managed devcontainer
6363

64-
The container manages infra services and app servers automatically in the background. Check logs and process status:
64+
Run the ownership-aware lifecycle check from the host, then inspect the exact container through devrouter:
6565

6666
```bash
67-
pgrep -f "turbo run dev" >/dev/null && echo "Dev servers running" || echo "Dev servers NOT running"
68-
tail -n 50 /tmp/dev.log # inspect server startup logs
67+
devrouter ensure .
68+
devrouter exec . -- cat /tmp/devrouter-process-klicker-dev.state
69+
devrouter exec . -- tail -n 50 /tmp/dev.log
6970
```
7071

71-
If servers are down, restart them: `bash .devcontainer/post-start.sh`.
72+
`devrouter ensure` delivers its matching process helper to the exact validated container. Released `0.0.35` fingerprints the workspace, command, adapter bytes, and declared non-secret origin allowlist. The helper replaces a stale owned process group and leaves unknown processes untouched. Host-side ensure checks all routes and can recreate one stale or unhealthy exact-path DevPod once.
73+
74+
`devrouter doctor --repo .` provides static diagnostics. `devrouter ensure .` resolves the checkout-specific overlay and is the authoritative runtime proof.
7275

7376
### Path B: Host-based Setup
7477

.agents/skills/klicker-testing-verification/SKILL.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ Facts about the test landscape: [docs/testing.md](../../../docs/testing.md). Thi
1818

1919
Never run root `pnpm run test:run` blind — its turbo fan-out includes Cypress, which needs a running seeded stack.
2020

21+
Direct checks for `auth`, `chat`, `frontend-control`, `frontend-manage`, and `frontend-pwa` generate ignored Next route types first through each app's `check` script. Do not hand-edit or commit `next-env.d.ts`; keep it ignored and included by `tsconfig.json`. The three PWA apps use `tsconfig.check.json` to exclude `.next/dev/types` from raw `tsc`; otherwise stale dev and fresh production Pages Router validators duplicate global declarations.
22+
23+
For Next framework or bundler changes, verify both repository-supported paths. `pnpm run build:test` uses Turbopack in all five Next apps. `pnpm run build` uses Turbopack for auth/chat and Webpack for control/manage/PWA until their service-worker integration moves to Serwist. Confirm standalone server paths for all five apps and `sw.js`, Workbox, and custom worker outputs for the three PWA apps.
24+
25+
The Playwright build job must tar the five `.next` trees before artifact upload and extract them in each shard. Direct artifact upload dereferences Turbopack's `.next/node_modules` symlinks and can omit transitive runtime links, producing HTTP 500 before the suite starts.
26+
2127
## Decide whether e2e is warranted locally
2228

23-
CI runs Cypress (8-way split) and Playwright (5-way shard) on almost every code PR — CI is the real e2e gate. Run e2e locally only when your change plausibly breaks a flow (new UI, changed selectors/`data-cy`, auth/redirect changes, activity lifecycle). If you do:
29+
CI runs Cypress (8-way split) and Playwright (8-way shard) on almost every code PR — CI is the real e2e gate. Run e2e locally only when your change plausibly breaks a flow (new UI, changed selectors/`data-cy`, auth/redirect changes, activity lifecycle). If you do:
2430

2531
- You are **authorized to start the required servers for this purpose** — test stack via the e2e skills' setup instructions, plus the Hatchet general worker for publish/schedule/end flows and response-api + response processor for live-answer flows (exact triage in the e2e skills).
2632
- Tear down afterwards (`./_down.sh`); leave the machine as you found it.

.agents/skills/klicker-wiki-maintenance/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ New non-obvious patterns discovered during a task go to the matching page above
4343
3. Validate + format:
4444

4545
```bash
46-
bash ~/.claude/skills/llm-wiki-okf/scripts/validate.sh docs # if the validator is available; no trailing slash
46+
bash ~/.agents/skills/rs-llm-wiki-okf/scripts/validate.sh docs # no trailing slash
4747
pnpm exec prettier --write docs/
4848
```
4949

.devcontainer/Dockerfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,21 @@ FROM node:24.16.0-bookworm-slim
55

66
ENV PNPM_HOME="/pnpm" \
77
PATH="/pnpm:$PATH" \
8-
DEBIAN_FRONTEND=noninteractive
8+
UV_PYTHON="3.12"
9+
10+
ARG DEBIAN_FRONTEND=noninteractive
911

1012
# Runtime tools: git (repo ops), openssl/ca-certificates (Prisma + TLS),
11-
# procps (pgrep for the post-start dev-server guard), curl (healthchecks).
13+
# procps (process matching), util-linux (flock/setsid), curl (healthchecks).
1214
RUN apt-get update \
1315
&& apt-get install -y --no-install-recommends \
14-
git openssl ca-certificates procps curl \
16+
git openssl ca-certificates procps util-linux curl \
1517
&& rm -rf /var/lib/apt/lists/*
1618

19+
# Match the analytics image and CI so the repository-wide lint gate works in
20+
# the self-contained development environment.
21+
COPY --from=ghcr.io/astral-sh/uv:0.11.12 /uv /uvx /bin/
22+
1723
# Install pnpm with npm (not corepack — signature verification can fail on a
1824
# pinned Node). Mirror the repo's packageManager pin. (GOTCHAS #8)
1925
RUN npm install -g pnpm@11.5.0

0 commit comments

Comments
 (0)