Skip to content

Slim rain.factory to the interface library (#46) - #47

Open
thedavidmeister wants to merge 1 commit into
mainfrom
slim-to-library
Open

Slim rain.factory to the interface library (#46)#47
thedavidmeister wants to merge 1 commit into
mainfrom
slim-to-library

Conversation

@thedavidmeister

Copy link
Copy Markdown
Contributor

The library half of the deploy/library split (#46). Practise run for the pattern before st0x.deploy.

What moves out

The deploy half is now in the new rain.factory.deploy repo (created, builds clean, 15/15 offline tests): concrete CloneFactory, LibCloneFactoryDeploy pins, src/generated/<tag>/ snapshots, Deploy.sol + BuildPointers.sol, and all their tests.

What remains here

The ICloneable* interface surface — the abstract API consumers import. It imports nothing, so this PR also drops the now-unused deploy-only deps (@openzeppelin-contracts, rain-extrospection, rain-deploy, rain-sol-codegen), the fs_permissions/rpc_endpoints/etherscan config, and the manual-sol-artifacts deploy workflow. rain.factory stays on rainix-autopublish — it's now a pure library repo, exactly one side of the split.

Verified: forge build clean on the interfaces-only tree; rainix pre-commit clean.

⚠️ Do not merge yet — sequencing

Merging republishes rain-factory (0.1.6) as interfaces-only. Consumers that import the deploy pins (LibCloneFactoryDeploy.CLONE_FACTORY_DEPLOYED_CODEHASH) — S01-Issuer/st0x.deploy at least — must first repoint to rain-factory-deploy. So this merges only after:

  1. feat(ci): rainix-tag-release — tag-triggered deploy-repo release rainix#280 (rainix-tag-release) lands + the Ankr fork-RPC key is restored (rain.factory.deploy's verify gate).
  2. rain.factory.deploy cuts its first release (sol-v0.1.x), publishing the deploy pins.
  3. Deploy-pin consumers migrate to rain-factory-deploy.

Interface-only consumers are unaffected throughout — that's why the library keeps the name. Sequencing tracked in #46.

Move the deploy half — concrete CloneFactory, LibCloneFactoryDeploy pins,
src/generated snapshots, deploy scripts, and their tests — to the new
rain.factory.deploy repo. What remains is the ICloneable* interface surface,
which imports nothing, so the deploy-only deps (openzeppelin, rain-extrospection,
rain-deploy, rain-sol-codegen), the fs_permissions/rpc/etherscan config, and the
manual-sol-artifacts deploy workflow all go too. Stays on autopublish.

DO NOT MERGE until rain.factory.deploy has published its first release and the
deploy-pin consumers (st0x.deploy) have repointed — else bumping to this version
drops the pins consumers still import from here.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@thedavidmeister thedavidmeister self-assigned this Jul 24, 2026
@coderabbitai

coderabbitai Bot commented Jul 24, 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: 22 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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: f81ba4c4-3a74-4c8a-ad02-4597b5269ac1

📥 Commits

Reviewing files that changed from the base of the PR and between 832e457 and 58a938e.

⛔ Files ignored due to path filters (3)
  • src/generated/0_1_3/CloneFactory.pointers.sol is excluded by !**/generated/**
  • src/generated/0_1_4/CloneFactory.pointers.sol is excluded by !**/generated/**
  • src/generated/0_1_5/CloneFactory.pointers.sol is excluded by !**/generated/**
📒 Files selected for processing (14)
  • .gas-snapshot
  • .github/workflows/manual-sol-artifacts.yaml
  • .github/workflows/package-release.yaml
  • foundry.toml
  • script/BuildPointers.sol
  • script/Deploy.sol
  • src/concrete/CloneFactory.sol
  • src/lib/LibCloneFactoryDeploy.sol
  • test/src/concrete/CloneFactoryCloneDeterministic.t.sol
  • test/src/concrete/TestCloneable.sol
  • test/src/concrete/TestCloneableFailure.sol
  • test/src/lib/LibCloneFactoryDeploy.t.sol
  • test/src/lib/LibCloneFactoryDeployProd.t.sol
  • test/src/lib/LibCloneFactoryDeployTaggedConstants.t.sol
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch slim-to-library

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 added a commit to rainlanguage/issue-pr-cron that referenced this pull request Jul 27, 2026
…pr_context fits itself to it (#81)

#79 made an over-budget tool result a typed error so the caller could not
improvise around it. For `pr_context` that guard never spoke. Its budget was
`max_diff_bytes + MCP_MAX_RESULT_BYTES` — up to 332,000 bytes against a harness
that stops at ~50,000 — so what reached the model was the HARNESS's replacement,
untyped and with `is_error` UNSET, which is precisely the silent degradation #79
existed to remove.

Ordering is the mechanism, not a preference: if the harness speaks first, every
rule downstream about "a tool error is an instruction, re-call narrower" stops
applying at the moment it is needed.

THE CEILING, MEASURED. Not derived by halving a refused payload — that is how
32,000 was set, and how this gap survived #79. Probed against Claude Code
2.1.220 by calling `pr_context` through the real harness at increasing
`max_diff_bytes` and reading the `tool_result` the model actually received.
There are TWO independent gates and BOTH arrive with `is_error` unset:

- a BYTE gate -> `<persisted-output> Output too large (NN KB)` plus a 2 KB
  preview. Delivered at 50,011 bytes, replaced at 50,176. NOT governed by
  `MAX_MCP_OUTPUT_TOKENS` (forcing it to 200,000 still replaced a 50,486-byte
  result). This one is the more dangerous: the preview it substitutes looks like
  the head of a real answer.
- a TOKEN gate -> `Error: result (N characters ...) exceeds maximum allowed
  tokens`, governed by that variable (forcing it to 100 replaced a 4.5 KB
  result). This is the gate the live traces hit, at 63,742 and 56,789 chars.

Isolating the token gate at `MAX_MCP_OUTPUT_TOKENS=10000` puts its boundary
between 27,152 and 30,163 bytes, so this JSON measures 2.7-3.0 chars/token;
nothing on the box sets the variable and 56,789 chars tripped it live, which
puts the default near 19-21k tokens. Both gates land around 50 kB here.

THE FIX.

- `MCP_MAX_RESULT_BYTES` is 36,000, ~28% under both gates. The margin is not
  timidity: the token gate scales with CONTENT, and a diff of generated hex —
  which this org has in every `src/generated/*.pointers.sol` — tokenises far
  worse than the prose-and-code JSON the gate was measured on. At 36,000 even a
  payload at 1.5 chars/token stays inside a 19k-token cap.
- ONE budget for every tool. `pr_context`'s special case is gone, and
  `max_diff_bytes` can no longer be raised past the budget, so no argument buys
  a call more room than any other call gets.
- That is also what makes NARROWING CONVERGE. While the budget scaled with
  `max_diff_bytes` and the diff was truncated to `max_diff_bytes`, lowering the
  argument lowered allowance and payload equally — "re-call NARROWER" was a loop
  with no exit. Against a fixed allowance a smaller argument is a strictly
  smaller result, pinned by a monotonicity test.
- `pr_context` does not wait to be refused: `fit_pr_context` shrinks the diff
  until the document lands under the budget. It terminates — each round removes
  at least the overflow from the cap, and one raw byte of diff is at least one
  byte of document, so it overshoots rather than undershoots. The document
  reports `diffBytes`, the new `diffIncluded`, and `diffTruncated`, so the gap
  between what exists and what was handed over is visible rather than inferred.
  The one case no argument can fix — metadata alone over the budget — is a typed
  error that says exactly that.

The budget/ceiling relationship is a COMPILE-TIME assertion beside the
constants, so raising the budget past the measured gate fails the build rather
than quietly reinstating the defect. Four of the ten mutations for this change
are killed that way; the rest by named tests.

Verified live, same PR (rainlanguage/rain.factory#47), same harness:

  BEFORE (main @7df5496), default argument:
    received: HARNESS byte-gate (untyped)   is_error=None   chars=2248
  AFTER, default argument:
    received: DELIVERED in full             is_error=None   chars=36631
  AFTER, max_diff_bytes=300000:
    received: OUR typed refusal             is_error=True   chars=46
    "max_diff_bytes must be an integer in 1..=36000"
    ...and the model then re-called within range and got the full result.

No part of the existing #81 work is weakened: the pull-ref checkout, the binary
postcondition, the sweep changes and the prompt rules are untouched.
@thedavidmeister thedavidmeister added the ai:reject AI vetter: needs rework (code issue) label Jul 28, 2026
@thedavidmeister

Copy link
Copy Markdown
Contributor Author

🤖 ai:vetter
Reviewed 58a938e: reject — Refs #46: missing QA evidence block; slimming incomplete — README "Concrete implementations" and CLAUDE.md still document the deleted CloneFactory/deploy half, and soldeer.lock still pins the four deploy-only deps foundry.toml drops (lock not regenerated).
cost 412 — repo-split deletion, cross-repo sequencing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:reject AI vetter: needs rework (code issue)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants