Add PSR-15 correlation ID middleware.#1
Conversation
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
There was a problem hiding this comment.
Pull request overview
Adds a small, framework-agnostic correlation ID building block for the tiny-blocks PHP ecosystem: a PSR-15 middleware that propagates a correlation identifier through request attributes and response headers, plus a PSR-3 logger wrapper that injects the correlation ID into log context. The PR also introduces the repo’s canonical tooling, CI, and documentation scaffolding.
Changes:
- Introduce
CorrelationIdMiddleware(PSR-15) with a configurableCorrelationIdProviderand a default UUID v4 provider. - Add
CorrelatedLogger(PSR-3) to attachcorrelation_idinto log context using the request attribute. - Add unit tests, README/SECURITY docs, and canonical tiny-blocks tooling + GitHub workflows/templates.
Reviewed changes
Copilot reviewed 60 out of 61 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/CorrelationIdMiddlewareTest.php | Unit coverage for correlation ID middleware behavior (header reuse, generation, propagation). |
| tests/Unit/CorrelatedLoggerTest.php | Unit coverage for correlated logger resolution and context attachment. |
| tests/Unit/CapturingLogger.php | Test logger double to capture PSR-3 log entries for assertions. |
| tests/Unit/CapturingHandler.php | PSR-15 handler double that captures the processed request for assertions. |
| src/Internal/UuidCorrelationIdProvider.php | Default correlation ID provider implementation using UUID v4. |
| src/Internal/UuidCorrelationId.php | Internal CorrelationId implementation used by provider and header-wrapping logic. |
| src/Internal/CorrelationIdMiddlewareBuilder.php | Fluent builder for configuring the middleware provider. |
| src/Internal/CorrelationAttachingLogger.php | Internal logger decorator that merges correlation_id into context. |
| src/CorrelationIdProvider.php | Public extension point for correlation ID generation strategy. |
| src/CorrelationIdMiddleware.php | Public PSR-15 middleware that sets request attribute and response header. |
| src/CorrelationId.php | Public interface for correlation identifier values. |
| src/CorrelatedLogger.php | Public wrapper that resolves a logger decorated with correlation context. |
| SECURITY.md | Repository security policy (supported versions and reporting process). |
| README.md | Public documentation (overview, installation, usage examples). |
| phpunit.xml | PHPUnit configuration including coverage and logging outputs. |
| phpstan.neon.dist | PHPStan baseline config with scoped ignores for test fixtures. |
| phpcs.xml | PHPCS ruleset (PSR-12) for src/ and tests/. |
| Makefile | Docker-wrapped dev workflow targets (configure, review, tests, etc.). |
| infection.json.dist | Infection mutation-testing configuration enforcing MSI thresholds. |
| composer.json | Package metadata, dependencies, autoloading, and standard scripts. |
| CLAUDE.md | Tiny-blocks contributor conventions index and “definition of done” commands. |
| .gitignore | Ignores vendor, local overrides, caches, and report artifacts. |
| .github/workflows/codeql.yml | Adds scheduled and PR/push CodeQL security workflow. |
| .github/workflows/ci.yml | Adds canonical CI pipeline (build, review, tests) driven by composer scripts. |
| .github/workflows/auto-assign.yml | Auto-assign workflow for issues and pull requests. |
| .github/PULL_REQUEST_TEMPLATE.md | Standard PR template with checklist for review/tests. |
| .github/ISSUE_TEMPLATE/feature_request.md | Feature request issue template. |
| .github/ISSUE_TEMPLATE/bug_report.md | Bug report issue template. |
| .github/dependabot.yml | Dependabot config for Composer and GitHub Actions updates. |
| .github/copilot-instructions.md | Repository Copilot instructions pointing to CLAUDE rules. |
| .gitattributes | Export-ignore rules for Packagist tarball contents. |
| .editorconfig | Editor formatting baseline (120 cols, LF, etc.). |
| .claude/skills/tiny-blocks-create/SKILL.md | Skill documentation for scaffolding/restoring canonical tiny-blocks repo files. |
| .claude/skills/tiny-blocks-create/assets/github/workflows/ci.yml | Canonical CI workflow asset used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/github/PULL_REQUEST_TEMPLATE.md | Canonical PR template asset used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/github/ISSUE_TEMPLATE/feature_request.md | Canonical feature request template asset used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/github/ISSUE_TEMPLATE/bug_report.md | Canonical bug report template asset used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/docs/SECURITY.md | Canonical SECURITY.md asset used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/config/phpunit.xml | Canonical phpunit.xml asset used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/config/phpstan.neon.dist | Canonical phpstan.neon.dist asset used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/config/phpcs.xml | Canonical phpcs.xml asset used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/config/Makefile | Canonical Makefile asset used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/config/infection.json.dist | Canonical infection.json.dist asset used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/config/composer.json | Canonical composer.json asset template used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/config/.gitignore | Canonical .gitignore asset used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/config/.gitattributes | Canonical .gitattributes asset used by the create skill. |
| .claude/skills/tiny-blocks-create/assets/config/.editorconfig | Canonical .editorconfig asset used by the create skill. |
| .claude/skills/tiny-blocks-consume/SKILL.md | Skill documentation for discovering/reusing tiny-blocks packages. |
| .claude/skills/tiny-blocks-consume/scripts/refresh-catalog.py | Script to refresh the tiny-blocks catalog from Packagist. |
| .claude/skills/tiny-blocks-consume/references/catalog.md | Generated tiny-blocks package catalog snapshot. |
| .claude/skills/commit-message/SKILL.md | Skill documentation for tiny-blocks Conventional Commit messages. |
| .claude/settings.json | Claude tool permissions and post-edit conformance hooks configuration. |
| .claude/rules/php-library-tooling.md | Rule file defining tooling invariants for tiny-blocks PHP libs. |
| .claude/rules/php-library-testing.md | Rule file defining PHPUnit/Given-When-Then conventions. |
| .claude/rules/php-library-modeling.md | Rule file defining modeling/value-object/exception conventions. |
| .claude/rules/php-library-github-workflows.md | Rule file defining GitHub Actions workflow conventions. |
| .claude/rules/php-library-documentation.md | Rule file defining README/docs conventions. |
| .claude/rules/php-library-code-style.md | Rule file defining semantic PHP style rules used by the ecosystem. |
| .claude/rules/php-library-architecture.md | Rule file defining folder layout and public API boundary rules. |
| .claude/hooks/php-prose-punctuation-conformance.py | Hook enforcing punctuation rules in Markdown and PHP comments. |
| .claude/hooks/php-ordering-conformance.py | Hook enforcing deterministic ordering rules for PHP members/params. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.