From 04359613b5ec4fc13912d08b6df80102d580d344 Mon Sep 17 00:00:00 2001 From: John Dvorak Date: Fri, 22 May 2026 13:33:48 -0700 Subject: [PATCH] fix: add scenario example to protocol-lab, sync EnvironmentPolicy types --- APOPHIS_ADOPTION_AUDIT.md | 2 +- src/cli/commands/init/scaffolds/index.ts | 8 ++++++++ src/cli/core/config-loader.ts | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/APOPHIS_ADOPTION_AUDIT.md b/APOPHIS_ADOPTION_AUDIT.md index 8a473d3..a924c6d 100644 --- a/APOPHIS_ADOPTION_AUDIT.md +++ b/APOPHIS_ADOPTION_AUDIT.md @@ -235,7 +235,7 @@ Overall: 8.5/10 for real team pilot use. Potential 9/10 if standalone observe pr 7. ✅ Plugin contract support end-to-end: docs, tests, all runners wired. 8. ✅ Artifact pipeline CI/CD regression tests: json-summary, ndjson-summary, --quiet, skipped field, exit codes. 9. ✅ Qualify --changed implemented. -10. Add standalone observe process management (`apophis observe --app ./app.ts`) for local/staging observation. +10. Add OTel-compatible observe sink — export contract.violation / contract.pass events as OpenTelemetry spans or custom metrics so teams can visualize APOPHIS results in existing dashboards (Jaeger, Datadog, etc.) without custom glue code. This replaces the earlier "standalone observe process" idea; OTel already solves service lifecycle and transport. 11. Add route ownership / file-to-route maps for precise `--changed` filtering. 12. Consider true scoped outbound mocking (undici dispatcher) only if concurrent in-process dependency tests become a core promise. diff --git a/src/cli/commands/init/scaffolds/index.ts b/src/cli/commands/init/scaffolds/index.ts index d2a3179..849a1f0 100644 --- a/src/cli/commands/init/scaffolds/index.ts +++ b/src/cli/commands/init/scaffolds/index.ts @@ -330,6 +330,13 @@ export function protocolLabScaffold(): ScaffoldResult { // hooks: { onResponse: { ensures: ['status != 429'] } }, // }, // }, + // scenarios: [{ + // name: 'create-and-read', + // steps: [ + // { request: { method: 'POST', url: '/users', body: { name: 'test' } }, expect: ['status:201'], capture: { userId: 'response_body(this).id' } }, + // { request: { method: 'GET', url: '/users/{userId}' }, expect: ['status:200', 'response_body(this).name == "test"'] }, + // ], + // }], }; const readmeContent = ` @@ -374,6 +381,7 @@ Qualify can produce large output. In CI, use machine-readable formats and filter ## Next Steps - Define scenario sequences in your config. +- Example scenario is commented out in apophis.config.js — uncomment and adapt. - Add route allowlists for chaos if needed. - Run \`apophis replay --artifact \` to debug failures. `; diff --git a/src/cli/core/config-loader.ts b/src/cli/core/config-loader.ts index a1be1b2..bf993b8 100644 --- a/src/cli/core/config-loader.ts +++ b/src/cli/core/config-loader.ts @@ -38,6 +38,13 @@ export interface EnvironmentPolicy { allowedModes?: ('verify' | 'observe' | 'qualify')[]; blockQualify?: boolean; allowChaosOnProtected?: boolean; + allowVerify?: boolean; + allowObserve?: boolean; + allowQualify?: boolean; + allowChaos?: boolean; + allowBlocking?: boolean; + requireSink?: boolean; + sinks?: Record; [key: string]: unknown; }