Refuse what used to be a fatal, and stop printing what must not be printed - #112
Merged
Conversation
…inted Understudy::for() on Throwable, UnitEnum, BackedEnum, DateTimeInterface or Traversable walked past every refusal in the factory and was answered by the compiler: a fatal out of eval(), uncatchable by try or by an adapter, and fatal to the whole suite run rather than to one test. A clock and an exception are the first two contracts anybody reaches for. Each is now an UnsupportedTarget naming the way through; Iterator, IteratorAggregate, Stringable and Countable keep doubling, because being built in was never the reason. A contract named twice in one list produced the same fatal and is now deduplicated. A #[\SensitiveParameter] is rendered as its type, the way PHP redacts one in its own traces. Its value used to go verbatim into the failure message and into transcript(), which is to say into a CI log. Three public paths threw a bare \InvalidArgumentException while UnderstudyError declares itself implemented by every exception this library throws -- so the catch llms.txt recommends walked past them. InvalidSpecificationArgument extends \InvalidArgumentException, so a catch by the SPL type keeps working, and it is what Arg::instanceOf() now throws for a class that is not loadable instead of matching nothing forever and saying so nowhere. The formatter no longer raises a PHP warning while rendering a failure -- (string) NAN warns on 8.5 -- and escapes control bytes and binary strings, which used to break the single line the escaping exists to keep. Documentation follows the code where the code was right: checkpoint() clears the settled calls, not the log; a declared property default survives and a promoted one does not; a built-in interface as a return type does not become a nested double; Arg::string() carries PCRE's own meaning of $. Both Security sections now say that arguments are printed verbatim except sensitive ones. The committed API pages are regenerated from the current src/ rather than a v0.5.0 snapshot. Fixes #102 Fixes #103 Fixes #104 Fixes #105 Fixes #106 Fixes #107 Fixes #108 Fixes #109 Fixes #110 Fixes #111
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: Warning Your free Security trial is over. An organization admin can upgrade to Advanced for continuous pull request security review or dismiss this notice. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merged
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.
Fixes #102. Fixes #103. Fixes #104. Fixes #105. Fixes #106. Fixes #107. Fixes #108. Fixes #109. Fixes #110. Fixes #111.
Batched into one branch: the findings are independent but the mutation gate is one run, and every one of them is a
src/or docs change in the same package.Uncatchable fatals (#102, #103)
Understudy::for(Throwable::class)— andUnitEnum,BackedEnum,DateTimeInterface,Traversable— walked past every refusal inDoubleFactoryand was answered by the compiler instead:Fatal error: … cannot implement interface Throwableout ofeval(). Not catchable bytry, not by an adapter, and fatal to the whole suite run rather than to one test. A clock and an exception are among the first contracts anyone tries to double.Each is now an
UnsupportedTargetnaming the way through.Iterator,IteratorAggregate,StringableandCountablestill double — being built in was never the reason, and a test pins that.Understudy::for(A::class, A::class)produced the same fatal (implements A, Adoes not compile); the list is deduplicated before generation.Secrets in the log (#108)
A parameter the contract marks
#[\SensitiveParameter]is rendered as its type —login('user', string SensitiveParameter)— in failure messages and intranscript(). The value used to go into both verbatim. The positions are resolved once, at generation time, with the rest of the reflection, and carried on theInvocation.The expectation half of the message is not redacted, and both Security sections now say so: those are the literals the test itself wrote, and they are in the test file already.
The exception contract (#107, #106)
UnderstudyErrorsays it is implemented by every exception this library throws, andllms.txttells users to catch it. Three paths threw a bare\InvalidArgumentException:Cardinality's two bounds checks andreturns()with no values.InvalidSpecificationArgumentextends\InvalidArgumentExceptionand implementsUnderstudyError, so acatchby the SPL type written yesterday keeps working.Arg::instanceOf('Nope\Missing')throws it too. It used to match nothing, forever, and say so nowhere — the reader saw "expected … but it was never called" and looked for the cause in the subject under test, whileUnderstudy::for()refuses the same input in the same breath.The formatter (#104, #105)
(string) NANwarns on PHP 8.5 — from inside the library, while it renders a message about a failure, which underfailOnWarningturns the report into a different failure. And control bytes travelled into the message and the transcript raw: a NUL, or half a broken UTF-8 sequence, breaking the single line the escaping exists to keep. Valid multibyte text is untouched, and the cut marker is never escaped as payload.Documentation (#109, #110, #111)
checkpoint()clears only the settled calls — the code was right and the text was not, inREADME.md,README.ru.mdandllms.txtalike. A declared property default survives while a promoted one does not (and$double->promotedtherefore differs from the real object). A built-in interface as a return type does not become a nested double.Arg::string()carries PCRE's own meaning of$.CannotWireandInvalidDefaultValuesay "has typearray" rather than "is aarray". The broken cookbook link inexamples/README.mdand the dead_plans/reference indocs.ymlare gone.The committed
docs/src/api/**and the snapshot are regenerated from the currentsrc/; they were built from a v0.5.0 snapshot and documented anInvocationconstructor that no longer exists.COMPLETENESS_BUDGETdrops in two categories, as the checker asked.Verification
composer buildgreen.make mutationgreen: Covered Code MSI 94% against theminMsi = 92gate, 182 escaped of 3067 — the level the package was at before this branch (the five refusal messages are asserted whole rather than by fragment, which is what pays for the new branches).make docs-buildgreen, including the integrity check and the anchor check.