Skip to content

Raise Infection from no-op to enforced signal and cover newly exposed mutation gaps#54

Open
Copilot wants to merge 7 commits intomasterfrom
copilot/integrate-infection-into-ci-pipeline
Open

Raise Infection from no-op to enforced signal and cover newly exposed mutation gaps#54
Copilot wants to merge 7 commits intomasterfrom
copilot/integrate-infection-into-ci-pipeline

Conversation

Copy link
Copy Markdown

Copilot AI commented May 2, 2026

The Infection job was effectively non-blocking and under-configured: CI accepted any MSI, and PHPStan integration was memory-constrained enough to blur real signal. This PR tightens the mutation gate to the current measured baseline and adds targeted regression coverage for escaped mutants surfaced by the stricter run.

  • Infection policy

    • move MSI enforcement into /home/runner/work/Stringy/Stringy/infection.json.dist
    • set:
      • minMsi: 87
      • minCoveredMsi: 87
    • add staticAnalysisToolOptions: "--memory-limit=512M" so PHPStan-backed mutation analysis remains usable under Infection
  • CI behavior

    • stop overriding Infection with --min-msi=0 --min-covered-msi=0
    • keep CI aligned with the checked-in Infection config instead of a weaker workflow-specific invocation
  • Regression coverage for escaped mutants

    • StaticStringyTest
      • assert invalid method message content
      • force refresh of the cached methodArgs map before validating __callStatic() argument counting
    • CollectionStringyTest
      • verify CollectionStringy::create() still enforces element type validation by default
    • StringyTest
      • cover full concatenation behavior in appendStringy()
      • cover default empty-value preservation in words()
      • cover default chunk size behavior in chunk() and chunkCollection()
  • Net effect

    • Infection now acts as an actual gate
    • the stricter run exposed real missing assertions rather than configuration noise
    • the added tests lock in the currently recovered behavior while leaving remaining escaped mutants visible for follow-up tightening
{
  "staticAnalysisTool": "phpstan",
  "staticAnalysisToolOptions": "--memory-limit=512M",
  "minMsi": 87,
  "minCoveredMsi": 87
}

This change is Reviewable

Copilot AI and others added 6 commits May 2, 2026 12:22
Agent-Logs-Url: https://github.com/voku/Stringy/sessions/2c8029b4-d144-46a7-b8a3-25148223b5ec

Co-authored-by: voku <264695+voku@users.noreply.github.com>
Agent-Logs-Url: https://github.com/voku/Stringy/sessions/2c8029b4-d144-46a7-b8a3-25148223b5ec

Co-authored-by: voku <264695+voku@users.noreply.github.com>
Copilot AI assigned Copilot and voku May 2, 2026
@voku voku marked this pull request as ready for review May 2, 2026 20:15
@coveralls
Copy link
Copy Markdown

coveralls commented May 2, 2026

Coverage Status

coverage: 97.891%. remained the same — copilot/integrate-infection-into-ci-pipeline into master

@voku
Copy link
Copy Markdown
Owner

voku commented May 2, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces mutation testing configuration via infection.json.dist and expands the test suite to cover default behaviors for the create, appendStringy, words, and chunk methods. It also refines existing tests by adding exception message checks and ensuring cache resets during static analysis testing. Feedback was provided regarding the static analysis suppression in CollectionStringy.php, suggesting the addition of an explanatory marker for better clarity and consistency with the rest of the codebase.

Comment thread src/CollectionStringy.php Outdated
string $iteratorClass = \Arrayy\ArrayyIterator::class,
bool $checkPropertiesInConstructor = true
) {
/** @phpstan-ignore-next-line */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The use of a broad /** @phpstan-ignore-next-line */ without an explanatory comment is discouraged as it can hide unrelated static analysis issues on the same line. For consistency with other ignores in this file (e.g., lines 95 and 110), consider adding a brief explanation or a marker like | FP? to indicate why this suppression is necessary.

        /** @phpstan-ignore-next-line | FP? */

@voku
Copy link
Copy Markdown
Owner

voku commented May 2, 2026

@copilot PS: upfront my two cent, since version 2 of phpstan we can and should use suppress errors by identifier and not per line anymore! Now your task, check if the next llm generated feedback is valid or just AI slop: Code Review
This pull request introduces mutation testing configuration via infection.json.dist and expands the test suite to cover default behaviors for the create, appendStringy, words, and chunk methods. It also refines existing tests by adding exception message checks and ensuring cache resets during static analysis testing. Feedback was provided regarding the static analysis suppression in CollectionStringy.php, suggesting the addition of an explanatory marker for better clarity and consistency with the rest of the codebase.

src/CollectionStringy.php
string $iteratorClass = \Arrayy\ArrayyIterator::class,
bool $checkPropertiesInConstructor = true
) {
/** @phpstan-ignore-next-line */
@gemini-code-assist
gemini-code-assist Bot
19 minutes ago
medium

The use of a broad /** @phpstan-ignore-next-line */ without an explanatory comment is discouraged as it can hide unrelated static analysis issues on the same line. For consistency with other ignores in this file (e.g., lines 95 and 110), consider adding a brief explanation or a marker like | FP? to indicate why this suppression is necessary.

    /** @phpstan-ignore-next-line | FP? */

Copy link
Copy Markdown
Author

Copilot AI commented May 2, 2026

@copilot PS: upfront my two cent, since version 2 of phpstan we can and should use suppress errors by identifier and not per line anymore! Now your task, check if the next llm generated feedba...

The feedback was valid. I reproduced the suppressed PHPStan error, confirmed the identifier is return.type, and replaced the broad suppression with an identifier-based one in 3b374b2.

Copilot finished work on behalf of voku May 2, 2026 20:48
Copilot AI requested a review from voku May 2, 2026 20:48
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.

3 participants