retestkit 1.4.1
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/.claude/commands/openspec/apply.md +23 -0
- package/.claude/commands/openspec/archive.md +27 -0
- package/.claude/commands/openspec/proposal.md +28 -0
- package/.gemini/commands/openspec/apply.toml +21 -0
- package/.gemini/commands/openspec/archive.toml +25 -0
- package/.gemini/commands/openspec/proposal.toml +26 -0
- package/.github/prompts/openspec-apply.prompt.md +22 -0
- package/.github/prompts/openspec-archive.prompt.md +26 -0
- package/.github/prompts/openspec-proposal.prompt.md +27 -0
- package/.github/workflows/release.yml +33 -0
- package/.kilocode/workflows/openspec-apply.md +17 -0
- package/.kilocode/workflows/openspec-archive.md +21 -0
- package/.kilocode/workflows/openspec-proposal.md +22 -0
- package/.mcp.json +23 -0
- package/.opencode/command/openspec-apply.md +25 -0
- package/.opencode/command/openspec-archive.md +28 -0
- package/.opencode/command/openspec-proposal.md +30 -0
- package/.roo/commands/openspec-apply.md +20 -0
- package/.roo/commands/openspec-archive.md +24 -0
- package/.roo/commands/openspec-proposal.md +25 -0
- package/.vscode/mcp.json +23 -0
- package/AGENTS.md +18 -0
- package/CLAUDE.md +18 -0
- package/LICENSE +65 -0
- package/README.md +303 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +27 -0
- package/dist/config.js.map +1 -0
- package/dist/elicitation/index.d.ts +17 -0
- package/dist/elicitation/index.d.ts.map +1 -0
- package/dist/elicitation/index.js +118 -0
- package/dist/elicitation/index.js.map +1 -0
- package/dist/elicitation/types.d.ts +35 -0
- package/dist/elicitation/types.d.ts.map +1 -0
- package/dist/elicitation/types.js +39 -0
- package/dist/elicitation/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/lifecycle/index.d.ts +31 -0
- package/dist/lifecycle/index.d.ts.map +1 -0
- package/dist/lifecycle/index.js +61 -0
- package/dist/lifecycle/index.js.map +1 -0
- package/dist/logger.d.ts +21 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +182 -0
- package/dist/logger.js.map +1 -0
- package/dist/playwright-client/index.d.ts +29 -0
- package/dist/playwright-client/index.d.ts.map +1 -0
- package/dist/playwright-client/index.js +288 -0
- package/dist/playwright-client/index.js.map +1 -0
- package/dist/playwright-client/types.d.ts +44 -0
- package/dist/playwright-client/types.d.ts.map +1 -0
- package/dist/playwright-client/types.js +49 -0
- package/dist/playwright-client/types.js.map +1 -0
- package/dist/progress/index.d.ts +39 -0
- package/dist/progress/index.d.ts.map +1 -0
- package/dist/progress/index.js +106 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/progress/types.d.ts +24 -0
- package/dist/progress/types.d.ts.map +1 -0
- package/dist/progress/types.js +2 -0
- package/dist/progress/types.js.map +1 -0
- package/dist/prompts/index.d.ts +19 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +207 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/loader.d.ts +20 -0
- package/dist/prompts/loader.d.ts.map +1 -0
- package/dist/prompts/loader.js +47 -0
- package/dist/prompts/loader.js.map +1 -0
- package/dist/resources/index.d.ts +27 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +186 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/subscriptions.d.ts +10 -0
- package/dist/resources/subscriptions.d.ts.map +1 -0
- package/dist/resources/subscriptions.js +23 -0
- package/dist/resources/subscriptions.js.map +1 -0
- package/dist/sampling/index.d.ts +11 -0
- package/dist/sampling/index.d.ts.map +1 -0
- package/dist/sampling/index.js +201 -0
- package/dist/sampling/index.js.map +1 -0
- package/dist/sampling/prompts.d.ts +56 -0
- package/dist/sampling/prompts.d.ts.map +1 -0
- package/dist/sampling/prompts.js +124 -0
- package/dist/sampling/prompts.js.map +1 -0
- package/dist/sampling/types.d.ts +57 -0
- package/dist/sampling/types.d.ts.map +1 -0
- package/dist/sampling/types.js +2 -0
- package/dist/sampling/types.js.map +1 -0
- package/dist/schemas/config.d.ts +40 -0
- package/dist/schemas/config.d.ts.map +1 -0
- package/dist/schemas/config.js +30 -0
- package/dist/schemas/config.js.map +1 -0
- package/dist/security/index.d.ts +38 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +281 -0
- package/dist/security/index.js.map +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +142 -0
- package/dist/server.js.map +1 -0
- package/dist/test-utils/index.d.ts +6 -0
- package/dist/test-utils/index.d.ts.map +1 -0
- package/dist/test-utils/index.js +6 -0
- package/dist/test-utils/index.js.map +1 -0
- package/dist/test-utils/mock-context.d.ts +64 -0
- package/dist/test-utils/mock-context.d.ts.map +1 -0
- package/dist/test-utils/mock-context.js +347 -0
- package/dist/test-utils/mock-context.js.map +1 -0
- package/dist/test-utils/mock-playwright-client.d.ts +62 -0
- package/dist/test-utils/mock-playwright-client.d.ts.map +1 -0
- package/dist/test-utils/mock-playwright-client.js +315 -0
- package/dist/test-utils/mock-playwright-client.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/webtest/crawl.d.ts +46 -0
- package/dist/tools/webtest/crawl.d.ts.map +1 -0
- package/dist/tools/webtest/crawl.js +678 -0
- package/dist/tools/webtest/crawl.js.map +1 -0
- package/dist/tools/webtest/discover-features.d.ts +30 -0
- package/dist/tools/webtest/discover-features.d.ts.map +1 -0
- package/dist/tools/webtest/discover-features.js +343 -0
- package/dist/tools/webtest/discover-features.js.map +1 -0
- package/dist/tools/webtest/discover-flows.d.ts +29 -0
- package/dist/tools/webtest/discover-flows.d.ts.map +1 -0
- package/dist/tools/webtest/discover-flows.js +341 -0
- package/dist/tools/webtest/discover-flows.js.map +1 -0
- package/dist/tools/webtest/generate-tests.d.ts +54 -0
- package/dist/tools/webtest/generate-tests.d.ts.map +1 -0
- package/dist/tools/webtest/generate-tests.js +364 -0
- package/dist/tools/webtest/generate-tests.js.map +1 -0
- package/dist/tools/webtest/index.d.ts +8 -0
- package/dist/tools/webtest/index.d.ts.map +1 -0
- package/dist/tools/webtest/index.js +8 -0
- package/dist/tools/webtest/index.js.map +1 -0
- package/dist/tools/webtest/run-test-case.d.ts +28 -0
- package/dist/tools/webtest/run-test-case.d.ts.map +1 -0
- package/dist/tools/webtest/run-test-case.js +420 -0
- package/dist/tools/webtest/run-test-case.js.map +1 -0
- package/dist/tools/webtest/schemas.d.ts +175 -0
- package/dist/tools/webtest/schemas.d.ts.map +1 -0
- package/dist/tools/webtest/schemas.js +156 -0
- package/dist/tools/webtest/schemas.js.map +1 -0
- package/dist/tools/webtest/start-analysis.d.ts +16 -0
- package/dist/tools/webtest/start-analysis.d.ts.map +1 -0
- package/dist/tools/webtest/start-analysis.js +137 -0
- package/dist/tools/webtest/start-analysis.js.map +1 -0
- package/dist/transports/http.d.ts +8 -0
- package/dist/transports/http.d.ts.map +1 -0
- package/dist/transports/http.js +9 -0
- package/dist/transports/http.js.map +1 -0
- package/dist/transports/index.d.ts +14 -0
- package/dist/transports/index.d.ts.map +1 -0
- package/dist/transports/index.js +20 -0
- package/dist/transports/index.js.map +1 -0
- package/dist/transports/stdio.d.ts +4 -0
- package/dist/transports/stdio.d.ts.map +1 -0
- package/dist/transports/stdio.js +6 -0
- package/dist/transports/stdio.js.map +1 -0
- package/dist/types/capabilities.d.ts +18 -0
- package/dist/types/capabilities.d.ts.map +1 -0
- package/dist/types/capabilities.js +35 -0
- package/dist/types/capabilities.js.map +1 -0
- package/dist/types/context.d.ts +20 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/types/context.js +2 -0
- package/dist/types/context.js.map +1 -0
- package/dist/types/tool.d.ts +10 -0
- package/dist/types/tool.d.ts.map +1 -0
- package/dist/types/tool.js +2 -0
- package/dist/types/tool.js.map +1 -0
- package/dist/workspace/index.d.ts +99 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +648 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/markdown.d.ts +50 -0
- package/dist/workspace/markdown.d.ts.map +1 -0
- package/dist/workspace/markdown.js +210 -0
- package/dist/workspace/markdown.js.map +1 -0
- package/dist/workspace/types.d.ts +173 -0
- package/dist/workspace/types.d.ts.map +1 -0
- package/dist/workspace/types.js +2 -0
- package/dist/workspace/types.js.map +1 -0
- package/openspec/AGENTS.md +456 -0
- package/openspec/changes/archive/2025-12-18-add-hybrid-artifact-paths/proposal.md +33 -0
- package/openspec/changes/archive/2025-12-18-add-hybrid-artifact-paths/specs/webtest-resources/spec.md +27 -0
- package/openspec/changes/archive/2025-12-18-add-hybrid-artifact-paths/specs/webtest-tools/spec.md +304 -0
- package/openspec/changes/archive/2025-12-18-add-hybrid-artifact-paths/tasks.md +43 -0
- package/openspec/changes/archive/2025-12-18-add-mcp-server-foundation/design.md +209 -0
- package/openspec/changes/archive/2025-12-18-add-mcp-server-foundation/proposal.md +41 -0
- package/openspec/changes/archive/2025-12-18-add-mcp-server-foundation/specs/mcp-server-core/spec.md +183 -0
- package/openspec/changes/archive/2025-12-18-add-mcp-server-foundation/tasks.md +112 -0
- package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/design.md +333 -0
- package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/proposal.md +66 -0
- package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/mcp-server-core/spec.md +129 -0
- package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-lifecycle/spec.md +138 -0
- package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-logging/spec.md +211 -0
- package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-prompts/spec.md +157 -0
- package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-resources/spec.md +213 -0
- package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-sampling/spec.md +257 -0
- package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-tools/spec.md +501 -0
- package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/tasks.md +264 -0
- package/openspec/changes/archive/2025-12-18-allow-analysis-of-incomplete-crawls/proposal.md +24 -0
- package/openspec/changes/archive/2025-12-18-allow-analysis-of-incomplete-crawls/specs/webtest-tools/spec.md +80 -0
- package/openspec/changes/archive/2025-12-18-allow-analysis-of-incomplete-crawls/tasks.md +8 -0
- package/openspec/changes/archive/2025-12-18-fix-crawl-loop-stability/design.md +90 -0
- package/openspec/changes/archive/2025-12-18-fix-crawl-loop-stability/proposal.md +28 -0
- package/openspec/changes/archive/2025-12-18-fix-crawl-loop-stability/specs/webtest-sampling/spec.md +90 -0
- package/openspec/changes/archive/2025-12-18-fix-crawl-loop-stability/tasks.md +33 -0
- package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/design.md +558 -0
- package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/proposal.md +119 -0
- package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/specs/webtest-resources/spec.md +109 -0
- package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/specs/webtest-tools/spec.md +121 -0
- package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/tasks.md +133 -0
- package/openspec/changes/extract-prompts-to-markdown/design.md +86 -0
- package/openspec/changes/extract-prompts-to-markdown/proposal.md +50 -0
- package/openspec/changes/extract-prompts-to-markdown/specs/webtest-prompts/spec.md +74 -0
- package/openspec/changes/extract-prompts-to-markdown/tasks.md +40 -0
- package/openspec/changes/refactor-webtest-naming/design.md +95 -0
- package/openspec/changes/refactor-webtest-naming/proposal.md +66 -0
- package/openspec/changes/refactor-webtest-naming/specs/webtest-prompts/spec.md +79 -0
- package/openspec/changes/refactor-webtest-naming/specs/webtest-resources/spec.md +80 -0
- package/openspec/changes/refactor-webtest-naming/specs/webtest-sampling/spec.md +122 -0
- package/openspec/changes/refactor-webtest-naming/specs/webtest-tools/spec.md +113 -0
- package/openspec/changes/refactor-webtest-naming/tasks.md +119 -0
- package/openspec/changes/rename-package-to-retest/proposal.md +52 -0
- package/openspec/changes/rename-package-to-retest/specs/mcp-server-core/spec.md +53 -0
- package/openspec/changes/rename-package-to-retest/specs/retest-lifecycle/spec.md +68 -0
- package/openspec/changes/rename-package-to-retest/specs/retest-logging/spec.md +35 -0
- package/openspec/changes/rename-package-to-retest/specs/retest-prompts/spec.md +159 -0
- package/openspec/changes/rename-package-to-retest/specs/retest-resources/spec.md +251 -0
- package/openspec/changes/rename-package-to-retest/specs/retest-sampling/spec.md +99 -0
- package/openspec/changes/rename-package-to-retest/specs/retest-tools/spec.md +295 -0
- package/openspec/changes/rename-package-to-retest/tasks.md +71 -0
- package/openspec/project.md +31 -0
- package/openspec/specs/mcp-server-core/spec.md +178 -0
- package/openspec/specs/webtest-lifecycle/spec.md +136 -0
- package/openspec/specs/webtest-logging/spec.md +209 -0
- package/openspec/specs/webtest-prompts/spec.md +155 -0
- package/openspec/specs/webtest-resources/spec.md +248 -0
- package/openspec/specs/webtest-sampling/spec.md +344 -0
- package/openspec/specs/webtest-tools/spec.md +282 -0
- package/package.json +54 -0
- package/release.config.js +9 -0
- package/src/config.test.ts +96 -0
- package/src/config.ts +32 -0
- package/src/elicitation/index.test.ts +399 -0
- package/src/elicitation/index.ts +171 -0
- package/src/elicitation/types.ts +68 -0
- package/src/index.ts +83 -0
- package/src/lifecycle/index.test.ts +260 -0
- package/src/lifecycle/index.ts +101 -0
- package/src/logger.redaction.test.ts +322 -0
- package/src/logger.test.ts +123 -0
- package/src/logger.ts +229 -0
- package/src/playwright-client/index.ts +392 -0
- package/src/playwright-client/types.ts +99 -0
- package/src/progress/index.test.ts +327 -0
- package/src/progress/index.ts +170 -0
- package/src/progress/types.ts +25 -0
- package/src/prompts/index.test.ts +451 -0
- package/src/prompts/index.ts +246 -0
- package/src/prompts/loader.test.ts +100 -0
- package/src/prompts/loader.ts +59 -0
- package/src/prompts/templates/mcp/webtest-crawl.md +7 -0
- package/src/prompts/templates/mcp/webtest-discover-flows.md +11 -0
- package/src/prompts/templates/mcp/webtest-discover.md +12 -0
- package/src/prompts/templates/mcp/webtest-full-workflow.md +12 -0
- package/src/prompts/templates/mcp/webtest-generate-tests.md +11 -0
- package/src/prompts/templates/mcp/webtest-run-test.md +11 -0
- package/src/prompts/templates/mcp/webtest-start.md +8 -0
- package/src/prompts/templates/sampling/crawl-action.md +35 -0
- package/src/prompts/templates/sampling/feature-discovery.md +27 -0
- package/src/prompts/templates/sampling/flow-discovery.md +29 -0
- package/src/prompts/templates/sampling/page-content-wrapper.md +5 -0
- package/src/prompts/templates/sampling/system-prefix.md +12 -0
- package/src/prompts/templates/sampling/test-evaluation.md +17 -0
- package/src/prompts/templates/sampling/test-generation.md +31 -0
- package/src/resources/index.ts +250 -0
- package/src/resources/subscriptions.ts +37 -0
- package/src/sampling/index.test.ts +414 -0
- package/src/sampling/index.ts +286 -0
- package/src/sampling/prompts.ts +194 -0
- package/src/sampling/types.ts +60 -0
- package/src/schemas/config.ts +39 -0
- package/src/security/index.test.ts +441 -0
- package/src/security/index.ts +361 -0
- package/src/security/security-scenarios.test.ts +468 -0
- package/src/server.ts +211 -0
- package/src/test-utils/index.ts +6 -0
- package/src/test-utils/mock-context.ts +426 -0
- package/src/test-utils/mock-playwright-client.ts +422 -0
- package/src/tools/index.ts +11 -0
- package/src/tools/webtest/crawl.test.ts +834 -0
- package/src/tools/webtest/crawl.ts +901 -0
- package/src/tools/webtest/discover-features.ts +412 -0
- package/src/tools/webtest/discover-flows.ts +408 -0
- package/src/tools/webtest/generate-tests.test.ts +532 -0
- package/src/tools/webtest/generate-tests.ts +425 -0
- package/src/tools/webtest/index.ts +7 -0
- package/src/tools/webtest/integration.test.ts +536 -0
- package/src/tools/webtest/run-test-case.test.ts +659 -0
- package/src/tools/webtest/run-test-case.ts +508 -0
- package/src/tools/webtest/schemas.ts +201 -0
- package/src/tools/webtest/start-analysis.test.ts +151 -0
- package/src/tools/webtest/start-analysis.ts +158 -0
- package/src/transports/http.ts +19 -0
- package/src/transports/index.ts +30 -0
- package/src/transports/stdio.ts +7 -0
- package/src/types/capabilities.test.ts +193 -0
- package/src/types/capabilities.ts +50 -0
- package/src/types/context.ts +21 -0
- package/src/types/tool.ts +11 -0
- package/src/workspace/index.ts +945 -0
- package/src/workspace/markdown.ts +272 -0
- package/src/workspace/types.ts +186 -0
- package/tests/integration/server.test.ts +89 -0
- package/tests/integration/tools.test.ts +99 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +9 -0
- package/vitest.integration.config.ts +10 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Change: Add Dynamic Web Testing Orchestrator
|
|
2
|
+
|
|
3
|
+
## Why
|
|
4
|
+
|
|
5
|
+
The current MCP server provides only a basic "hello" demonstration tool. To fulfill its purpose as a web testing server, it needs to orchestrate dynamic web application exploration, analysis, test generation, and test execution. By leveraging the full MCP protocol (sampling, elicitation, resources, prompts, progress, cancellation) and integrating with Playwright MCP for browser automation, the server can provide AI-powered exploratory testing capabilities where the LLM reasoning happens client-side via MCP Sampling.
|
|
6
|
+
|
|
7
|
+
## What Changes
|
|
8
|
+
|
|
9
|
+
### New Capabilities
|
|
10
|
+
|
|
11
|
+
- **MCP Lifecycle & Capability Negotiation**: Proper initialize/operate/shutdown lifecycle with runtime capability detection (sampling, elicitation, logging, progress, resources.listChanged, resources.subscribe)
|
|
12
|
+
- **Protocol Version Requirements**: Requires MCP protocol revision 2025-06-18+ for elicitation; graceful degradation for older clients
|
|
13
|
+
- **Webtest Tools**: Five orchestration tools for the testing workflow:
|
|
14
|
+
1. `webtest_init` - Initialize analysis workspace
|
|
15
|
+
2. `webtest_crawl_app` - Dynamic goal-directed exploration with checkpointing and loop detection
|
|
16
|
+
3. `webtest_analyze_app` - Reverse-engineer app structure and flows
|
|
17
|
+
4. `webtest_generate_tests` - Produce test cases from analysis
|
|
18
|
+
5. `webtest_run_tests` - Execute tests with evidence capture
|
|
19
|
+
- **Webtest Resources**: Stable `webtest://` URI-based artifacts with **listChanged/subscribe** support for live artifact surfacing during long operations
|
|
20
|
+
- **Webtest Prompts**: Prompt templates for smooth client UX
|
|
21
|
+
- **MCP Sampling Integration**: Client-controlled LLM reasoning for all AI decisions with **fallback mode** when sampling unavailable
|
|
22
|
+
- **Elicitation Support**: Interactive user decisions during crawl with **fallback mode** when elicitation unavailable
|
|
23
|
+
- **Progress & Cancellation**: Long-running operations report progress (with budget status) and respond to cancellation
|
|
24
|
+
- **Playwright MCP Integration**: Orchestration with **dynamic tool discovery and capability adapter** (version/implementation resilient)
|
|
25
|
+
- **Structured Logging**: MCP logging notifications with correlation IDs, log level control, and sensitive data redaction
|
|
26
|
+
|
|
27
|
+
### **BREAKING** Changes
|
|
28
|
+
|
|
29
|
+
- Removes `hello` tool (demonstration no longer needed)
|
|
30
|
+
- Server now requires Playwright MCP server as external dependency
|
|
31
|
+
|
|
32
|
+
### Security Additions
|
|
33
|
+
|
|
34
|
+
- Domain allowlist enforcement with subdomain support
|
|
35
|
+
- **Comprehensive prompt injection hardening** with defense-in-depth:
|
|
36
|
+
- Untrusted page content demarcation
|
|
37
|
+
- Protected system instruction prefix
|
|
38
|
+
- Scope expansion detection and blocking
|
|
39
|
+
- Data exfiltration pattern blocking
|
|
40
|
+
- Audit logging of all sampling I/O
|
|
41
|
+
- **Injection test suite** validating resistance to direct/indirect injection, goal hijacking, credential phishing
|
|
42
|
+
- Sensitive data redaction in logs (URLs, cookies, passwords)
|
|
43
|
+
- Never requests credentials via elicitation
|
|
44
|
+
|
|
45
|
+
### Robustness Additions
|
|
46
|
+
|
|
47
|
+
- **Crawl checkpointing** every N steps with resume support
|
|
48
|
+
- **Loop detection and prevention**: DOM signature tracking, URL cycle detection, action repeat blocking
|
|
49
|
+
- **Budget enforcement**: maxSteps, maxMinutes, maxPages limits with graceful partial output
|
|
50
|
+
|
|
51
|
+
## Key Features Summary
|
|
52
|
+
|
|
53
|
+
| Feature | Description |
|
|
54
|
+
|---------|-------------|
|
|
55
|
+
| Resources listChanged/subscribe | Surface new artifacts live during crawl/test execution |
|
|
56
|
+
| Runtime fallbacks | Graceful degradation when Sampling/Elicitation unsupported |
|
|
57
|
+
| Playwright MCP adapter | Dynamic tool discovery; version/implementation resilient |
|
|
58
|
+
| Sampling injection hardening | Defense-in-depth with audit logging and test suite |
|
|
59
|
+
| Crawl checkpointing | Resume interrupted crawls; partial results on timeout |
|
|
60
|
+
| Loop prevention | DOM signatures, URL cycles, action repeats detected |
|
|
61
|
+
|
|
62
|
+
## Impact
|
|
63
|
+
|
|
64
|
+
- Affected specs: `mcp-server-core` (lifecycle changes), plus new specs for `webtest-tools`, `webtest-resources`, `webtest-prompts`, `webtest-sampling`, `webtest-lifecycle`, `webtest-logging`
|
|
65
|
+
- Affected code: `src/server.ts`, `src/tools/`, new directories for resources/prompts/sampling/lifecycle/logging
|
|
66
|
+
- External dependencies: Playwright MCP server (Microsoft or compatible implementation)
|
package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/mcp-server-core/spec.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# mcp-server-core Spec Delta
|
|
2
|
+
|
|
3
|
+
## REMOVED Requirements
|
|
4
|
+
|
|
5
|
+
### Requirement: Hello Tool Implementation
|
|
6
|
+
|
|
7
|
+
**Reason**: The demonstration "hello" tool is no longer needed now that real webtest tools are implemented.
|
|
8
|
+
|
|
9
|
+
**Migration**: Remove `src/tools/hello.ts` and `src/tools/hello.test.ts`. Update tool registry to exclude hello tool.
|
|
10
|
+
|
|
11
|
+
## MODIFIED Requirements
|
|
12
|
+
|
|
13
|
+
### Requirement: MCP Server Initialization
|
|
14
|
+
|
|
15
|
+
The system SHALL provide an MCP server that initializes with proper identification, negotiates client capabilities, and connects to the configured transport.
|
|
16
|
+
|
|
17
|
+
#### Scenario: Server starts with stdio transport
|
|
18
|
+
|
|
19
|
+
- **GIVEN** the environment variable `TRANSPORT` is set to `stdio` or not set
|
|
20
|
+
- **WHEN** the server entry point is executed
|
|
21
|
+
- **THEN** it SHALL identify itself with name "testing-mcp" and version from package.json
|
|
22
|
+
- **AND** it SHALL connect to stdio transport for communication
|
|
23
|
+
|
|
24
|
+
#### Scenario: Server starts with HTTP transport
|
|
25
|
+
|
|
26
|
+
- **GIVEN** the environment variable `TRANSPORT` is set to `http`
|
|
27
|
+
- **AND** the environment variable `PORT` is set to a valid port number
|
|
28
|
+
- **WHEN** the server entry point is executed
|
|
29
|
+
- **THEN** it SHALL start a Streamable HTTP server on the specified port
|
|
30
|
+
- **AND** it SHALL accept MCP protocol connections over HTTP
|
|
31
|
+
|
|
32
|
+
#### Scenario: Server handles graceful shutdown
|
|
33
|
+
|
|
34
|
+
- **GIVEN** the server is running
|
|
35
|
+
- **WHEN** the process receives SIGINT or SIGTERM
|
|
36
|
+
- **THEN** the server SHALL disconnect gracefully
|
|
37
|
+
- **AND** any active Playwright MCP subprocess SHALL be terminated
|
|
38
|
+
- **AND** the process SHALL exit with code 0
|
|
39
|
+
|
|
40
|
+
#### Scenario: Server negotiates client capabilities
|
|
41
|
+
|
|
42
|
+
- **GIVEN** a client connects to the server
|
|
43
|
+
- **WHEN** the initialize handshake completes
|
|
44
|
+
- **THEN** the server SHALL record client capabilities for sampling, elicitation, logging, and progress
|
|
45
|
+
- **AND** the server SHALL adapt runtime behavior based on available capabilities
|
|
46
|
+
|
|
47
|
+
## MODIFIED Requirements
|
|
48
|
+
|
|
49
|
+
### Requirement: Configuration Validation
|
|
50
|
+
|
|
51
|
+
The system SHALL validate configuration at startup using Zod schemas and fail fast on invalid configuration, including webtest-specific settings.
|
|
52
|
+
|
|
53
|
+
#### Scenario: Valid configuration starts server
|
|
54
|
+
|
|
55
|
+
- **GIVEN** all required environment variables are valid
|
|
56
|
+
- **WHEN** the server starts
|
|
57
|
+
- **THEN** configuration SHALL be parsed and validated
|
|
58
|
+
- **AND** the server SHALL proceed with initialization
|
|
59
|
+
|
|
60
|
+
#### Scenario: Invalid configuration fails fast
|
|
61
|
+
|
|
62
|
+
- **GIVEN** an environment variable has an invalid value (e.g., `PORT=invalid`)
|
|
63
|
+
- **WHEN** the server attempts to start
|
|
64
|
+
- **THEN** it SHALL log a descriptive error message
|
|
65
|
+
- **AND** the process SHALL exit with a non-zero code
|
|
66
|
+
|
|
67
|
+
#### Scenario: Webtest workspace configuration is validated
|
|
68
|
+
|
|
69
|
+
- **GIVEN** the environment variable `WEBTEST_WORKSPACE_DIR` is set
|
|
70
|
+
- **WHEN** the server starts
|
|
71
|
+
- **THEN** it SHALL validate the path is writable
|
|
72
|
+
- **AND** create the directory if it does not exist
|
|
73
|
+
|
|
74
|
+
## MODIFIED Requirements
|
|
75
|
+
|
|
76
|
+
### Requirement: Self-Describing Tool Registry
|
|
77
|
+
|
|
78
|
+
The system SHALL maintain a tool registry where each tool exports a standard interface including name, description, Zod input schema, and async handler function, supporting the webtest tool namespace.
|
|
79
|
+
|
|
80
|
+
#### Scenario: Tool is registered and discoverable
|
|
81
|
+
|
|
82
|
+
- **GIVEN** a tool is added to the registry
|
|
83
|
+
- **WHEN** an MCP client requests the tool list
|
|
84
|
+
- **THEN** the tool SHALL appear in the list with its name and description
|
|
85
|
+
- **AND** the input JSON Schema SHALL be generated from the Zod schema
|
|
86
|
+
|
|
87
|
+
#### Scenario: New tool follows registry pattern
|
|
88
|
+
|
|
89
|
+
- **GIVEN** a developer creates a new tool
|
|
90
|
+
- **WHEN** the tool exports `{ name, description, inputSchema, handler }`
|
|
91
|
+
- **AND** the tool is added to the registry index
|
|
92
|
+
- **THEN** it SHALL be automatically registered with the MCP server
|
|
93
|
+
|
|
94
|
+
#### Scenario: Webtest tools use namespaced naming
|
|
95
|
+
|
|
96
|
+
- **GIVEN** the webtest tools are registered
|
|
97
|
+
- **WHEN** an MCP client requests the tool list
|
|
98
|
+
- **THEN** tools SHALL appear with `webtest_` prefix (e.g., `webtest_init`, `webtest_crawl_app`)
|
|
99
|
+
|
|
100
|
+
## MODIFIED Requirements
|
|
101
|
+
|
|
102
|
+
### Requirement: Structured Logging
|
|
103
|
+
|
|
104
|
+
The system SHALL provide structured JSON logging with configurable log levels, automatic redaction of sensitive fields, and optional emission as MCP logging notifications.
|
|
105
|
+
|
|
106
|
+
#### Scenario: Log output is structured JSON
|
|
107
|
+
|
|
108
|
+
- **GIVEN** the server is running
|
|
109
|
+
- **WHEN** a log event occurs
|
|
110
|
+
- **THEN** it SHALL be output as a JSON object with timestamp, level, and message fields
|
|
111
|
+
|
|
112
|
+
#### Scenario: Sensitive fields are redacted
|
|
113
|
+
|
|
114
|
+
- **GIVEN** a log message contains a field matching a sensitive key pattern (password, token, secret, apiKey, authorization)
|
|
115
|
+
- **WHEN** the log is written
|
|
116
|
+
- **THEN** the sensitive field value SHALL be replaced with "[REDACTED]"
|
|
117
|
+
|
|
118
|
+
#### Scenario: Log level is configurable
|
|
119
|
+
|
|
120
|
+
- **GIVEN** the environment variable `LOG_LEVEL` is set to a valid level (debug, info, warn, error)
|
|
121
|
+
- **WHEN** the server starts
|
|
122
|
+
- **THEN** only log messages at or above that level SHALL be output
|
|
123
|
+
|
|
124
|
+
#### Scenario: Logs are emitted as MCP notifications when supported
|
|
125
|
+
|
|
126
|
+
- **GIVEN** the client supports MCP logging notifications
|
|
127
|
+
- **WHEN** a log event occurs
|
|
128
|
+
- **THEN** it SHALL be emitted as a `notifications/message` to the client
|
|
129
|
+
- **AND** the log level SHALL map to MCP log levels (debug, info, warning, error)
|
package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-lifecycle/spec.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# webtest-lifecycle Specification
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Defines the MCP lifecycle management and capability negotiation for the web testing server.
|
|
6
|
+
|
|
7
|
+
## ADDED Requirements
|
|
8
|
+
|
|
9
|
+
### Requirement: MCP Protocol Version Requirements
|
|
10
|
+
|
|
11
|
+
The system SHALL require MCP protocol revision 2025-06-18 or later to ensure elicitation support is available.
|
|
12
|
+
|
|
13
|
+
#### Scenario: Server declares required protocol version
|
|
14
|
+
|
|
15
|
+
- **GIVEN** the server starts
|
|
16
|
+
- **WHEN** it responds to initialize request
|
|
17
|
+
- **THEN** it SHALL declare `protocolVersion: "2025-06-18"` or later
|
|
18
|
+
- **AND** include elicitation in server capabilities
|
|
19
|
+
|
|
20
|
+
#### Scenario: Client with older protocol version
|
|
21
|
+
|
|
22
|
+
- **GIVEN** a client connects with protocol version older than 2025-06-18
|
|
23
|
+
- **WHEN** initialization completes
|
|
24
|
+
- **THEN** the server SHALL record that elicitation is NOT available
|
|
25
|
+
- **AND** log a warning about degraded functionality
|
|
26
|
+
|
|
27
|
+
#### Scenario: Protocol version mismatch handling
|
|
28
|
+
|
|
29
|
+
- **GIVEN** a client requests a protocol version the server cannot satisfy
|
|
30
|
+
- **WHEN** version negotiation occurs
|
|
31
|
+
- **THEN** the server SHALL negotiate to the highest mutually supported version
|
|
32
|
+
- **AND** adjust available features accordingly
|
|
33
|
+
|
|
34
|
+
### Requirement: MCP Lifecycle Management
|
|
35
|
+
|
|
36
|
+
The system SHALL implement proper MCP lifecycle phases (initialize, operate, shutdown) and maintain lifecycle state.
|
|
37
|
+
|
|
38
|
+
#### Scenario: Server transitions through lifecycle phases
|
|
39
|
+
|
|
40
|
+
- **GIVEN** a client connects to the server
|
|
41
|
+
- **WHEN** the connection is established
|
|
42
|
+
- **THEN** the server SHALL be in "initializing" state
|
|
43
|
+
- **AND** after successful initialize handshake, transition to "operating" state
|
|
44
|
+
- **AND** on shutdown signal, transition to "shutdown" state
|
|
45
|
+
|
|
46
|
+
#### Scenario: Server rejects operations before initialization
|
|
47
|
+
|
|
48
|
+
- **GIVEN** the server is in "initializing" state
|
|
49
|
+
- **WHEN** a client sends a tool call request
|
|
50
|
+
- **THEN** the server SHALL return an error indicating initialization not complete
|
|
51
|
+
|
|
52
|
+
#### Scenario: Server rejects new operations during shutdown
|
|
53
|
+
|
|
54
|
+
- **GIVEN** the server is in "shutdown" state
|
|
55
|
+
- **WHEN** a client sends a new tool call request
|
|
56
|
+
- **THEN** the server SHALL return an error indicating server is shutting down
|
|
57
|
+
|
|
58
|
+
### Requirement: Client Capability Negotiation
|
|
59
|
+
|
|
60
|
+
The system SHALL query and record client capabilities during initialization and adapt behavior accordingly.
|
|
61
|
+
|
|
62
|
+
#### Scenario: Server records sampling capability
|
|
63
|
+
|
|
64
|
+
- **GIVEN** a client connects with `capabilities.sampling` present
|
|
65
|
+
- **WHEN** initialization completes
|
|
66
|
+
- **THEN** the server SHALL record that sampling is available
|
|
67
|
+
- **AND** webtest tools SHALL use `sampling/createMessage` for LLM reasoning
|
|
68
|
+
|
|
69
|
+
#### Scenario: Server records elicitation capability
|
|
70
|
+
|
|
71
|
+
- **GIVEN** a client connects with `capabilities.elicitation` present
|
|
72
|
+
- **WHEN** initialization completes
|
|
73
|
+
- **THEN** the server SHALL record that elicitation is available
|
|
74
|
+
- **AND** webtest tools SHALL use `elicitation/create` for user decisions
|
|
75
|
+
|
|
76
|
+
#### Scenario: Server records logging capability
|
|
77
|
+
|
|
78
|
+
- **GIVEN** a client connects with `capabilities.logging` present
|
|
79
|
+
- **WHEN** initialization completes
|
|
80
|
+
- **THEN** the server SHALL record that logging notifications are supported
|
|
81
|
+
- **AND** the logger SHALL emit `notifications/message` to the client
|
|
82
|
+
|
|
83
|
+
#### Scenario: Server records progress capability
|
|
84
|
+
|
|
85
|
+
- **GIVEN** a client connects with MCP progress support
|
|
86
|
+
- **WHEN** initialization completes
|
|
87
|
+
- **THEN** the server SHALL record that progress notifications are supported
|
|
88
|
+
- **AND** long-running tools SHALL emit `notifications/progress`
|
|
89
|
+
|
|
90
|
+
#### Scenario: Server records resources listChanged capability
|
|
91
|
+
|
|
92
|
+
- **GIVEN** a client connects with `capabilities.resources.listChanged` present
|
|
93
|
+
- **WHEN** initialization completes
|
|
94
|
+
- **THEN** the server SHALL record that resource list change notifications are supported
|
|
95
|
+
- **AND** resource creation SHALL emit `notifications/resources/list_changed`
|
|
96
|
+
|
|
97
|
+
#### Scenario: Server records resources subscribe capability
|
|
98
|
+
|
|
99
|
+
- **GIVEN** a client connects with `capabilities.resources.subscribe` present
|
|
100
|
+
- **WHEN** initialization completes
|
|
101
|
+
- **THEN** the server SHALL record that resource subscriptions are supported
|
|
102
|
+
- **AND** resource updates SHALL emit `notifications/resources/updated` to subscribers
|
|
103
|
+
|
|
104
|
+
#### Scenario: Fallback when sampling not supported
|
|
105
|
+
|
|
106
|
+
- **GIVEN** a client connects without `capabilities.sampling`
|
|
107
|
+
- **WHEN** a webtest tool requires LLM reasoning
|
|
108
|
+
- **THEN** the tool SHALL return a prompt resource for manual execution
|
|
109
|
+
- **AND** the tool output SHALL include `needsManualInput: true`
|
|
110
|
+
|
|
111
|
+
#### Scenario: Fallback when elicitation not supported
|
|
112
|
+
|
|
113
|
+
- **GIVEN** a client connects without `capabilities.elicitation`
|
|
114
|
+
- **WHEN** a webtest tool needs user decision
|
|
115
|
+
- **THEN** the tool SHALL include questions in its output
|
|
116
|
+
- **AND** the tool output SHALL include `needsInput: true` with question details
|
|
117
|
+
|
|
118
|
+
### Requirement: Capability Query API
|
|
119
|
+
|
|
120
|
+
The system SHALL provide internal APIs for tools to query client capabilities at runtime.
|
|
121
|
+
|
|
122
|
+
#### Scenario: Tool queries sampling availability
|
|
123
|
+
|
|
124
|
+
- **GIVEN** a tool handler is executing
|
|
125
|
+
- **WHEN** it calls `capabilities.hasSampling()`
|
|
126
|
+
- **THEN** it SHALL receive a boolean indicating sampling support
|
|
127
|
+
|
|
128
|
+
#### Scenario: Tool queries elicitation availability
|
|
129
|
+
|
|
130
|
+
- **GIVEN** a tool handler is executing
|
|
131
|
+
- **WHEN** it calls `capabilities.hasElicitation()`
|
|
132
|
+
- **THEN** it SHALL receive a boolean indicating elicitation support
|
|
133
|
+
|
|
134
|
+
#### Scenario: Tool queries all capabilities
|
|
135
|
+
|
|
136
|
+
- **GIVEN** a tool handler is executing
|
|
137
|
+
- **WHEN** it calls `capabilities.getAll()`
|
|
138
|
+
- **THEN** it SHALL receive an object with all recorded capabilities
|
package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-logging/spec.md
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# webtest-logging Specification
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Defines structured logging with MCP logging notifications, correlation IDs, sensitive data redaction, and log level control.
|
|
6
|
+
|
|
7
|
+
## ADDED Requirements
|
|
8
|
+
|
|
9
|
+
### Requirement: MCP Logging Notifications
|
|
10
|
+
|
|
11
|
+
The system SHALL emit structured logs as MCP logging notifications when the client supports it.
|
|
12
|
+
|
|
13
|
+
#### Scenario: Log emitted as MCP notification
|
|
14
|
+
|
|
15
|
+
- **GIVEN** the client supports MCP logging (`capabilities.logging` present)
|
|
16
|
+
- **WHEN** a log event occurs
|
|
17
|
+
- **THEN** it SHALL emit `notifications/message` with:
|
|
18
|
+
- `level`: one of "debug", "info", "warning", "error"
|
|
19
|
+
- `logger`: "webtest"
|
|
20
|
+
- `data`: structured log payload
|
|
21
|
+
|
|
22
|
+
#### Scenario: Fallback to stderr when logging unsupported
|
|
23
|
+
|
|
24
|
+
- **GIVEN** the client does not support MCP logging
|
|
25
|
+
- **WHEN** a log event occurs
|
|
26
|
+
- **THEN** it SHALL write to stderr as JSON
|
|
27
|
+
- **AND** not attempt MCP notification
|
|
28
|
+
|
|
29
|
+
#### Scenario: Log level is respected
|
|
30
|
+
|
|
31
|
+
- **GIVEN** client log level is set to "warning"
|
|
32
|
+
- **WHEN** an "info" level log is generated
|
|
33
|
+
- **THEN** it SHALL NOT be emitted
|
|
34
|
+
- **AND** "warning" and "error" logs SHALL be emitted
|
|
35
|
+
|
|
36
|
+
### Requirement: Logging Level Control
|
|
37
|
+
|
|
38
|
+
The system SHALL support dynamic log level configuration via MCP and environment.
|
|
39
|
+
|
|
40
|
+
#### Scenario: Log level set via environment
|
|
41
|
+
|
|
42
|
+
- **GIVEN** environment variable `LOG_LEVEL` is set to "debug"
|
|
43
|
+
- **WHEN** the server starts
|
|
44
|
+
- **THEN** all log levels (debug, info, warning, error) SHALL be emitted
|
|
45
|
+
|
|
46
|
+
#### Scenario: Client sets log level via logging/setLevel
|
|
47
|
+
|
|
48
|
+
- **GIVEN** client supports `logging/setLevel`
|
|
49
|
+
- **WHEN** client sends `logging/setLevel` with level "error"
|
|
50
|
+
- **THEN** only "error" level logs SHALL be emitted thereafter
|
|
51
|
+
- **AND** this SHALL override the environment setting
|
|
52
|
+
|
|
53
|
+
#### Scenario: Default log level
|
|
54
|
+
|
|
55
|
+
- **GIVEN** no log level is configured
|
|
56
|
+
- **WHEN** the server starts
|
|
57
|
+
- **THEN** the default log level SHALL be "info"
|
|
58
|
+
|
|
59
|
+
### Requirement: Correlation IDs
|
|
60
|
+
|
|
61
|
+
The system SHALL include correlation IDs in all log messages to enable tracing across operations.
|
|
62
|
+
|
|
63
|
+
#### Scenario: Analysis ID is included in logs
|
|
64
|
+
|
|
65
|
+
- **GIVEN** a tool is executing within an analysis context
|
|
66
|
+
- **WHEN** a log is emitted
|
|
67
|
+
- **THEN** it SHALL include `analysisId` in the log data
|
|
68
|
+
|
|
69
|
+
#### Scenario: Crawl ID is included in crawl logs
|
|
70
|
+
|
|
71
|
+
- **GIVEN** a crawl is in progress
|
|
72
|
+
- **WHEN** a log is emitted during the crawl
|
|
73
|
+
- **THEN** it SHALL include `crawlId` in addition to `analysisId`
|
|
74
|
+
|
|
75
|
+
#### Scenario: Test run ID is included in test logs
|
|
76
|
+
|
|
77
|
+
- **GIVEN** a test case is being executed
|
|
78
|
+
- **WHEN** a log is emitted during test execution
|
|
79
|
+
- **THEN** it SHALL include `testRunId` in addition to `analysisId`
|
|
80
|
+
|
|
81
|
+
#### Scenario: Iteration number is included in loop logs
|
|
82
|
+
|
|
83
|
+
- **GIVEN** a crawl or test loop is executing
|
|
84
|
+
- **WHEN** a log is emitted during an iteration
|
|
85
|
+
- **THEN** it SHALL include `iteration` number
|
|
86
|
+
|
|
87
|
+
#### Scenario: Request ID is included when available
|
|
88
|
+
|
|
89
|
+
- **GIVEN** a tool is handling an MCP request with `_meta.requestId`
|
|
90
|
+
- **WHEN** logs are emitted during that request
|
|
91
|
+
- **THEN** they SHALL include `requestId` for correlation with client logs
|
|
92
|
+
|
|
93
|
+
### Requirement: Structured Log Format
|
|
94
|
+
|
|
95
|
+
The system SHALL emit logs in a consistent structured format.
|
|
96
|
+
|
|
97
|
+
#### Scenario: Log structure is consistent
|
|
98
|
+
|
|
99
|
+
- **GIVEN** any log event occurs
|
|
100
|
+
- **WHEN** it is emitted
|
|
101
|
+
- **THEN** it SHALL include:
|
|
102
|
+
- `timestamp`: ISO 8601 format
|
|
103
|
+
- `level`: log level
|
|
104
|
+
- `message`: human-readable message
|
|
105
|
+
- `context`: object with correlation IDs
|
|
106
|
+
- `data`: optional additional structured data
|
|
107
|
+
|
|
108
|
+
#### Scenario: Playwright MCP tool calls are logged
|
|
109
|
+
|
|
110
|
+
- **GIVEN** a Playwright MCP tool is called
|
|
111
|
+
- **WHEN** the call completes
|
|
112
|
+
- **THEN** it SHALL log:
|
|
113
|
+
- `message`: "Playwright tool executed"
|
|
114
|
+
- `data.tool`: tool name
|
|
115
|
+
- `data.duration`: execution time in ms
|
|
116
|
+
- `data.success`: boolean
|
|
117
|
+
- `data.error`: error message if failed (sensitive data redacted)
|
|
118
|
+
|
|
119
|
+
#### Scenario: Sampling calls are logged
|
|
120
|
+
|
|
121
|
+
- **GIVEN** a sampling request is made
|
|
122
|
+
- **WHEN** the request completes
|
|
123
|
+
- **THEN** it SHALL log:
|
|
124
|
+
- `message`: "Sampling completed"
|
|
125
|
+
- `data.promptTokens`: approximate prompt size
|
|
126
|
+
- `data.responseTokens`: approximate response size
|
|
127
|
+
- `data.duration`: execution time in ms
|
|
128
|
+
- `data.validationPassed`: boolean
|
|
129
|
+
|
|
130
|
+
### Requirement: Sensitive Data Redaction
|
|
131
|
+
|
|
132
|
+
The system SHALL redact sensitive data from logs to prevent credential exposure.
|
|
133
|
+
|
|
134
|
+
#### Scenario: URL query parameters are redacted
|
|
135
|
+
|
|
136
|
+
- **GIVEN** a log includes a URL
|
|
137
|
+
- **WHEN** the URL contains query parameters matching sensitive patterns (token, key, password, secret, auth, session)
|
|
138
|
+
- **THEN** parameter values SHALL be replaced with "[REDACTED]"
|
|
139
|
+
|
|
140
|
+
#### Scenario: Cookie values are redacted
|
|
141
|
+
|
|
142
|
+
- **GIVEN** a log includes cookie data
|
|
143
|
+
- **WHEN** cookies are serialized
|
|
144
|
+
- **THEN** cookie values SHALL be replaced with "[REDACTED]"
|
|
145
|
+
- **AND** only cookie names SHALL be visible
|
|
146
|
+
|
|
147
|
+
#### Scenario: Form input values are redacted
|
|
148
|
+
|
|
149
|
+
- **GIVEN** a log includes form interaction (type action)
|
|
150
|
+
- **WHEN** the input is to a password or sensitive field
|
|
151
|
+
- **THEN** the typed value SHALL be replaced with "[REDACTED]"
|
|
152
|
+
|
|
153
|
+
#### Scenario: HTML content is truncated
|
|
154
|
+
|
|
155
|
+
- **GIVEN** a log includes HTML content
|
|
156
|
+
- **WHEN** the HTML exceeds 500 characters
|
|
157
|
+
- **THEN** it SHALL be truncated with "...[truncated]"
|
|
158
|
+
- **AND** sensitive elements (script, style) SHALL be removed
|
|
159
|
+
|
|
160
|
+
#### Scenario: Known sensitive field patterns are redacted
|
|
161
|
+
|
|
162
|
+
- **GIVEN** a log data object is being serialized
|
|
163
|
+
- **WHEN** it contains keys matching sensitive patterns:
|
|
164
|
+
- password, passwd, pwd
|
|
165
|
+
- token, apiKey, api_key
|
|
166
|
+
- secret, credential
|
|
167
|
+
- authorization, auth
|
|
168
|
+
- session, cookie
|
|
169
|
+
- **THEN** those values SHALL be replaced with "[REDACTED]"
|
|
170
|
+
|
|
171
|
+
### Requirement: Operation Step Logging
|
|
172
|
+
|
|
173
|
+
The system SHALL log detailed step information for debugging and audit.
|
|
174
|
+
|
|
175
|
+
#### Scenario: Crawl step is logged
|
|
176
|
+
|
|
177
|
+
- **GIVEN** a crawl iteration completes
|
|
178
|
+
- **WHEN** step logging occurs
|
|
179
|
+
- **THEN** it SHALL log at "debug" level:
|
|
180
|
+
- Current URL
|
|
181
|
+
- Action taken (tool + args with sensitive data redacted)
|
|
182
|
+
- Result summary
|
|
183
|
+
- Goal progress assessment
|
|
184
|
+
|
|
185
|
+
#### Scenario: Test step is logged
|
|
186
|
+
|
|
187
|
+
- **GIVEN** a test step executes
|
|
188
|
+
- **WHEN** step logging occurs
|
|
189
|
+
- **THEN** it SHALL log at "info" level:
|
|
190
|
+
- Step number and description
|
|
191
|
+
- Actions executed
|
|
192
|
+
- Pass/fail result
|
|
193
|
+
- Evidence URIs
|
|
194
|
+
|
|
195
|
+
#### Scenario: Elicitation event is logged
|
|
196
|
+
|
|
197
|
+
- **GIVEN** elicitation is triggered
|
|
198
|
+
- **WHEN** user response is received
|
|
199
|
+
- **THEN** it SHALL log at "info" level:
|
|
200
|
+
- Elicitation type (cookie, modal, ambiguous, auth)
|
|
201
|
+
- Options presented
|
|
202
|
+
- User selection
|
|
203
|
+
|
|
204
|
+
#### Scenario: Security event is logged
|
|
205
|
+
|
|
206
|
+
- **GIVEN** a security check fails (domain validation, injection detection)
|
|
207
|
+
- **WHEN** the violation is detected
|
|
208
|
+
- **THEN** it SHALL log at "warning" level:
|
|
209
|
+
- Violation type
|
|
210
|
+
- Attempted action (redacted as needed)
|
|
211
|
+
- Remediation taken
|