Skip to content

Scope boolean-cst lint disables on the tuple-return bool literals - #588

Merged
thedavidmeister merged 1 commit into
mainfrom
issue-587-boolean-cst-lint
Sep 19, 2026
Merged

thedavidmeister merged 1 commit into
mainfrom
issue-587-boolean-cst-lint

Conversation

@thedavidmeister

Copy link
Copy Markdown
Contributor

Closes #587

What

A scoped //forge-lint: disable-next-line(boolean-cst) above each of the 21 return (true|false, ...) sites that forge lint -D warnings flags on main. Each directive has a one-line reason: the literal is the bool the function returns, not a condition operand. 11 files, 42 added comment lines and nothing else. No code changes, so no bytecode changes.

This is commit 864cf10 from #586, cherry-picked onto main unchanged. The diff against main matches 864cf10's own diff hunk for hunk. #586 reverts that commit so that each PR closes one issue.

Why

rainlanguage/rainix#378 added forge lint -D warnings to the shared rainix-sol-static workflow. main has not run CI since then, and any push now fails rainix-sol / static on these 21 findings, whatever the push changes. boolean-cst targets a boolean constant used as a condition operand. Each flagged literal is the success/match flag in a returned tuple, and with named returns banned there is no other way to write it. rainlanguage/rainlang.interface#140 made the same call for the same shape in LibParseMeta.lookupWord, and rain.lib.memkv's test/lib/LibMemoryKVSlow.sol carries the same disable.

QA

  • Discriminating test: the gate itself, forge lint -D warnings in github:rainlanguage/rainix/8657b83b68f41957ab85da91132c3f652c1f32c0#sol-shell (the shell CI pins), after forge soldeer install.
    • On main 5874169: 21 warning[boolean-cst], 0 of any other rule, then aborting due to 21 linter warning(s), exit 1.
    • On this branch at 1842c7d: 0 findings, exit 0. forge fmt --check exits 0.
  • Mutations applied: 24 in all, run by directive-mutation.sh.
    • Each of the 21 directives was neutralised one at a time, then lint was re-run. Every run exited non-zero with exactly 1 finding, boolean-cst, at the exact line that directive guards: 21 pass, 0 fail. So no directive is redundant and none silences a neighbour.
    • Scoping: 3 directives (two in src/, one in test/) were repointed from boolean-cst to unsafe-typecast. All 3 let the original finding back, at the guarded line: 3 pass, 0 fail. The disables are per-rule, not blanket.
    • Each pass required a positive match, so a run that failed to compile could not count as a pass. After each mutant the file was restored with git checkout and the tree was checked clean. HEAD was still 1842c7d at the end.
  • Oracle: the rule's own definition, not the tool's output. boolean-cst flags a boolean constant misused as a condition, for example if (x == true), require(true), or a constant operand of &&/||. Every flagged site returns a literal as the first element of a tuple whose declared type is bool, and the literal is the value the caller branches on. None is a condition operand. Precedents that made the same call independently: rainlang.interface#140 and rain.lib.memkv LibMemoryKVSlow.exists.
  • Category check: the issue lists all 21 findings: 10 in src/ and 11 in test/. Every one has a directive, and this branch has 21 directives (git grep count; main has 0). The flagged set is the whole forge lint output on main, so no other rule or site is failing. The other static steps (slither ., pre-commit run --all-files, rainix-sol-single-contract) are covered by CI on this PR.
  • Logs and the mutation script are in /home/gildlab/artifacts/rainlang/boolean-cst-lint/.

🤖 Generated with Claude Code

The rainix static job now runs `forge lint -D warnings`, which flags 21
`return (true|false, ...)` sites on unmodified main as boolean-cst. Each
literal is the bool the function returns, not a condition operand, so
each gets a scoped disable with that reason. Comments only: no code
changes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@thedavidmeister thedavidmeister self-assigned this Sep 18, 2026
@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: rainlanguage/rainlang/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: c0f417d3-86cc-491d-bc05-2ad2563c627e

📥 Commits

Reviewing files that changed from the base of the PR and between 5874169 and 1842c7d.

📒 Files selected for processing (11)
  • src/abstract/BaseRainlangSubParser.sol
  • src/concrete/extern/RainlangReferenceExtern.sol
  • src/lib/parse/LibSubParse.sol
  • src/lib/parse/literal/LibParseLiteral.sol
  • test/src/abstract/HappyPathLiteralSubParser.sol
  • test/src/abstract/MismatchedLiteralSubParser.sol
  • test/src/concrete/MockExternBadLiteralIndex.sol
  • test/src/lib/parse/BadLengthSubParser.sol
  • test/src/lib/parse/ConstantReturningSubParser.sol
  • test/src/lib/parse/ContextReturningSubParser.sol
  • test/src/lib/parse/MultiConstantSubParser.sol

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

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

@thedavidmeister
thedavidmeister merged commit 94e9155 into main Sep 19, 2026
5 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment:

S/M/L PR Classification Guidelines:

This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed.

Small (S)

Characteristics:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

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.

rainix-sol / static fails on main: forge lint -D warnings reports 21 boolean-cst findings

1 participant