Skip to content

README: describe every constant LibCodeGen emits, not only function pointers - #122

Merged
thedavidmeister merged 5 commits into
mainfrom
2026-08-16-issue-87
Aug 17, 2026
Merged

README: describe every constant LibCodeGen emits, not only function pointers#122
thedavidmeister merged 5 commits into
mainfrom
2026-08-16-issue-87

Conversation

@thedavidmeister

@thedavidmeister thedavidmeister commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Closes #87

What was wrong

The README's opening said the library "hosts the constant caches for prebuilt
function-pointer tables". That is one of several things LibCodeGen emits, and
it is not what the repo's own committed example produces.

Confirmed against the source rather than taken from the issue:

  • src/lib/LibCodeGen.sol declares 11 emitting functions (the *ConstantString
    set).
  • Only 5 of the 11 concern function pointers (opcode, literal parser, operand
    handler, sub parser word parsers, integrity). The other 6 emit a
    deployed-bytecode hash, a described-by meta hash, and generic address,
    uint8, bytes32 and bytes constants.
  • src/generated/CodeGennable.sol, the only committed example output and the
    artifact the README itself tells you to regenerate, holds a BYTECODE_HASH
    and two bytes constants and zero function pointers.

What changed

README.md opening paragraph, and nothing else:

-(pragma + foundry-clean formatting) that hosts the constant caches for prebuilt
-function-pointer tables — needed for runtime gas efficiency in the Rain
-interpreter.
+(pragma + foundry-clean formatting) hosting build-time constants that a contract
+imports and the compiler inlines: prebuilt function-pointer tables (the case
+that motivates it — runtime gas efficiency in the Rain interpreter), a
+deployed-bytecode hash, a described-by meta hash, and plain
+`address`/`uint8`/`bytes32`/`bytes` constants.

No test guards this, and it can regress silently

This change is not covered by any test and can regress silently. If someone
adds a twelfth emitter to LibCodeGen, or edits this paragraph back toward the
function-pointer-only description, or deletes it, the suite stays green and CI
stays green. Nothing in this repo compares the README against the emitter set.
The only thing standing between that drift and a reader is review of the diff.

This is not being rehomed. rainlanguage/rainix#317 collects the checks from
this sweep that a generic rainix-static lint could express; a hand-written map
from LibCodeGen's emitter names to English phrases in this repo's README is not
one of them, so #317 is not its home either. There is no follow-up issue and no
deferred coverage — the documentation fix lands unguarded, deliberately.

What this PR previously carried, and why it is gone

An earlier revision of this branch added test/src/lib/LibCodeGen.readme.t.sol
(252 lines) plus two fs_permissions read grants (README.md,
src/lib/LibCodeGen.sol) so it could vm.readFile both. That test has been
deleted and both grants reverted, so foundry.toml is now byte-identical to
main.

It was written because the brief driving this fleet of fixes said every fix
ships a test and verify-by-hand is never acceptable, with no exemption for
changes that have no behaviour. That instruction was wrong and has been
corrected. A README wording fix has no behaviour to test, and the test it
produced was hand-rolled static analysis written in Solidity:

  • 170 of its 252 lines were eight internal string-scanning helpers, and 2 of its
    3 test functions asserted on those helpers rather than on anything in src/.
  • It pinned seven README substrings, so it fought the next README edit rather
    than protecting the library.
  • It restated LibCodeGen's declaration list as EXPECTED_EMITTER_COUNT = 11
    plus an order-sensitive name list, so reordering two functions — a change with
    no behaviour at all — would have turned the suite red.

QA

nix develop -c forge test:

Ran 18 test suites in 2.03s (18.23s CPU time): 142 tests passed, 0 failed, 0 skipped (142 total tests)

Before the strip (same merge commit, test file and grants still present):
Ran 19 test suites: 145 tests passed, 0 failed, 0 skipped (145 total tests)
the drop is exactly the 3 functions removed, and every remaining test passes.

nix develop -c forge fmt --check: exit 0, no diff. pre-commit
(no-consumer-prettier, taplo, denofmt): Passed on the commit.

origin/main is merged in (merge commit, not a rebase); the branch predated
merged PRs #110 and #124.

…ointers

The opening said the library hosts the constant caches for prebuilt
function-pointer tables. Function pointers are 5 of the 11 emitting
functions in LibCodeGen, and the committed example artifact
src/generated/CodeGennable.sol holds a bytecode hash and two bytes
constants and no function pointers at all.

test/src/lib/LibCodeGen.readme.t.sol scans the emitting declarations out
of src/lib/LibCodeGen.sol and asserts the README's opening names a phrase
for each, so a new emitter with no prose fails rather than passing
silently. foundry.toml grants the two reads that test needs.

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

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@thedavidmeister, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 seconds

Limit details: You’ve used all 1 included review currently available under your plan.

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

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 852c52a4-094f-4317-b681-f68d514a48fc

📥 Commits

Reviewing files that changed from the base of the PR and between b422d97 and df84753.

📒 Files selected for processing (1)
  • README.md

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.

claude and others added 4 commits August 16, 2026 18:46
Drops a fixed upper bound and the assertion guarding it, which no input in
this repo reaches and no test can therefore cover.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Deletes test/src/lib/LibCodeGen.readme.t.sol and reverts the two
fs_permissions read grants (README.md, src/lib/LibCodeGen.sol) it needed.
The README edit this PR exists for is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@thedavidmeister
thedavidmeister merged commit f83c2d8 into main Aug 17, 2026
5 checks passed
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.

README's opening describes only the function-pointer use case, contradicted by LibCodeGen's surface and by the repo's own committed example

2 participants