Skip to content

Add two usage patterns and three future-enhancement proposals#1806

Merged
pmcelhaney merged 3 commits intomainfrom
copilot/review-usage-patterns
Apr 10, 2026
Merged

Add two usage patterns and three future-enhancement proposals#1806
pmcelhaney merged 3 commits intomainfrom
copilot/review-usage-patterns

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 9, 2026

Summary

Extends the usage patterns catalogue with two patterns covering currently-supported but undocumented features, and proposes three future patterns as GitHub issues.

New pattern files

  • Automated Integration Tests (docs/patterns/automated-integration-tests.md) — embeds Counterfact in a Jest/Vitest suite via beforeAll/afterAll using the programmatic API; shows contextRegistry for per-test flag toggling
  • Custom Middleware (docs/patterns/custom-middleware.md) — covers _.middleware.ts for auth gates, response headers (with randomUUID import), request logging, and scoped admin-only middleware

Index updates (docs/usage-patterns.md)

  • Two new rows in the pattern table
  • Updated intro paragraph to reference the new patterns

Issue proposals (.github/issue-proposals/) — all parented to #1805

  • docs-pattern-record-and-replay.md--record flag to capture proxy traffic into handler files
  • docs-pattern-webhook-simulation.md$.webhook() helper for outbound push events
  • docs-pattern-persistent-state.md--persist-state to serialize/restore context across restarts
Original Prompt

Issue: More usage patterns

Review the usage patterns and suggest candidates that haven't been documented yet. Include patterns that Counterfact doesn't support but should be considered for future enhancements.

Manual acceptance tests

  • docs/usage-patterns.md table contains rows for Automated Integration Tests and Custom Middleware; intro paragraph references both
  • docs/patterns/automated-integration-tests.md renders with a complete beforeAll/afterAll example using a shared config object (no duplicate config literal)
  • docs/patterns/custom-middleware.md renders with import { randomUUID } from "node:crypto" in the response-headers example
  • Three new files exist under .github/issue-proposals/ with valid YAML front matter (parentIssue: 1805) and non-empty bodies
  • All existing pattern files and cross-links are unchanged

Tasks

  • Added docs/patterns/automated-integration-tests.md documenting programmatic API usage in test suites
  • Added docs/patterns/custom-middleware.md documenting _.middleware.ts for cross-cutting concerns
  • Updated docs/usage-patterns.md table and intro paragraph
  • Created issue proposals for Record and Replay, Webhook Simulation, and Persistent State
  • Added .changeset/more-usage-patterns.md

Copilot AI linked an issue Apr 9, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Review usage patterns and suggest undocumented candidates Add two usage patterns and three future-enhancement proposals Apr 9, 2026
Copilot AI requested a review from pmcelhaney April 9, 2026 22:37
@pmcelhaney pmcelhaney marked this pull request as ready for review April 10, 2026 00:31
@pmcelhaney pmcelhaney enabled auto-merge April 10, 2026 00:31
@pmcelhaney pmcelhaney added this pull request to the merge queue Apr 10, 2026
Merged via the queue into main with commit 161f9d8 Apr 10, 2026
8 of 11 checks passed
@pmcelhaney pmcelhaney deleted the copilot/review-usage-patterns branch April 10, 2026 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

More usage patterns

2 participants