Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@

All notable changes to this bundle. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow [SemVer](https://semver.org/) and come from the Git tags.

## [0.3.0] - 2026-12-04

No action is needed on upgrade: the new client loads only when its library is installed and the adapter `gitlab` is enabled, and there is no migration.

### Added

- `Reply\Gitlab\GitlabReplyClient`, which posts answers to GitLab with the reply connection of an endpoint and does nothing else: `replyToDiscussion()` (a reply in an existing discussion of a merge request or an issue), `addNote()` (a new note on a merge request or an issue) and `currentUser()` (the user of the token), returning the value objects `GitlabNote` and `GitlabUser`; `GitlabNoteable` selects merge request or issue. The reply connection is an `ApiConfiguration` of the type `gitlab` with the config keys `base_url` (absolute http(s) root URL without a path) and `token` (encrypted, decrypted with `ConfigSecrets::decrypt()`), a contract with the application's GitLab connection schema; the bundle registers no connection type. Failures are exceptions under `Reply\Gitlab\Exception\` (`GitlabReplyException`: `ReplyConnectionException` before any request, `DiscussionNotFoundException` for 404 and `DiscussionNotRepliableException` for 400 on a reply, `GitlabRequestFailedException` otherwise). Redirects are never followed, the token appears in no exception message or log line, and the client checks no permission: the bot's GitLab role and token scope are the boundary. Built on `m4tthumphrey/php-gitlab-api` over `symfony/http-client`; the library client is not exposed.
- Conditional loading of components on suggested libraries: the client is registered (private, autowired, log channel `webhook`) only when `Gitlab\Client` exists and the adapter `gitlab` is enabled; otherwise nothing of it is in the container. The decision lives in `WebhookBundle::loadsOptionalComponent()`, the library check in `DependencyInjection\OptionalLibraries` (the bundle's new optional constructor argument; marker classes passed to it count as not installed).
- The service id `dmstr_webhook.reply_http_client` (`WebhookBundle::REPLY_HTTP_CLIENT`), the HTTP transport of the reply clients: an alias of FrameworkBundle's `http_client` unless the application defines it itself, e.g. as a `MockHttpClient` in its tests. Without a transport the client is removed and the container still builds (`DependencyInjection\Compiler\RemoveReplyClientsWithoutTransportPass`).
- Suggestions `m4tthumphrey/php-gitlab-api` (`^12.1.1`) and `symfony/http-client`; the library and `nyholm/psr7` are development requirements. `config.allow-plugins` denies `php-http/discovery`, so the library's discovery plugin never runs in this repository.
- Kernel variants of the container test: without the GitLab library, with the adapter `gitlab` disabled, with the host's own reply transport, and without `http_client`; tests of the client against a recording HTTP fake with fixtures in the shape of GitLab 15.11 responses.
- README section on the GitLab reply client.

## [0.2.1] - 2026-12-03

No action is needed on upgrade: the new adapter is disabled by default, and there is no migration.
Expand Down Expand Up @@ -129,3 +142,4 @@ Initial public release.
<!-- - revised 2026-12-03 (unreleased entry tidied into one: upgrade note, adapter contract, constructors, routes API) -->
<!-- - revised 2026-12-03 (GitLab adapter, fixtures and guard, type-info requirement, release heading 0.2.0) -->
<!-- - revised 2026-12-03 (0.2.1: Basecamp 4 adapter, verifyPathSecret(), source-neutral test support) -->
<!-- - revised 2026-12-04 (0.3.0: GitLab reply client, conditional loading, reply transport, suggestions and allow-plugins) -->
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ Replay-window tests build their Standard Webhooks signatures with the time of a
- The bundle checks only permissions with `is_granted()`: the constants of `Dmstr\Webhook\Security\WebhookPermissions`, tagged `za7_core.permission` in `config/services.yaml`. No `ROLE_*` name is checked in `src/` or `config/`; the host application maps permissions to roles through its own voter. The tag name `za7_core.permission` stays. A new permission gets a constant, a tag, a test and a README update in the same change.
- The bundle never prepends `api_platform.mapping.paths`: API Platform adds the host application's default resource directories only while that list is empty, so a prepended path drops the host's own resources. The bundle's resources are discovered through the registered bundle (`src/Entity`); guarded by `tests/Unit/DependencyInjection/WebhookBundlePrependTest.php` and `tests/Integration/WebhookWiringTest.php`.
- Hard requirements stay minimal: monolog, the lock component, the clock component, the security bundle and the audit-log bundle are optional (`suggest`), and the container must build without them; `clock` and `lock.factory` are optional references.
- Components that depend on a suggested package (today `Dmstr\Webhook\Reply\Gitlab\GitlabReplyClient` on `m4tthumphrey/php-gitlab-api`) load only when the package is installed and the matching adapter is enabled: one decision, `WebhookBundle::loadsOptionalComponent()`, with the library check in `DependencyInjection\OptionalLibraries` (never a second `class_exists()` elsewhere). Such classes stay out of resource discovery (`src/Reply/` is excluded in `config/services.yaml`), so the container builds without the package; their HTTP transport is the service `dmstr_webhook.reply_http_client`, and without one they are removed. `tests/Integration/ContainerVariantsTest.php` proves it (package absent through `new OptionalLibraries([...])` in the test kernel, adapter off, adapter on, no `http_client`); a new optional component adds its variants there.
- Secrets never appear in responses (only the mask `********`), exception messages, console output or logs; the payload of an event is in no serialization group. No text of a source object (e.g. a note body) enters the event context, route variables or log lines; it stays in the stored payload.

<!-- - revised 2026-12-03 (database tests on PostgreSQL and MySQL 8 in CI, layout of src/Model and src/Routing, intake test matrix, public names of 0.2.0) -->
<!-- - revised 2026-12-03 (GitLab fixtures and the anonymisation guard) -->
<!-- - revised 2026-12-03 (Basecamp 4 fixtures, documented origin, source-neutral fixture set, matrix and sequence runner, anonymisation guard per source) -->
<!-- - revised 2026-12-04 (invariant on components of suggested packages) -->
Loading
Loading