Skip to content

test InsufficientFlowOutputs revert and boundary#442

Open
thedavidmeister wants to merge 1 commit intomainfrom
2026-05-04-issue-311-321-insufficient-flow-outputs-test
Open

test InsufficientFlowOutputs revert and boundary#442
thedavidmeister wants to merge 1 commit intomainfrom
2026-05-04-issue-311-321-insufficient-flow-outputs-test

Conversation

@thedavidmeister
Copy link
Copy Markdown
Contributor

@thedavidmeister thedavidmeister commented May 4, 2026

Summary

Pins the flowInit guard that rejects deployer-returned flowOutputs < MIN_FLOW_SENTINELS (= 3). Two tests:

  • Negative (fuzzed): any flowOutputs in [0, MIN_FLOW_SENTINELS) reverts with InsufficientFlowOutputs.
  • Boundary: flowOutputs == MIN_FLOW_SENTINELS is accepted (lowest valid value).

Mutation verified: inverting the check (<>=) makes both tests fail; reverting passes.

Closes #311 #321.

Test plan

  • testFlowConstructionRevertsOnInsufficientFlowOutputs — 100 fuzz runs
  • testFlowConstructionAcceptsFlowOutputsAtMin — 2048 fuzz runs
  • mutation: invert the check in Flow.sol:206 → both tests fail

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Tests
    • Added validation tests to verify flow initialization rejects insufficient output parameters
    • Added boundary condition tests confirming minimum acceptable output values are properly handled

Pins the lower-bound guard that rejects flowOutputs < MIN_FLOW_SENTINELS
returned by the deployer. Two tests:

- Negative: any flowOutputs in [0, MIN_FLOW_SENTINELS) reverts with
  InsufficientFlowOutputs.
- Boundary: flowOutputs == MIN_FLOW_SENTINELS is accepted (lowest valid).

Mutation verified: inverting the check (`<` → `>=`) makes both tests
fail; reverting passes.

Closes #311 #321.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Walkthrough

This PR adds test coverage for the InsufficientFlowOutputs error in Flow construction by introducing two test cases: one that fuzzes flowOutputs below the minimum threshold to verify reversion, and another that pins flowOutputs at the minimum boundary to verify successful construction.

Changes

Flow Construction Test Coverage

Layer / File(s) Summary
Imports
test/src/concrete/Flow.construction.t.sol
Added imports for InsufficientFlowOutputs error type and MIN_FLOW_SENTINELS constant to enable test assertions.
Test Implementation
test/src/concrete/Flow.construction.t.sol
Added testFlowConstructionRevertsOnInsufficientFlowOutputs to fuzz flowOutputs < MIN_FLOW_SENTINELS and assert reversion; added testFlowConstructionAcceptsFlowOutputsAtMin to pin boundary condition and verify construction succeeds at minimum threshold.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test InsufficientFlowOutputs revert and boundary' directly and specifically describes the main changes: adding tests for the InsufficientFlowOutputs revert path and its boundary condition.
Linked Issues check ✅ Passed The PR implements the coding requirements from issues #311 and #321: it adds test coverage for InsufficientFlowOutputs revert and validates the MIN_FLOW_SENTINELS boundary through two comprehensive test functions with fuzzing.
Out of Scope Changes check ✅ Passed All changes are within scope: the modifications are limited to test file additions in Flow.construction.t.sol that directly address the InsufficientFlowOutputs coverage gap specified in the linked issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-05-04-issue-311-321-insufficient-flow-outputs-test

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.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/src/concrete/Flow.construction.t.sol`:
- Around line 42-45: Add an explicit fuzz-run pin for the boundary test by
configuring the test to run a fixed number of fuzz iterations (e.g., 2048) so
the sweep is stable and reproducible; update the test harness or metadata for
the function testFlowConstructionAcceptsFlowOutputsAtMin to include the
forge-config / fuzz-runs directive (matching the pattern used in the revert
test), ensuring the test is executed with the pinned run count every time.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 35a821b2-2973-436d-b85a-7756f2d5038f

📥 Commits

Reviewing files that changed from the base of the PR and between ceaea3c and 1cf7d5e.

📒 Files selected for processing (1)
  • test/src/concrete/Flow.construction.t.sol

Comment on lines +42 to +45
/// `flowOutputs == MIN_FLOW_SENTINELS` is the lowest accepted value.
/// Pinning this boundary against regression complements the negative
/// test above.
function testFlowConstructionAcceptsFlowOutputsAtMin(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add explicit fuzz-run pin for the boundary test.

Line 45 introduces the boundary test, but unlike the revert test it does not pin fuzz runs. If the intent is the stated 2048-run boundary sweep, add an explicit forge-config line so this is stable and reproducible.

Suggested patch
     /// `flowOutputs == MIN_FLOW_SENTINELS` is the lowest accepted value.
     /// Pinning this boundary against regression complements the negative
     /// test above.
+    /// forge-config: default.fuzz.runs = 2048
     function testFlowConstructionAcceptsFlowOutputsAtMin(
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// `flowOutputs == MIN_FLOW_SENTINELS` is the lowest accepted value.
/// Pinning this boundary against regression complements the negative
/// test above.
function testFlowConstructionAcceptsFlowOutputsAtMin(
/// `flowOutputs == MIN_FLOW_SENTINELS` is the lowest accepted value.
/// Pinning this boundary against regression complements the negative
/// test above.
/// forge-config: default.fuzz.runs = 2048
function testFlowConstructionAcceptsFlowOutputsAtMin(
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/src/concrete/Flow.construction.t.sol` around lines 42 - 45, Add an
explicit fuzz-run pin for the boundary test by configuring the test to run a
fixed number of fuzz iterations (e.g., 2048) so the sweep is stable and
reproducible; update the test harness or metadata for the function
testFlowConstructionAcceptsFlowOutputsAtMin to include the forge-config /
fuzz-runs directive (matching the pattern used in the revert test), ensuring the
test is executed with the pinned run count every time.

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.

[A02-2] [MEDIUM] InsufficientFlowOutputs has no test coverage

1 participant