test: mutation-harden CloneFactory coverage#37
Conversation
…rated) Ran an adversarial-mutation-test coverage pass over the only logic/constant- bearing units: CloneFactory.clone and LibCloneFactoryDeploy's deployed address/codehash constants. 14 behaviour mutations were probed (zero-code guard negate/bypass, wrong clone target, NewClone emit drop + each arg, init success-check negate/bypass/wrong constant, wrong return address, both custom-error selectors, and corrupted deploy address/codehash constants). Every mutant was killed by an existing discriminating test — the suite is mutation-saturated, so no new coverage tests were warranted. An adversarial correctness pass (reentrant clone, magic-value "liar" fallback) surfaced no bug. This commit lands only the committed scan record so org-wide health tracking can see the repo was scanned at this commit and found saturated. No source or test changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughA new audit file ChangesMutation Test Audit Record
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Closing: rain.factory test coverage is already mutation-saturated (14/14 mutants killed by the existing suite), so there is no coverage change to make. This PR only added a scan-record artifact that was not requested; no source/test value. Reporting saturation rather than landing a health-record file. |
Summary
Scoped adversarial-mutation-test coverage pass over
rain.factory. Result: the test suite for the only logic/constant-bearing units is mutation-saturated — every targeted mutation is already killed by an existing discriminating test, so no new coverage tests were warranted. This PR lands only the committed scan record (audit/mutation-test-scans.json) so org-wide health tracking can see this repo was scanned at this commit and found saturated. No source or test changes.Scanned commit:
59a6c4b(8 commits ahead ofv0.1.1).Scope surveyed
src/concrete/CloneFactory.sol—clone(address,bytes), the only logic-bearing function.forge coverage: 100% lines/statements/branches/funcs.src/lib/LibCloneFactoryDeploy.sol— the deterministic deployCLONE_FACTORY_DEPLOYED_ADDRESS+CLONE_FACTORY_DEPLOYED_CODEHASHconstants.deprecated/) andscript/Deploy.sol— no in-scope testable logic (pure interfaces / deploy script).Note: this factory has no create2 / deterministic-clone path, no address-prediction, and no registry/dedup — only the CREATE clone path exists, so those behaviour categories are N/A here.
Mutation matrix (all KILLED — 0 survivors)
code.length == 0→!= 0testZeroImplementationCodeSizeError+ clone tests== 0→== 1)testZeroImplementationCodeSizeError(downstream dataless revert) +testCloneUninitializableFailsClones.clone(implementation)→clone(msg.sender)testCloneBytecode(asserts proxy impl addr)emittestCloneInitializeEvent(entries.length0≠1)senderargtestCloneInitializeEvent(exactabi.encodedata)cloneargtestCloneInitializeEvent(exactabi.encodedata)!= ICLONEABLE_V2_SUCCESS→==testCloneInitializeFailureFailsif (false))testCloneInitializeFailureFails+testCloneInitializeDatareturn child→return implementationtestCloneBytecode+testCloneInitializeData+testCloneInitializeEventtestCloneInitializeFailureFails(exact selector)testZeroImplementationCodeSizeError(exact selector)CLONE_FACTORY_DEPLOYED_ADDRESStestDeployAddress(recomputes deterministic addr from real creationCode)CLONE_FACTORY_DEPLOYED_CODEHASHtestDeployAddress+testExpectedCodeHash(A single-nibble flip of the deploy address is an invalid mutation — it fails the EVM checksum at compile time — so LB1 was re-done as LB1b with a re-checksummed distinct address.)
Adversarial correctness pass (found no bug)
Derived intended behaviour from the
ICloneableFactoryV2/ICloneableV2NatSpec and falsification-tested against the real factory (throwaway probes, not committed):initializeproduces two distinct, correctly-pointed proxies and twoNewCloneevents. No cross-call corruption.No accounting/conservation/isolation/ordering issues apply (stateless, single-call, no value handling).
Verification
forge build: clean.forge fmt --check: clean.forge test: 8 pass / 5 fail — the 5 failures are theLibCloneFactoryDeployProdfork tests, which require*_RPC_URLsecrets not present in this environment (env-gated, pre-existing). Non-fork suite is green.git diff src/: empty (all mutations restored; no source touched).Remaining gaps checklist
script/Deploy.sol— 0% covered, but it is a deployment script (out of test-only scope); not hardened here.LibCloneFactoryDeployProdfork tests — could not run (no RPC secrets); unverified in this environment.Do not merge for coverage — there are no new tests. This is a scan-record-only PR documenting that the suite is saturated; merge only if you want the health-tracking record landed on
main.🤖 Generated with Claude Code
Summary by CodeRabbit