mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
494dc4f773
LOCK_SKIN's headline behaviour had ZERO automated coverage. Every existing spec
pins the gate off (`LOCK_SKIN: ""` in the webServer env), so the locked shape was
verified only by hand. That gap matters more now that the lock rewrites the whole
URL space rather than just picking a redirect target: the client and server
halves (useSkinHref and proxy.ts) must agree, and if they do not the feature
half-works SILENTLY — pages still resolve, the tenant prefix just reappears in
the address bar. Nothing fails; the demo stops being what it claims to be.
Two guards, cheapest first.
`src/shell/skin-path.drift.test.ts` — a lexical guard that no file under
src/skins/** hardcodes its own route prefix. Deliberately static, not a render
test: the violation type-checks, lints, renders AND navigates correctly, so
there is nothing for a behavioural test to catch short of reading the href. The
shell's skin SWITCHER is the one legitimate hardcoded prefix (it targets a
DIFFERENT skin and only renders unlocked) and sits outside src/skins/, so it is
out of scope by construction rather than by exemption list. Verified the guard
actually fires by reintroducing airline's old `/${skin.id}/${route.segment}` and
confirming it failed naming that file.
`e2e/locked-skin.spec.ts` + a `locked` Playwright project — the real check, in a
browser against a genuinely locked server. The lock is a boot-time server env, so
the two deploy shapes are two processes; hence a second webServer rather than a
fixture. 12 tests: served at `/` with no redirect, branded metadata, static
badge, NO link carrying the prefix, click-through keeping the URL clean, deep
page cold-loading, the other skins 404ing, and the SSE + public-asset paths
staying un-rewritten.
Supporting config, each item load-bearing:
- `next.config.mjs` gains an env-driven `distDir`. Two `next dev` processes
corrupt each other's output through a shared `.next`.
- `eslint.config.mjs` ignores `.next-locked/**`. ESLint does not read
.gitignore, so without it one e2e run made `pnpm lint` report 23,706 problems
in generated output.
- `tsconfig.json` pre-lists the `.next-locked` type globs so the locked server
has nothing to append to a tracked file.
- The unlocked project repeats `ogui-routing.spec.ts` in its OWN testIgnore. A
project-level testIgnore REPLACES the config-level one rather than adding to
it, so introducing projects silently re-admitted those 7 specs — caught by
checking the per-project test counts against the pre-change baseline, not by
the run passing.
Suite goes 17 -> 29 tests: the same 17 unlocked (baseline preserved exactly) plus
12 locked. Unit tests 326 -> 330. `pnpm lint` clean, `pnpm build` clean.
Also verified airline and logistics locked in a browser — both were changed by
the parent commit (href construction AND active-state derivation) and neither had
been exercised. Nav is prefix-free and aria-current tracks correctly in both.
KNOWN CHURN, documented at the env block: Next rewrites the tracked
`next-env.d.ts` to reference whichever dist dir booted last, so a full e2e run
leaves it pointing at `.next-locked`. Discard that hunk before committing; any
build restores it.
Reskin skill: verification gains the two steps that would have caught a new
skin's violation — run `pnpm test:unit` for the drift guard, then run the skin
under `LOCK_SKIN=<id>` and open `/`.
Co-Authored-By: Claude <noreply@anthropic.com>
30 lines
1.6 KiB
JavaScript
30 lines
1.6 KiB
JavaScript
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
// Normally `.next`. The E2E suite runs a SECOND dev server (the LOCK_SKIN
|
|
// project in playwright.config.ts) against this same project directory, and
|
|
// two `next dev` processes sharing one build directory corrupt each other's
|
|
// output. Overriding this per server is what keeps them isolated. Unset
|
|
// everywhere else, so ordinary dev/build/start are unaffected.
|
|
distDir: process.env.NEXT_DIST_DIR || ".next",
|
|
|
|
// React StrictMode intentionally double-invokes mount effects in DEV ONLY.
|
|
// For CopilotKit's AG-UI human-in-the-loop flow that double-mount tears the
|
|
// in-flight run down the instant the agent emits a HITL tool call — before
|
|
// the approval card can render and return its result — which orphans the tool
|
|
// call ("Tool result is missing for tool call …") and then poisons the thread
|
|
// so every later message fails. Production builds never double-invoke, so the
|
|
// bug is purely a `next dev` artifact; disabling StrictMode makes the live
|
|
// HITL chat (and the teach-mode demonstration arc) work when the demo is run
|
|
// via `next dev`. No effect on production behavior or correctness.
|
|
reactStrictMode: false,
|
|
|
|
// Hide Next's floating dev-tools badge (the "N" bottom-left that periodically
|
|
// flashes "1 Issue"). It is a dev-only overlay, but this demo is PRESENTED
|
|
// from `next dev`, so on stage it reads as a defect in our product and it
|
|
// overlaps the chat's own bottom-left controls. Purely cosmetic: it disables
|
|
// the indicator, not any checking.
|
|
devIndicators: false,
|
|
};
|
|
|
|
export default nextConfig;
|