fix: add scenario example to protocol-lab, sync EnvironmentPolicy types

This commit is contained in:
John Dvorak
2026-05-22 13:33:48 -07:00
parent 60e710370a
commit 04359613b5
3 changed files with 16 additions and 1 deletions
+1 -1
View File
@@ -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. 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. 8. ✅ Artifact pipeline CI/CD regression tests: json-summary, ndjson-summary, --quiet, skipped field, exit codes.
9. ✅ Qualify --changed implemented. 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. 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. 12. Consider true scoped outbound mocking (undici dispatcher) only if concurrent in-process dependency tests become a core promise.
+8
View File
@@ -330,6 +330,13 @@ export function protocolLabScaffold(): ScaffoldResult {
// hooks: { onResponse: { ensures: ['status != 429'] } }, // 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 = ` const readmeContent = `
@@ -374,6 +381,7 @@ Qualify can produce large output. In CI, use machine-readable formats and filter
## Next Steps ## Next Steps
- Define scenario sequences in your config. - 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. - Add route allowlists for chaos if needed.
- Run \`apophis replay --artifact <path>\` to debug failures. - Run \`apophis replay --artifact <path>\` to debug failures.
`; `;
+7
View File
@@ -38,6 +38,13 @@ export interface EnvironmentPolicy {
allowedModes?: ('verify' | 'observe' | 'qualify')[]; allowedModes?: ('verify' | 'observe' | 'qualify')[];
blockQualify?: boolean; blockQualify?: boolean;
allowChaosOnProtected?: boolean; allowChaosOnProtected?: boolean;
allowVerify?: boolean;
allowObserve?: boolean;
allowQualify?: boolean;
allowChaos?: boolean;
allowBlocking?: boolean;
requireSink?: boolean;
sinks?: Record<string, unknown>;
[key: string]: unknown; [key: string]: unknown;
} }