Documentation audit, and publish the mutation score as a badge - #53
Merged
Conversation
Audit of README, CLAUDE.md and docs/UPGRADE-2.0.md against what the code now does. Four things had gone stale or wrong: - CLAUDE.md described every action as implementing GenericTokenFactoryAwareInterface. Since #50 only AuthorizeAction does, and that is the package's one remaining contact with payum/core's deprecated GenericTokenFactoryInterface — worth saying so it stays that way. - The e2e section still claimed RefundAction refunds details['amount'] and that the gateway has no partial-refund parameter. Both untrue since #48: there are capture_amount/refund_amount keys, and a bare refund now uses the balance. Replaced with what the harness actually encodes — the listener resolving account-wide callbacks by order_id, which is how the two-url routing was found. - The README's details table credited balance to GetStatus, Sync and Notify but not Refund, which also refreshes it on its default path. - CLAUDE.md still said the alias map covers two required options; it covers three now, and the third (agreement) is optional and therefore the one that fails silently if missed. Also documents the ApiAwareTrait rationale (typed $api where payum/core's is mixed) where the actions are described, since that is the question the file should answer before someone deletes it as duplication.
Mutation testing already ran in CI; what was missing was anywhere to see the result. infection.json.dist gains the Stryker dashboard logger, the CI job passes through the STRYKER_DASHBOARD_API_KEY secret that the repository already has, and the README gains the badge next to coverage. The upload is branch-gated to 2.x, so pull request runs still compute the score and enforce the minMsi/minCoveredMsi gates but publish nothing — a PR cannot move the number on the badge before it is merged. Locally Infection detects it is not in CI and skips the upload entirely. Recorded in CLAUDE.md that the gated branch has to move when the working branch does, since the failure mode is a badge that quietly stops refreshing rather than anything that breaks.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.x #53 +/- ##
=========================================
Coverage 97.43% 97.43%
Complexity 126 126
=========================================
Files 14 14
Lines 351 351
=========================================
Hits 342 342
Misses 9 9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two commits: a documentation audit, and the mutation-score badge.
Mutation testing in CI — already there
Worth saying up front: the
mutation-testsjob already existed and has been runningcomposer infectionon PHP 8.3 with pcov in every build, gates included (minMsi 65/minCoveredMsi 70). Whatwas missing was anywhere to see the result.
So this wires the Stryker dashboard logger in
infection.json.dist, passes through theSTRYKER_DASHBOARD_API_KEYsecret the repository already has, and adds the badge to the README next tocoverage.
The upload is branch-gated to
2.x: pull request runs still compute the score and enforce thegates, but publish nothing, so a PR cannot move the badge before it is merged. Locally, Infection
detects it is not in CI and skips the upload — verified:
The badge will read "unknown" until this merges and the
2.xpush build performs the first upload.Documentation audit
Checked README,
CLAUDE.mdanddocs/UPGRADE-2.0.mdagainst what the code now does. Four things hadgone stale:
CLAUDE.mddescribed every action as implementingGenericTokenFactoryAwareInterface. Since Drop the unused token-factory wiring from CaptureAction #50only
AuthorizeActiondoes — and that is the package's one remaining contact with payum/core'sdeprecated
GenericTokenFactoryInterface, so it is worth saying so it stays that way.RefundActionrefundsdetails['amount']and that "the gateway has nopartial-refund parameter of its own". Both untrue since Surface the payment balance, add a SyncAction, and refund what is actually refundable #48. Replaced with what the harness actually
encodes now — the listener resolving account-wide callbacks by
order_id.balancetoGetStatus,SyncandNotify, butRefundalsorefreshes it on its default path.
CLAUDE.mdstill described the alias map as covering two required options. It covers three, and thethird (
agreement) is optional — the one that fails silently if missed.Also records why
Action/Api/ApiAwareTraitexists rather than payum/core's (it types$apiasApiwhere payum/core's is
mixed, which is what lets PHPStan see through the most-used dependency in thepackage), since that is the question the file should answer before someone deletes it as duplication.