proteum 2.2.9 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +3 -2
- package/README.md +49 -11
- package/agents/project/AGENTS.md +43 -5
- package/agents/project/diagnostics.md +6 -2
- package/agents/project/optimizations.md +1 -0
- package/agents/project/root/AGENTS.md +14 -5
- package/agents/project/tests/AGENTS.md +6 -0
- package/agents/project/tests/e2e/AGENTS.md +13 -0
- package/agents/project/tests/e2e/REAL_WORLD_JOURNEY_TESTS.md +192 -0
- package/cli/commands/connect.ts +40 -4
- package/cli/commands/diagnose.ts +136 -5
- package/cli/commands/doctor.ts +24 -4
- package/cli/commands/explain.ts +105 -6
- package/cli/commands/mcp.ts +16 -0
- package/cli/commands/orient.ts +66 -3
- package/cli/commands/perf.ts +118 -13
- package/cli/commands/runtime.ts +151 -0
- package/cli/commands/trace.ts +116 -21
- package/cli/mcp/provider.ts +365 -0
- package/cli/mcp/stdio.ts +16 -0
- package/cli/presentation/commands.ts +77 -20
- package/cli/presentation/devSession.ts +2 -0
- package/cli/runtime/commands.ts +95 -12
- package/cli/utils/agentOutput.ts +46 -0
- package/cli/utils/agents.ts +116 -49
- package/common/dev/inspection.ts +14 -6
- package/common/dev/mcpPayloads.ts +736 -0
- package/common/dev/mcpServer.ts +254 -0
- package/docs/agent-routing.md +126 -0
- package/docs/dev-commands.md +2 -0
- package/docs/dev-sessions.md +2 -1
- package/docs/diagnostics.md +68 -23
- package/docs/mcp.md +149 -0
- package/docs/migrate-from-2.1.3.md +15 -5
- package/docs/request-tracing.md +12 -6
- package/package.json +2 -1
- package/server/app/devMcp.ts +159 -0
- package/server/services/router/http/cache.ts +116 -0
- package/server/services/router/http/index.ts +94 -35
- package/server/services/router/index.ts +8 -11
- package/tests/agents-utils.test.cjs +36 -13
- package/tests/dev-transpile-watch.test.cjs +117 -8
- package/tests/inspection.test.cjs +67 -0
- package/tests/mcp.test.cjs +127 -0
- package/tests/router-cache-config.test.cjs +74 -0
package/AGENTS.md
CHANGED
|
@@ -58,6 +58,7 @@ npx prisma migrate dev --config ./prisma.config.ts --name <migration name>
|
|
|
58
58
|
- `/Users/gaetan/Desktop/Projets/unique.domains/platform/apps/website`
|
|
59
59
|
- Inspect how both apps currently use the touched feature, runtime, API, compiler behavior, or generated output before proposing or implementing changes.
|
|
60
60
|
- Keep the developer-facing contract synchronized when framework work changes CLI commands, profiler capabilities, or the `proteum dev` banner. Update the live surfaces together in the same pass: CLI command/help definitions, profiler panels and dev-only endpoints, banner text/examples, and the most relevant agent docs that describe them, especially `AGENTS.md`, `agents/project/AGENTS.md`, `agents/project/root/AGENTS.md`, `agents/project/app-root/AGENTS.md`, `agents/project/diagnostics.md`, and any narrower `agents/project/**/AGENTS.md` file that mentions the changed workflow.
|
|
61
|
+
- Proteum MCP contract: `proteum mcp` is the read-only stdio server for compact agent diagnostics, and `proteum dev` exposes the same runtime-adjacent MCP contract at `/__proteum/mcp`. Keep MCP tools/resources compact, typed, capped, paginated for full trace detail, and read-only unless a future task explicitly expands the mutation contract. MCP payloads are compact single-line `proteum-mcp-v1` JSON, not pretty-printed human output. Do not implement MCP tools as thin CLI process wrappers when the data is available through manifest readers, tracked sessions, or dev runtime registries.
|
|
61
62
|
- Keep the same-system trace contract explicit when request instrumentation changes: `TRACE_*` controls the retained dev trace store plus the trace/perf CLI, dev-only HTTP endpoints, and bottom profiler, while `ENABLE_PROFILER` enables the reduced request-local `request.profiling` snapshot and `request.finished` hook payload without retaining finished requests globally unless dev trace is also enabled.
|
|
62
63
|
- Current CLI banner contract: only the bare `proteum build` and bare `proteum dev` commands print the welcome banner and include the active Proteum installation method. Any extra argument or option skips the banner. Only `proteum dev` clears the interactive terminal before rendering, exposes `CTRL+R` reload plus `CTRL+C` shutdown hotkeys in its session UI, and reports connected app names plus successful connected `/ping` checks in the ready banner. Every `proteum dev` start ensures tracked instruction files contain the current managed `# Proteum Instructions` section before the dev loop begins.
|
|
63
64
|
- Keep core changes aligned with the explicit controller/page architecture in `agents/project/root/AGENTS.md` and its standalone composition in `agents/project/AGENTS.md`.
|
|
@@ -80,12 +81,12 @@ Do not stop at static analysis for routing, controllers, generated code, SSR, cl
|
|
|
80
81
|
|
|
81
82
|
- Run `npx proteum dev --no-cache --session-file var/run/proteum/dev/framework-<app>.json --port <free-3xxx-port>` in both reference apps on explicit free ports and with elevated permissions outside the sandbox.
|
|
82
83
|
- If either reference app uses local `file:` connected projects for the affected flow, run those producer apps too on their own free ports before exercising the consumer.
|
|
83
|
-
- When validating a concrete route, controller path, or failing page on a running dev server, prefer `proteum diagnose <path> --port <port>` first. Use
|
|
84
|
+
- When validating a concrete route, controller path, or failing page on a running dev server, prefer `proteum diagnose <path> --port <port>` first. Use `proteum trace show <requestId> --events` only when you need lower-level event detail beyond the compact diagnose summary.
|
|
84
85
|
- When the issue is latency, CPU, SQL cost, render cost, or memory drift, inspect `proteum perf top`, `proteum perf request`, `proteum perf compare`, or `proteum perf memory` against the running dev server before adding custom instrumentation.
|
|
85
86
|
- When a framework change can affect shipped client code size, run `proteum build --prod --analyze` for static bundle artifacts or `proteum build --prod --analyze --analyze-serve --analyze-port auto` when you need a local analyzer URL.
|
|
86
87
|
- For protected browser or API flows in dev, prefer `npx proteum session <email> --role <role>` for browser MCP validation, or `npx proteum e2e --session-email <email> --session-role <role>` for automated end-to-end suites, instead of automating the login UI. Use the login UI only when login itself is the feature under test.
|
|
87
88
|
- When a task needs browser execution instead of the higher-level verifier, use the browser MCP. Keep Playwright inside `npx proteum e2e --port <port>` for targeted or full end-to-end suites. Keep auth sourced from Proteum session helpers, not UI login or shared browser state.
|
|
88
|
-
- For request-time behavior, arm traces with `proteum trace arm --capture deep`, reproduce once, then inspect `proteum trace latest` or `proteum trace show <requestId
|
|
89
|
+
- For request-time behavior, arm traces with `proteum trace arm --capture deep`, reproduce once, then inspect compact `proteum trace latest` or raw `proteum trace show <requestId> --events` only when needed.
|
|
89
90
|
- When the framework-facing workflow itself changed, verify the CLI surface too with `proteum verify framework-change --crosspath-port <port> --product-port <port> --website-port <port>`.
|
|
90
91
|
- Only the final verifier agent should usually run browser flows. Other agents should stay on `orient`, `verify owner`, `verify request`, and command-level checks unless browser execution is the only trustworthy surface.
|
|
91
92
|
- Open the real pages with the browser MCP.
|
package/README.md
CHANGED
|
@@ -192,6 +192,42 @@ export default class MyApp extends Application {
|
|
|
192
192
|
|
|
193
193
|
Proteum reads `server/index.ts` as the source of truth for installed root services and router plugins, and reads `server/config/*.ts` `Services.config(...)` exports for typed config such as service priority overrides.
|
|
194
194
|
|
|
195
|
+
## Router Cache Policy
|
|
196
|
+
|
|
197
|
+
Browser cache headers are configurable per app through the optional `routerBaseConfig.http.cache` object. Omit it to keep Proteum's defaults.
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
export const routerBaseConfig = {
|
|
201
|
+
currentDomain: AppContainer.Environment.router.currentDomain,
|
|
202
|
+
http: {
|
|
203
|
+
domain: 'example.com',
|
|
204
|
+
port: AppContainer.Environment.router.port,
|
|
205
|
+
ssl: true,
|
|
206
|
+
upload: { maxSize: '10mb' },
|
|
207
|
+
cache: {
|
|
208
|
+
html: {
|
|
209
|
+
dynamic: {
|
|
210
|
+
cacheControl: 'no-store, no-cache, must-revalidate, proxy-revalidate',
|
|
211
|
+
surrogateControl: 'no-store',
|
|
212
|
+
},
|
|
213
|
+
static: {
|
|
214
|
+
cacheControl: 'public, max-age=0, must-revalidate',
|
|
215
|
+
surrogateControl: false,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
publicAssets: {
|
|
219
|
+
dev: 'no-store',
|
|
220
|
+
versioned: 'public, max-age=31536000, immutable',
|
|
221
|
+
unversioned: 'public, max-age=0, must-revalidate',
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
context: () => ({}),
|
|
226
|
+
} satisfies RouterBaseConfig;
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Default public asset validators depend on the environment: dev disables `ETag` and `Last-Modified`, while non-dev enables them. Use `etag: false` and `lastModified: false` when an app needs to fully disable browser cache for `/public` assets.
|
|
230
|
+
|
|
195
231
|
## Example: Page
|
|
196
232
|
|
|
197
233
|
Proteum pages are explicit SSR entrypoints.
|
|
@@ -342,6 +378,7 @@ Proteum ships with a compact CLI focused on the real app lifecycle:
|
|
|
342
378
|
| `proteum diagnose` | Combine owner lookup, diagnostics, trace data, and server logs for one concrete route or request target |
|
|
343
379
|
| `proteum perf` | Aggregate request-trace performance into hot paths, one-request waterfalls, regressions, and memory drift views |
|
|
344
380
|
| `proteum trace` | Inspect live dev-only request traces from the running SSR server |
|
|
381
|
+
| `proteum mcp` | Start the read-only MCP server for compact agent diagnostics and runtime reads |
|
|
345
382
|
| `proteum command` | Run a dev-only internal command locally or against a running dev server |
|
|
346
383
|
| `proteum session` | Mint a dev-only auth session token and Playwright-ready cookie payload |
|
|
347
384
|
| `proteum e2e` | Run Playwright with Proteum-managed `E2E_*` values instead of shell-leading env assignments |
|
|
@@ -383,6 +420,7 @@ proteum perf top --since today
|
|
|
383
420
|
proteum perf request /dashboard --port 3101
|
|
384
421
|
proteum perf compare --baseline yesterday --target today --group-by route
|
|
385
422
|
proteum perf memory --since 1h --group-by controller
|
|
423
|
+
proteum mcp --url http://localhost:3101
|
|
386
424
|
proteum command proteum/diagnostics/ping
|
|
387
425
|
proteum command proteum/diagnostics/ping --port 3101
|
|
388
426
|
proteum session admin@example.com --role ADMIN --port 3101
|
|
@@ -408,7 +446,7 @@ proteum create service Conversion/Plans
|
|
|
408
446
|
|
|
409
447
|
Every `proteum dev` start runs the same idempotent instruction check. It updates missing or stale managed sections automatically and prompts only when a blocked path would need to be replaced.
|
|
410
448
|
|
|
411
|
-
`proteum connect`, `proteum explain`, `proteum doctor`, and `proteum
|
|
449
|
+
`proteum connect`, `proteum explain`, `proteum doctor`, `proteum diagnose`, and `proteum mcp` share the same generated manifest and contract state. `proteum perf` uses the same dev request-trace store as the profiler `Perf` tab. `proteum dev` also exposes the same read-only MCP contract at `/__proteum/mcp` for repeated agent reads against the live runtime. For the full diagnostics and tracing model, see [docs/diagnostics.md](docs/diagnostics.md), [docs/mcp.md](docs/mcp.md), and [docs/request-tracing.md](docs/request-tracing.md).
|
|
412
450
|
|
|
413
451
|
## Dev Commands
|
|
414
452
|
|
|
@@ -450,7 +488,7 @@ The CLI talks to the running app over the dev-only `__proteum/session/start` end
|
|
|
450
488
|
|
|
451
489
|
Proteum includes a dev-only in-memory request trace buffer for auth, routing, controller, context, SSR, API, Prisma SQL, and render debugging.
|
|
452
490
|
|
|
453
|
-
This is separate from `proteum explain` and `proteum doctor`: tracing is live request-time data, while explain/doctor are manifest-backed structure and diagnostics. `proteum perf` aggregates the same trace buffer into hot-path, waterfall, compare, and memory views. When you already know the failing path and want the fastest suspect list, start with `proteum diagnose`; when the issue is performance, start with `proteum perf`; then drop into raw trace output only if needed.
|
|
491
|
+
This is separate from `proteum explain` and `proteum doctor`: tracing is live request-time data, while explain/doctor are manifest-backed structure and diagnostics. `proteum perf` aggregates the same trace buffer into hot-path, waterfall, compare, and memory views. When you already know the failing path and want the fastest suspect list, start with `proteum diagnose`; when the issue is performance, start with `proteum perf`; then drop into raw trace output only if needed. When an agent needs repeated trace, perf, diagnose, status, or instruction-routing reads from the same running app, use `proteum mcp --url <dev-url>` or the dev-hosted `/__proteum/mcp` endpoint.
|
|
454
492
|
|
|
455
493
|
When diagnosing or testing against an app, first read the default port from `PORT` or `./.proteum/manifest.json` and check whether a server is already running there. If it is, inspect the existing traces before reproducing the issue so you can collect past errors and their context.
|
|
456
494
|
|
|
@@ -522,6 +560,7 @@ Proteum answers those questions with explicit artifacts:
|
|
|
522
560
|
- `proteum explain owner <query>` for fast ownership lookup over routes, controllers, files, and generated artifacts
|
|
523
561
|
- `proteum diagnose <path>` for a one-shot request diagnosis surface
|
|
524
562
|
- `proteum perf top|request|compare|memory` for request-trace performance rollups
|
|
563
|
+
- `proteum mcp` or `/__proteum/mcp` for repeated low-token agent reads over the same compact `proteum-mcp-v1` runtime/diagnostic contract
|
|
525
564
|
- the profiler `Explain`, `Doctor`, `Diagnose`, and `Perf` tabs for a human-readable view over the same diagnostics and trace-derived perf contracts
|
|
526
565
|
- `proteum command ...` plus the profiler `Commands` tab for dev-only internal execution
|
|
527
566
|
- `proteum session ...` for explicit authenticated dev browser or API bootstrapping without login UI automation
|
|
@@ -529,16 +568,15 @@ Proteum answers those questions with explicit artifacts:
|
|
|
529
568
|
|
|
530
569
|
If you are an LLM or automation agent, start here:
|
|
531
570
|
|
|
532
|
-
1.
|
|
533
|
-
2. Read
|
|
534
|
-
3.
|
|
535
|
-
4.
|
|
536
|
-
5.
|
|
537
|
-
6. Inspect `server/services
|
|
538
|
-
7.
|
|
539
|
-
8. If the task touches a protected route or controller in dev and login UX is not the feature under test, use `proteum e2e --session-email <email> --session-role <role>` for Playwright suites or `proteum session <email> --role <role>` before direct HTTP calls.
|
|
571
|
+
1. Run `proteum orient <query>` or MCP `orient` before broad source reads.
|
|
572
|
+
2. Read only the returned `instructions.mustRead` files, plus conditional docs for diagnostics, coding style, or optimization when they apply.
|
|
573
|
+
3. Run `proteum runtime status` once before starting a dev server; use MCP `runtime_status` for repeated status reads.
|
|
574
|
+
4. Use `proteum diagnose`, `proteum perf`, and compact `proteum trace` for reproducible command evidence.
|
|
575
|
+
5. Use `proteum mcp --url <dev-url>` or `/__proteum/mcp` for repeated live status, instruction, diagnose, trace, perf, and log reads.
|
|
576
|
+
6. Inspect `server/index.ts`, controllers, services, or pages only after the routing/diagnostic surfaces identify the relevant owner.
|
|
577
|
+
7. If the task touches a protected route or controller in dev and login UX is not the feature under test, use `proteum e2e --session-email <email> --session-role <role>` for Playwright suites or `proteum session <email> --role <role>` before direct HTTP calls.
|
|
540
578
|
|
|
541
|
-
For implementation rules in a real Proteum app, treat the local `AGENTS.md` files plus `proteum
|
|
579
|
+
For implementation rules in a real Proteum app, treat the routed local `AGENTS.md` files plus `proteum orient`, compact CLI diagnostics, and MCP repeated-read surfaces as the task contract. This README is the framework overview, not the project-local instruction layer.
|
|
542
580
|
|
|
543
581
|
## What Proteum Avoids
|
|
544
582
|
|
package/agents/project/AGENTS.md
CHANGED
|
@@ -23,6 +23,9 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
23
23
|
- re-print the complete list of suggested fixes, but strike the ones we already implemented or not necessary anymore
|
|
24
24
|
- If the user asks to implement a feature, first inspect the relevant existing surface and state any implementation problem, pain point, attention point, or question you see. If a concern is blocking, or it can materially change product behavior, API shape, architecture, data model, cost, privacy, security, or UX, ask before editing; otherwise state the assumption and continue implementing.
|
|
25
25
|
- If the task is ambiguous, generated, connected, or multi-repo, start with `npx proteum orient <query>` before reading large parts of the codebase.
|
|
26
|
+
- Treat Proteum CLI and MCP output as the workflow router. Read only the instruction files returned in `orient` `mustRead` or MCP `instructions_resolve`, plus conditional docs that match the current task. Do not read broad instruction folders or every managed instruction file up front.
|
|
27
|
+
- When a Proteum MCP client is available, prefer read-only MCP tools for repeated runtime/status/orientation/trace/perf/log reads. Use CLI commands when you need reproducible terminal validation, dev/build/check workflows, or output to share with a human.
|
|
28
|
+
- MCP payloads are compact single-line `proteum-mcp-v1` JSON with capped and paginated detail. Do not expand MCP output for human readability.
|
|
26
29
|
- If the user reports an issue, or the agent encounters one during exploration, implementation, verification, or runtime reproduction, load and follow root-level `diagnostics.md`.
|
|
27
30
|
- If the task touches client-side files, especially `client/**` and page files, load and apply root-level `optimizations.md` only after implementation for post-implementation checking and optimization. Skip it at task start and skip it for server-only, test-only, doc-only, and non-client refactor tasks unless the user explicitly asks for optimization work.
|
|
28
31
|
- If the task changes UX, copy, onboarding, pricing, product semantics, or commercial positioning, read the relevant files under `./docs/` first, especially `docs/PERSONAS.md`, `docs/PRODUCT.md`, and `docs/MARKETING.md` when they exist. If a dev server is already running, print the live dev server URL as a clickable Markdown link.
|
|
@@ -57,6 +60,7 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
57
60
|
- When starting a long-lived dev server for an agent task, always request elevated permissions and run `npx proteum dev` outside the sandbox. Use an explicit task/thread-scoped session file such as `var/run/proteum/dev/agents/<task>.json`, inspect `npx proteum dev list --json` plus current listeners first, for example with `lsof -nP -iTCP -sTCP:LISTEN`, then choose a port that is not currently used before starting `npx proteum dev --session-file <path> --port <port>`. After the server is ready, print the live server URL as a clickable Markdown link.
|
|
58
61
|
- Use `--replace-existing` only when restarting the exact session file started by the current thread/task. Never replace another live session that belongs to a user, another thread, or an unknown owner.
|
|
59
62
|
- If the current app depends on local `file:` connected projects, boot every connected producer app too, each with its own task-scoped session file and free port, and run every one of those `proteum dev` processes with elevated permissions outside the sandbox before starting or verifying the consumer app.
|
|
63
|
+
- During `npx proteum dev`, the app exposes the read-only Proteum MCP runtime endpoint at `/__proteum/mcp`; use it for repeated agent reads instead of spawning equivalent diagnostics commands.
|
|
60
64
|
- For browser validation, use the browser MCP against the running app. Keep Playwright inside `npx proteum e2e --port <port>` for targeted/full end-to-end suites. Bootstrap protected browser MCP state with `npx proteum session`; bootstrap protected E2E runs with `npx proteum e2e --session-email <email> --session-role <role>`.
|
|
61
65
|
- Current CLI banner contract: only the bare `proteum build` and bare `proteum dev` commands print the welcome banner and include the active Proteum installation method. Any extra argument or option skips the banner. Only `proteum dev` clears the interactive terminal before rendering, exposes `CTRL+R` reload plus `CTRL+C` shutdown hotkeys in its session UI, and reports connected app names plus successful connected `/ping` checks in the ready banner. Every `proteum dev` start ensures tracked instruction files contain the current managed `# Proteum Instructions` section before the dev loop begins.
|
|
62
66
|
|
|
@@ -272,19 +276,24 @@ Project code should consume:
|
|
|
272
276
|
|
|
273
277
|
Prefer structured CLI surfaces over re-deriving framework facts from source:
|
|
274
278
|
|
|
275
|
-
- `npx proteum connect
|
|
279
|
+
- `npx proteum connect`
|
|
276
280
|
- `npx proteum connect --controllers --strict`
|
|
277
281
|
- `npx proteum orient <query>`
|
|
278
|
-
- `npx proteum
|
|
282
|
+
- `npx proteum runtime status`
|
|
283
|
+
- `npx proteum mcp`
|
|
284
|
+
- `npx proteum mcp --url http://localhost:<port>`
|
|
285
|
+
- `npx proteum explain`
|
|
286
|
+
- `npx proteum explain --manifest`
|
|
279
287
|
- `npx proteum explain --connected --controllers`
|
|
280
288
|
- `npx proteum explain owner <query>`
|
|
281
|
-
- `npx proteum doctor
|
|
282
|
-
- `npx proteum doctor --contracts
|
|
289
|
+
- `npx proteum doctor`
|
|
290
|
+
- `npx proteum doctor --contracts`
|
|
283
291
|
- `npx proteum diagnose <path> --port <port>`
|
|
284
292
|
- `npx proteum verify owner <query>`
|
|
285
293
|
- `npx proteum verify request <path>`
|
|
286
294
|
- `npx proteum perf ...`
|
|
287
|
-
- `npx proteum trace
|
|
295
|
+
- `npx proteum trace latest`
|
|
296
|
+
- `npx proteum trace show <requestId> --events`
|
|
288
297
|
- `npx proteum command ...`
|
|
289
298
|
- `npx proteum session ...`
|
|
290
299
|
- `npx proteum create ... --dry-run --json`
|
|
@@ -306,3 +315,32 @@ Edit these only when required, and keep changes minimal and explicit:
|
|
|
306
315
|
- `PORT`, `ENV_*`, `URL`, `TRACE_*`, and `ENABLE_PROFILER` env setup
|
|
307
316
|
- Prisma-generated files
|
|
308
317
|
- symbolic links
|
|
318
|
+
|
|
319
|
+
## Delivery Workflow
|
|
320
|
+
|
|
321
|
+
Agents working in generated Proteum projects must use this delivery workflow for production code changes:
|
|
322
|
+
|
|
323
|
+
1. BDD / ATDD: translate the requested behavior into acceptance scenarios before changing implementation code.
|
|
324
|
+
2. TDD: write or update the smallest failing unit/integration test that proves the next behavior.
|
|
325
|
+
3. Implementation: make the narrowest production change that satisfies the failing test while preserving Proteum boundaries.
|
|
326
|
+
4. Proteum check: refresh and validate generated framework contracts after route, page, controller, service, command, or config changes.
|
|
327
|
+
5. Validate unit + E2E: run the relevant unit tests and real-world journey E2E checks before calling the work complete.
|
|
328
|
+
|
|
329
|
+
Unit test expectation: production package and service logic should target 100% meaningful unit coverage for touched behavior. Any excluded generated files, migrations, framework shims, or unreachable defensive branches must be documented in the completion note.
|
|
330
|
+
|
|
331
|
+
E2E expectation: real-world journeys must follow the project-local instructions in `tests/e2e/REAL_WORLD_JOURNEY_TESTS.md`. These tests should model complete user workflows, role transitions, permissions, state changes, and cross-view consistency rather than isolated happy paths.
|
|
332
|
+
|
|
333
|
+
Recommended validation sequence:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
npm run refresh
|
|
337
|
+
npm run typecheck
|
|
338
|
+
npm run lint
|
|
339
|
+
npm run test
|
|
340
|
+
npm run test:integration
|
|
341
|
+
npx proteum check
|
|
342
|
+
npx proteum doctor --contracts --strict
|
|
343
|
+
npx proteum e2e --port <port>
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
When bundling, SSR, server startup, routing, or build-time behavior changes, also run the project build command before finishing.
|
|
@@ -4,7 +4,10 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
4
4
|
|
|
5
5
|
## Initial Triage
|
|
6
6
|
|
|
7
|
-
- Start with machine-readable app state before reading large parts of the codebase: `npx proteum orient <query>`,
|
|
7
|
+
- Start with compact machine-readable app state before reading large parts of the codebase: `npx proteum orient <query>`, `npx proteum runtime status`, `npx proteum connect`, `npx proteum explain`, `npx proteum doctor`, and `npx proteum doctor --contracts` when generated artifacts or manifest-owned files may be stale.
|
|
8
|
+
- When a Proteum MCP client is available, prefer MCP `runtime_status`, `orient`, `instructions_resolve`, `diagnose`, `trace_latest`, `perf_top`, `perf_request`, and `logs_tail` for repeated reads of the same app/runtime state. Use compact CLI commands when you need a reproducible shell command, validation step, or CI-like output.
|
|
9
|
+
- MCP payloads are compact `proteum-mcp-v1` JSON and are capped/paginated by default. Do not request full detail until compact output identifies the missing data.
|
|
10
|
+
- Use full-detail escape hatches only after compact output identifies the missing detail: `npx proteum explain --manifest`, `npx proteum diagnose <target> --full`, `npx proteum trace show <requestId> --events`, or `npx proteum perf request <requestId> --full`.
|
|
8
11
|
- When the user pastes raw errors, reproduce locally before listing possible causes: identify the likely app, route, command, or request target from the error, boot or reuse the relevant dev server with the elevated-permissions workflow below, replay the failing surface once, and base the probability/why/how-to-fix list on local server output, browser console output, diagnostics, traces, or the smallest relevant command result. If there is not enough information to reproduce, state the missing context and ground the cause list in the local evidence that is available.
|
|
9
12
|
- When one app depends on another app's generated controllers, inspect `npx proteum connect --controllers`, `npx proteum explain --connected --controllers`, the producer `proteum.connected.json`, the consumer `proteum.config.ts` connected `source` value, and the producer `./.proteum/proteum.connected.d.ts` before assuming the contract is local.
|
|
10
13
|
- Use `rg -n` first to narrow the exact code path, then read only the relevant files.
|
|
@@ -16,6 +19,7 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
16
19
|
- For long-lived dev reproductions, always request elevated permissions and run `npx proteum dev` outside the sandbox. Use an explicit task/thread-scoped session file, inspect `npx proteum dev list --json` plus current listeners first, for example with `lsof -nP -iTCP -sTCP:LISTEN`, then choose a port that is not currently used before starting `npx proteum dev --session-file <path> --port <port>`. After the server is ready, print the live server URL as a clickable Markdown link.
|
|
17
20
|
- Use `--replace-existing` only when restarting the exact session file started by the current thread/task. Never replace another live session that belongs to a user, another thread, or an unknown owner.
|
|
18
21
|
- Only the bare `npx proteum build` and bare `npx proteum dev` commands print the welcome banner and active Proteum installation method. Any extra argument or option skips the banner. Only `npx proteum dev` clears the interactive terminal before rendering and reports connected app names plus successful connected `/ping` checks in the ready banner; keep that in mind when capturing or comparing command logs during diagnosis. Every `npx proteum dev` start ensures tracked instruction files contain the current managed `# Proteum Instructions` section before the dev loop begins.
|
|
22
|
+
- During `npx proteum dev`, the running app exposes the read-only Proteum MCP transport at `/__proteum/mcp`. Use it for runtime-adjacent agent reads instead of repeatedly spawning equivalent CLI diagnostics.
|
|
19
23
|
- For ownership or repo discovery questions, start with `npx proteum orient <query>` instead of jumping straight into source searches.
|
|
20
24
|
- For request-time issues in dev, start with `npx proteum diagnose <path> --port <port>` when you have a concrete failing route, page, controller path, or request target. It combines owner lookup, manifest diagnostics, contract diagnostics, matching trace data, and buffered server logs in one pass.
|
|
21
25
|
- Prefer focused verification before global checks: `npx proteum verify owner <query>`, `npx proteum verify request <path>`, and only then browser MCP validation when the bug is browser-visible. Use `npx proteum e2e --port <port> ...` only when automated end-to-end coverage or a Playwright suite is required.
|
|
@@ -26,7 +30,7 @@ This file is the canonical source of truth for diagnostics, temporary instrument
|
|
|
26
30
|
- For bundle-size inspection, use `npx proteum build --prod --analyze` to emit `bin/bundle-analysis/client.html` and `client-stats.json`, or add `--analyze-serve --analyze-port auto` when you want a local analyzer URL instead of a static HTML file.
|
|
27
31
|
- For request-time issues in dev, inspect traces before adding logs when the diagnose surface is still too coarse.
|
|
28
32
|
- If a server is already running on the default port from `PORT` or `./.proteum/manifest.json`, inspect existing traces before reproducing the issue.
|
|
29
|
-
- If existing traces are insufficient, arm `npx proteum trace arm --capture deep`, reproduce once, then inspect the new request with `npx proteum trace latest
|
|
33
|
+
- If existing traces are insufficient, arm `npx proteum trace arm --capture deep`, reproduce once, then inspect the new request with compact `npx proteum trace latest`; use `npx proteum trace show <requestId> --events` only when raw event detail is still required.
|
|
30
34
|
- Use the browser MCP to inspect browser console errors and warnings for frontend, SSR, hydration, and controller-call issues.
|
|
31
35
|
- Inspect server startup and runtime errors.
|
|
32
36
|
- For protected browser or API flows in dev, prefer `npx proteum session <email> --role <role>` over driving the login UI, then use that session for browser MCP validation. Use `npx proteum e2e --session-email <email> --session-role <role>` only when Playwright end-to-end suites need the auth token through the child process environment. Use the login UI only when auth UX itself is under test.
|
|
@@ -19,6 +19,7 @@ When tradeoffs exist inside optimization work, optimize in this order:
|
|
|
19
19
|
- Prefer established, flexible, well-typed, widely adopted, actively maintained packages.
|
|
20
20
|
- Build custom or keep custom infrastructure only when packages would clearly hurt bundle size, SSR behavior, performance, typing quality, flexibility, licensing, explicit contracts, or long-term maintainability.
|
|
21
21
|
- If you choose custom over a package, state briefly why.
|
|
22
|
+
- For agent-facing repeated diagnostics, prefer the read-only Proteum MCP surface over adding broader CLI output. MCP should expose compact single-line `proteum-mcp-v1` JSON with capped, typed, paginated reads; the CLI should stay compact and reproducible.
|
|
22
23
|
|
|
23
24
|
## SSR And Page Size
|
|
24
25
|
|
|
@@ -14,6 +14,9 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
14
14
|
- If the user pastes raw errors without asking for a fix, do not implement changes yet. First run the task-safe local reproduction path: identify the likely app, route, command, or request from the error, boot or reuse the relevant dev server with the elevated-permissions workflow in `Task Lifecycle`, reproduce the failing surface locally, and inspect server output, browser console output, diagnostics, traces, or the smallest relevant command result. If the error does not identify enough context to reproduce, say what is missing and use the available local evidence before guessing. Then list likely causes and, for each one, give probability, why, and how to fix it.
|
|
15
15
|
- If the user asks to implement a feature, first inspect the relevant existing surface and state any implementation problem, pain point, attention point, or question you see. If a concern is blocking, or it can materially change product behavior, API shape, architecture, data model, cost, privacy, security, or UX, ask before editing; otherwise state the assumption and continue implementing.
|
|
16
16
|
- If the task is ambiguous, generated, connected, or multi-repo, start with `npx proteum orient <query>` before reading large parts of the codebase.
|
|
17
|
+
- Treat Proteum CLI and MCP output as the workflow router. Read only the instruction files returned in `orient` `mustRead` or MCP `instructions_resolve`, plus conditional docs that match the current task. Do not read broad instruction folders or every managed instruction file up front.
|
|
18
|
+
- When a Proteum MCP client is available, prefer read-only MCP tools for repeated runtime/status/orientation/trace/perf/log reads. Use CLI commands when you need reproducible terminal validation, dev/build/check workflows, or output to share with a human.
|
|
19
|
+
- MCP payloads are compact single-line `proteum-mcp-v1` JSON with capped and paginated detail. Do not expand MCP output for human readability.
|
|
17
20
|
- If the user reports an issue, or the agent encounters one during exploration, implementation, verification, or runtime reproduction, load and follow root-level `diagnostics.md`.
|
|
18
21
|
- If the task touches client-side files, especially `client/**` and page files, load and apply root-level `optimizations.md` only after implementation for post-implementation checking and optimization. Skip it at task start and skip it for server-only, test-only, doc-only, and non-client refactor tasks unless the user explicitly asks for optimization work.
|
|
19
22
|
- If the task needs new app or artifact boilerplate, prefer `npx proteum init ...` and `npx proteum create ...` before creating files by hand. Use `--dry-run --json` when an agent needs a machine-readable plan before writing files.
|
|
@@ -47,6 +50,7 @@ Coding style source of truth: root-level `CODING_STYLE.md`.
|
|
|
47
50
|
- When starting a long-lived dev server for an agent task, always request elevated permissions and run `npx proteum dev` outside the sandbox. Use an explicit task/thread-scoped session file such as `var/run/proteum/dev/agents/<task>.json`, inspect `npx proteum dev list --json` plus current listeners first, for example with `lsof -nP -iTCP -sTCP:LISTEN`, then choose a port that is not currently used before starting `npx proteum dev --session-file <path> --port <port>`. After the server is ready, print the live server URL as a clickable Markdown link.
|
|
48
51
|
- Use `--replace-existing` only when restarting the exact session file started by the current thread/task. Never replace another live session that belongs to a user, another thread, or an unknown owner.
|
|
49
52
|
- If the current app depends on local `file:` connected projects, boot every connected producer app too, each with its own task-scoped session file and free port, and run every one of those `proteum dev` processes with elevated permissions outside the sandbox before starting or verifying the consumer app.
|
|
53
|
+
- During `npx proteum dev`, the app exposes the read-only Proteum MCP runtime endpoint at `/__proteum/mcp`; use it for repeated agent reads instead of spawning equivalent diagnostics commands.
|
|
50
54
|
- For browser validation, use the browser MCP against the running app. Keep Playwright inside `npx proteum e2e --port <port>` for targeted/full end-to-end suites. Bootstrap protected browser MCP state with `npx proteum session`; bootstrap protected E2E runs with `npx proteum e2e --session-email <email> --session-role <role>`.
|
|
51
55
|
- Current CLI banner contract: only the bare `proteum build` and bare `proteum dev` commands print the welcome banner and include the active Proteum installation method. Any extra argument or option skips the banner. Only `proteum dev` clears the interactive terminal before rendering, exposes `CTRL+R` reload plus `CTRL+C` shutdown hotkeys in its session UI, and reports connected app names plus successful connected `/ping` checks in the ready banner. Every `proteum dev` start ensures tracked instruction files contain the current managed `# Proteum Instructions` section before the dev loop begins.
|
|
52
56
|
|
|
@@ -262,19 +266,24 @@ Project code should consume:
|
|
|
262
266
|
|
|
263
267
|
Prefer structured CLI surfaces over re-deriving framework facts from source:
|
|
264
268
|
|
|
265
|
-
- `npx proteum connect
|
|
269
|
+
- `npx proteum connect`
|
|
266
270
|
- `npx proteum connect --controllers --strict`
|
|
267
271
|
- `npx proteum orient <query>`
|
|
268
|
-
- `npx proteum
|
|
272
|
+
- `npx proteum runtime status`
|
|
273
|
+
- `npx proteum mcp`
|
|
274
|
+
- `npx proteum mcp --url http://localhost:<port>`
|
|
275
|
+
- `npx proteum explain`
|
|
276
|
+
- `npx proteum explain --manifest`
|
|
269
277
|
- `npx proteum explain --connected --controllers`
|
|
270
278
|
- `npx proteum explain owner <query>`
|
|
271
|
-
- `npx proteum doctor
|
|
272
|
-
- `npx proteum doctor --contracts
|
|
279
|
+
- `npx proteum doctor`
|
|
280
|
+
- `npx proteum doctor --contracts`
|
|
273
281
|
- `npx proteum diagnose <path> --port <port>`
|
|
274
282
|
- `npx proteum verify owner <query>`
|
|
275
283
|
- `npx proteum verify request <path>`
|
|
276
284
|
- `npx proteum perf ...`
|
|
277
|
-
- `npx proteum trace
|
|
285
|
+
- `npx proteum trace latest`
|
|
286
|
+
- `npx proteum trace show <requestId> --events`
|
|
278
287
|
- `npx proteum command ...`
|
|
279
288
|
- `npx proteum session ...`
|
|
280
289
|
- `npx proteum create ... --dry-run --json`
|
|
@@ -23,3 +23,9 @@ Diagnostics source of truth: root-level `diagnostics.md`.
|
|
|
23
23
|
- Keep end-to-end tests clean, well organized, and non-redundant. Prefer extending or reshaping the most relevant existing scenario over duplicating coverage, and remove or consolidate overlap when the suite becomes repetitive.
|
|
24
24
|
- Reuse root catalog files from `/client/catalogs/**`, `/server/catalogs/**`, or `/common/catalogs/**` instead of duplicating catalog constants in tests.
|
|
25
25
|
- For protected dev flows, prefer `npx proteum e2e --session-email <email> --session-role <role>` or `npx proteum session <email> --role <role>` over automating login unless the login flow itself is under test.
|
|
26
|
+
|
|
27
|
+
### Real-World Journey E2E
|
|
28
|
+
|
|
29
|
+
End-to-end tests must follow the workflow in `tests/e2e/REAL_WORLD_JOURNEY_TESTS.md`.
|
|
30
|
+
|
|
31
|
+
Use E2E journeys for complete role-based flows, permissions, state transitions, derived metrics, filters, detail/edit surfaces, and cross-role visibility. Avoid replacing those journeys with isolated happy-path smoke checks when the feature has real workflow depth.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# E2E Journey Test Instructions
|
|
2
|
+
|
|
3
|
+
Follow `REAL_WORLD_JOURNEY_TESTS.md` in this directory when designing, implementing, extending, or reviewing end-to-end tests.
|
|
4
|
+
|
|
5
|
+
Required structure for substantial E2E work:
|
|
6
|
+
|
|
7
|
+
- `tests/e2e/journeys/`: real-world journey specs grouped by workflow or domain.
|
|
8
|
+
- `tests/e2e/pages/`: page objects or screen helpers that keep selectors stable.
|
|
9
|
+
- `tests/e2e/workflows/`: reusable multi-step role and business workflows.
|
|
10
|
+
- `tests/e2e/factories/`: deterministic test data builders and fixtures.
|
|
11
|
+
- `tests/e2e/utils/`: login, navigation, assertions, network, and cleanup helpers.
|
|
12
|
+
|
|
13
|
+
Do not reduce E2E coverage to one-screen smoke tests when the feature involves multiple roles, permissions, workflow states, derived KPIs, or cross-view consistency.
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Write Real World Journey Tests
|
|
2
|
+
|
|
3
|
+
Source: `/Users/gaetan/.codex/skills/write-real-world-journey-tests/SKILL.md`
|
|
4
|
+
|
|
5
|
+
## Goal
|
|
6
|
+
|
|
7
|
+
Create journey tests that read like an executable product spec. Prefer a realistic sequence of actions by real roles over a collection of disconnected UI checks.
|
|
8
|
+
|
|
9
|
+
The journey should cover the requested feature area broadly, but every step must be justified by normal user behavior and by state created earlier in the journey.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
1. Inspect the feature surface before designing the test.
|
|
14
|
+
- Read existing journey tests, page objects, factories, workflows, fixtures, selectors, and test utilities.
|
|
15
|
+
- Identify local conventions for auth, data creation, navigation, assertions, cleanup, retries, and timeouts.
|
|
16
|
+
- Reuse existing helpers before adding new ones.
|
|
17
|
+
- Preserve the repository's test-file organization instead of putting every helper inside the journey spec.
|
|
18
|
+
|
|
19
|
+
2. Follow the local E2E file organization.
|
|
20
|
+
- Put complete user journeys in `tests/e2e/journeys/*.spec.ts` or the repository's equivalent journey/spec directory.
|
|
21
|
+
- Put reusable screen abstractions in `tests/e2e/pages/**`, grouped by product area; use focused page objects for pages, modals, filter bars, pickers, and detail panels.
|
|
22
|
+
- Put reusable multi-step business flows in `tests/e2e/workflows/**`, such as login, signup via invite, create entity with invite link, or other flows shared by several journeys.
|
|
23
|
+
- Put generated domain data in `tests/e2e/factories/**`, with separate minimum, maximum, and edited payload factories when the journey needs create/edit coverage.
|
|
24
|
+
- Put shared technical/domain helpers in `tests/e2e/utils/**`, such as context creation, constants, API response parsing, date formatting, KPI expectations, number/currency parsers, display-name builders, and journey tree logging.
|
|
25
|
+
- Add a helper to the nearest existing page/workflow/factory/utils module when it is reusable; keep it local to the spec only when it is specific to that one journey's memory or assertions.
|
|
26
|
+
|
|
27
|
+
3. Map the real-world story.
|
|
28
|
+
- List the roles involved, their permissions, and why each role appears in the scenario.
|
|
29
|
+
- Identify the entities that move through the journey: account, team, organization, customer, order, lead, report, subscription, etc.
|
|
30
|
+
- Define the natural order: setup, invite/signup/login, empty state, creation, assignment, action by another role, management, reporting, audit/review.
|
|
31
|
+
- Prefer one coherent story over feature stuffing. Cover many features only when they belong to the same user journey.
|
|
32
|
+
|
|
33
|
+
4. Make the report-visible hierarchy explicit.
|
|
34
|
+
- Group journeys with `describe` blocks or the framework equivalent by business phase, such as acquisition, activation, setup, core workflow, limits, billing, and admin review.
|
|
35
|
+
- Split each journey test into named substeps with `test.step(...)`, Cypress command logs, or the local framework equivalent so CI reports and traces show what business phase failed.
|
|
36
|
+
- Name steps from the user or business perspective, such as `Launch plan blocks the third filter`, not from implementation details, such as `Click button`.
|
|
37
|
+
- Use nested substeps for repeated matrices like roles, plans, permissions, limits, or locales, with one visible step per case and smaller substeps for settings, allowed actions, and blocked actions.
|
|
38
|
+
- Preserve local file organization and helper conventions; hierarchy should improve readability without moving unrelated code or hiding assertions.
|
|
39
|
+
|
|
40
|
+
5. Use serial state only for real dependency chains.
|
|
41
|
+
- Use a serial describe block when later tests intentionally depend on state created by earlier actors.
|
|
42
|
+
- Split the journey into tests by actor/session or meaningful product phase.
|
|
43
|
+
- Use fresh browser contexts or sessions for different roles.
|
|
44
|
+
- Keep setup assertions at the top of each dependent test so failures explain the missing prerequisite.
|
|
45
|
+
|
|
46
|
+
6. Keep journey memory as the source of truth.
|
|
47
|
+
- Store created IDs, invite links, generated users, current payloads, assignment state, statuses, dates, and monetary values in typed in-memory objects.
|
|
48
|
+
- Update memory immediately after successful UI/API responses.
|
|
49
|
+
- Compute expectations from memory instead of duplicating constants in assertions.
|
|
50
|
+
- Track both `createdPayload` and `currentPayload` when edits are part of the journey.
|
|
51
|
+
|
|
52
|
+
7. Assert the product contract at each phase.
|
|
53
|
+
- Empty states and initial KPIs for new users.
|
|
54
|
+
- Role-specific navigation, tabs, menu labels, and restricted access.
|
|
55
|
+
- Created rows/cards/details match generated input.
|
|
56
|
+
- Default ownership, assignment, channel/source, payment terms, status, or permission behavior.
|
|
57
|
+
- Cross-role visibility after another role acts.
|
|
58
|
+
- Details modals, edit flows, notes/activity timelines, status changes, derived fields, filters, date ranges, and aggregate KPIs.
|
|
59
|
+
- Final manager/admin review across the whole organization or feature scope.
|
|
60
|
+
|
|
61
|
+
8. Make derived assertions resilient.
|
|
62
|
+
- Use polling for eventually consistent UI totals, KPI cards, async table updates, revenue/pipeline calculations, closing rates, and status text.
|
|
63
|
+
- Parse formatted numbers, currency, and percentages with shared utilities.
|
|
64
|
+
- Use deterministic date helpers for UI date formatting and date-range assertions.
|
|
65
|
+
- Wait for important create/update responses when IDs or persistence are needed.
|
|
66
|
+
|
|
67
|
+
9. Prefer expressive helpers.
|
|
68
|
+
- Introduce small helpers for repeated domain assertions, such as row basics, row KPI checks, snapshot comparison, filter setup, and derived totals.
|
|
69
|
+
- Keep helper names product-facing, not implementation-facing.
|
|
70
|
+
- Use page objects and workflow helpers to keep the test readable at the story level.
|
|
71
|
+
|
|
72
|
+
10. Log or snapshot the journey shape when useful.
|
|
73
|
+
- For long multi-role journeys, optionally keep a small tree or timeline logger showing created roles and entities.
|
|
74
|
+
- Use it for debugging and readability, not as a substitute for assertions.
|
|
75
|
+
|
|
76
|
+
## Implementation Pattern
|
|
77
|
+
|
|
78
|
+
Use this shape as a guide, adapting to the repository's test framework:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
test.describe.serial('Domain - Feature journey', () => {
|
|
82
|
+
test.describe.configure({ timeout: 300_000 });
|
|
83
|
+
|
|
84
|
+
let organization = createEmptyOrganizationMemory();
|
|
85
|
+
let manager = createEmptyAccountMemory();
|
|
86
|
+
let operator = createEmptyAccountMemory();
|
|
87
|
+
let externalPartner = createEmptyPartnerMemory();
|
|
88
|
+
let itemA = createItemMemory(createMinimumPayload(), { type: 'operator' });
|
|
89
|
+
let itemB = createItemMemory(createMaximumPayload(), { type: 'external-partner' });
|
|
90
|
+
|
|
91
|
+
const getCreatedItems = () => [itemA, itemB].filter((item) => item.id);
|
|
92
|
+
const buildKpis = () => ({
|
|
93
|
+
'Total Items': getCreatedItems().length,
|
|
94
|
+
'Completed': getCreatedItems().filter((item) => item.status === 'Completed').length,
|
|
95
|
+
});
|
|
96
|
+
const matrixCases = [{ name: 'Manager' }, { name: 'Operator' }];
|
|
97
|
+
|
|
98
|
+
test.describe('Setup and activation', () => {
|
|
99
|
+
test('Admin or owner creates the parent scope', async ({ browser }) => {
|
|
100
|
+
await test.step('Create the organization through the normal product path', async () => {
|
|
101
|
+
// Store IDs, invite links, and display data in memory.
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test('Manager signs up and prepares the working structure', async ({ browser }) => {
|
|
106
|
+
await test.step('Assert restricted navigation and empty state', async () => {});
|
|
107
|
+
await test.step('Create the team and invite the next role', async () => {});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test.describe('Core workflow', () => {
|
|
112
|
+
test('Primary role performs the core workflow and delegates work', async ({ browser }) => {
|
|
113
|
+
await test.step('Create a minimum item', async () => {});
|
|
114
|
+
await test.step('Assert default ownership and visible table state', async () => {});
|
|
115
|
+
await test.step('Delegate the item to another role', async () => {});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('Secondary role acts on assigned state', async ({ browser }) => {
|
|
119
|
+
await test.step('Assert this role only sees assigned work', async () => {});
|
|
120
|
+
await test.step('Create or update a maximum-data item', async () => {});
|
|
121
|
+
await test.step('Assert role-specific defaults and KPIs', async () => {});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('Primary role manages resulting activity', async ({ browser }) => {
|
|
125
|
+
await test.step('Open details and validate data from the secondary role', async () => {});
|
|
126
|
+
await test.step('Add notes, edit fields, and change status', async () => {});
|
|
127
|
+
await test.step('Assert recalculated derived values', async () => {});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test.describe('Review and reporting', () => {
|
|
132
|
+
test('Manager or auditor reviews aggregate state', async ({ browser }) => {
|
|
133
|
+
await test.step('Assert cross-role visibility and filters', async () => {});
|
|
134
|
+
await test.step('Assert aggregate KPIs and final business outcomes', async () => {});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test('Plan, role, or permission matrix exposes the correct behavior', async ({ browser }) => {
|
|
138
|
+
for (const caseItem of matrixCases) {
|
|
139
|
+
await test.step(`${caseItem.name} shows the right settings and limits`, async () => {
|
|
140
|
+
await test.step(`${caseItem.name} settings match contract`, async () => {});
|
|
141
|
+
await test.step(`${caseItem.name} allowed actions succeed`, async () => {});
|
|
142
|
+
await test.step(`${caseItem.name} blocked actions fail with the expected reason`, async () => {});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Coverage Heuristics
|
|
151
|
+
|
|
152
|
+
Include a feature when it naturally belongs to the journey and creates a durable assertion later. Strong candidates:
|
|
153
|
+
|
|
154
|
+
- Invite/signup/login boundaries.
|
|
155
|
+
- Permission differences between roles.
|
|
156
|
+
- Empty state to populated state.
|
|
157
|
+
- Minimum-data and maximum-data creation paths.
|
|
158
|
+
- Assignment, reassignment, ownership, membership, or sharing.
|
|
159
|
+
- Details view, edit view, notes, activity history, and status changes.
|
|
160
|
+
- Derived totals, dashboards, reporting cards, and tables.
|
|
161
|
+
- Filters, search, date ranges, sorting, and snapshots.
|
|
162
|
+
- Cross-role consistency: what one actor creates, another actor sees or manages.
|
|
163
|
+
|
|
164
|
+
Exclude or move to narrower tests:
|
|
165
|
+
|
|
166
|
+
- Pure component styling.
|
|
167
|
+
- Exhaustive validation errors.
|
|
168
|
+
- Every filter permutation.
|
|
169
|
+
- Rare edge cases that interrupt the main story.
|
|
170
|
+
- Admin-only setup that is unrelated to the requested feature.
|
|
171
|
+
|
|
172
|
+
## Quality Bar
|
|
173
|
+
|
|
174
|
+
- The scenario should be explainable as a real customer workflow.
|
|
175
|
+
- Each role should do work that role would actually do.
|
|
176
|
+
- Assertions should prove business behavior, not only that buttons are clickable.
|
|
177
|
+
- Later assertions should depend on earlier created state.
|
|
178
|
+
- Names, IDs, and dates should be generated uniquely enough for shared test environments.
|
|
179
|
+
- The test should fail near the broken product behavior, with step names that explain the business phase.
|
|
180
|
+
- The test report should expose a clear hierarchy of phases, tests, and substeps so a reader can understand the journey without opening the source file.
|
|
181
|
+
- Comments should clarify product intent or non-obvious timing behavior, not narrate obvious code.
|
|
182
|
+
|
|
183
|
+
## Anti-Patterns
|
|
184
|
+
|
|
185
|
+
- One huge test with no actor boundaries.
|
|
186
|
+
- Flat journey tests with no report-visible phases or substeps.
|
|
187
|
+
- Serial dependency without explicit prerequisite assertions.
|
|
188
|
+
- Hardcoded duplicate KPI values that drift after edits.
|
|
189
|
+
- Creating data directly in the database when the product flow under test is creation, signup, invite, assignment, or editing.
|
|
190
|
+
- Covering unrelated features just to increase line count.
|
|
191
|
+
- Hiding flakiness with arbitrary sleeps instead of waiting on UI state, network responses, or polling derived values.
|
|
192
|
+
- Testing only the creator role when the feature's value appears through another role's visibility or management flow.
|
package/cli/commands/connect.ts
CHANGED
|
@@ -2,8 +2,9 @@ import cli from '..';
|
|
|
2
2
|
import Compiler from '../compiler';
|
|
3
3
|
import { readProteumManifest } from '../compiler/common/proteumManifest';
|
|
4
4
|
import { buildConnectResponse, renderConnectHuman } from '@common/dev/connect';
|
|
5
|
+
import { compactList, printAgentResponse, printJson, truncateForAgent } from '../utils/agentOutput';
|
|
5
6
|
|
|
6
|
-
const allowedConnectArgs = new Set(['controllers', 'json', 'strict']);
|
|
7
|
+
const allowedConnectArgs = new Set(['controllers', 'full', 'human', 'json', 'strict']);
|
|
7
8
|
|
|
8
9
|
const validateConnectArgs = () => {
|
|
9
10
|
const enabledArgs = Object.entries(cli.args)
|
|
@@ -19,6 +20,29 @@ const validateConnectArgs = () => {
|
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
22
|
|
|
23
|
+
const compactDiagnostic = (diagnostic: ReturnType<typeof buildConnectResponse>['diagnostics'][number]) => ({
|
|
24
|
+
level: diagnostic.level,
|
|
25
|
+
code: diagnostic.code,
|
|
26
|
+
message: truncateForAgent(diagnostic.message),
|
|
27
|
+
filepath: diagnostic.filepath,
|
|
28
|
+
sourceLocation: diagnostic.sourceLocation,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const compactProject = (project: ReturnType<typeof buildConnectResponse>['projects'][number]) => ({
|
|
32
|
+
namespace: project.namespace,
|
|
33
|
+
identityIdentifier: project.identityIdentifier,
|
|
34
|
+
identityName: project.identityName,
|
|
35
|
+
sourceKind: project.sourceKind,
|
|
36
|
+
sourceConfigured: project.sourceConfigured,
|
|
37
|
+
urlInternalConfigured: project.urlInternalConfigured,
|
|
38
|
+
urlInternal: project.urlInternal,
|
|
39
|
+
controllerCount: project.controllerCount,
|
|
40
|
+
cachedContractExists: project.cachedContractExists,
|
|
41
|
+
cachedContractFilepath: project.cachedContractFilepath,
|
|
42
|
+
typingMode: project.typingMode,
|
|
43
|
+
controllers: project.controllers ? compactList(project.controllers, 8) : undefined,
|
|
44
|
+
});
|
|
45
|
+
|
|
22
46
|
export const run = async (): Promise<void> => {
|
|
23
47
|
validateConnectArgs();
|
|
24
48
|
|
|
@@ -31,10 +55,22 @@ export const run = async (): Promise<void> => {
|
|
|
31
55
|
strict: cli.args.strict === true,
|
|
32
56
|
});
|
|
33
57
|
|
|
34
|
-
if (cli.args.
|
|
35
|
-
|
|
36
|
-
} else {
|
|
58
|
+
if (cli.args.full === true) {
|
|
59
|
+
printJson(response);
|
|
60
|
+
} else if (cli.args.human === true) {
|
|
37
61
|
console.log(renderConnectHuman(manifest, response));
|
|
62
|
+
} else {
|
|
63
|
+
printAgentResponse({
|
|
64
|
+
summary: `Connect: ${response.summary.connectedProjects} projects, ${response.summary.importedControllers} controllers, ${response.summary.errors} errors, ${response.summary.warnings} warnings`,
|
|
65
|
+
data: {
|
|
66
|
+
app: response.app,
|
|
67
|
+
summary: response.summary,
|
|
68
|
+
projects: response.projects.map(compactProject),
|
|
69
|
+
diagnostics: compactList(response.diagnostics, 10).map(compactDiagnostic),
|
|
70
|
+
totalDiagnostics: response.diagnostics.length,
|
|
71
|
+
},
|
|
72
|
+
fullDetailCommand: `proteum connect${cli.args.controllers === true ? ' --controllers' : ''} --full`,
|
|
73
|
+
});
|
|
38
74
|
}
|
|
39
75
|
|
|
40
76
|
if (cli.args.strict === true && response.diagnostics.length > 0) {
|