Cap ContextColumn.cells at u8::MAX, matching context_columns - #275
Open
thedavidmeister wants to merge 1 commit into
Open
Cap ContextColumn.cells at u8::MAX, matching context_columns#275thedavidmeister wants to merge 1 commit into
thedavidmeister wants to merge 1 commit into
Conversation
The two axes of the context matrix were bounded differently: context_columns rejected a 256th entry while cells took any number. Both now carry the same count cap. The columns cap is not raised. Closes #198 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 12 minutes. View limit detailsLimit 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. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #198
The defect
Expression.context_columnscarries#[validate(length(max = "u8::MAX"))]. Itssibling axis,
ContextColumn.cells, carried no length bound at all — one axis ofthe same context matrix rejected a 256th entry while the other accepted 100000.
The fix
cellsgets the identicallength(max = "u8::MAX"). Both axes of the matrix arenow bounded the same way, and the model no longer says two different things about
how big a context matrix may be.
The columns cap is not raised. The issue's other branch — bump 255 to 256
because a
u8index addresses 0..=255 — reads the attribute as a bound on theindex; it is a bound on the count, which is what
length(max)measures. Caps inthis org are floor-only: a cap is not raised to admit one more entry. With the two
axes symmetric, the code now shows 255 as the rule rather than as an off-by-one in
one field, which is the "document 255" branch the issue offers.
The only documents this newly rejects are those with more than 255 cells in a
single column.
cellsappears nowhere in this repo outside this type and itstests, so nothing here indexes past 255 today.
Relation to the other open issues on this file
256. This PR answers no, and leaves the
context_columnsattribute and both ofits boundary tests (
test_length_constraints,test_context_columns_max_255)untouched — so InterpreterCallerMeta: context_columns cap length(max = u8::MAX) rejects 256 columns — off-by-one if the intent is u8-addressable column indices #221 needs no code change, only the ruling above.
Method.expressionspermits an empty array) and InterpreterCallerMeta.desc doc comment is a copy-paste of abi_name's ("Name of the caller..."), plus 'feild' typos #196 (descdoccomment is a copy-paste of
abi_name's, plus the "feild" typos) touch the samefile but different lines. Neither is in this diff and neither conflicts with it.
QA
meta::types::interpreter_caller::v1::tests::test_length_constraints, extended with the cells boundary (255 cells in one column validate, 256 fail) — fails on base, verified by deleting the new attribute atv1.rs:145and rerunning:called Result::unwrap_err() on an Ok value: InterpreterCallerMeta { ... }panicking atv1.rs:348, the 256-cell assertion. Attribute restored, re-run green (17 passed, 0 failed).v1.rs:145remove#[validate(length(max = "u8::MAX"))]fromContextColumn.cells(= the pre-fix body) -> killed bytest_length_constraints.v1.rs:127the same removal onExpression.context_columnsis outside this diff and already killed bytest_length_constraintsandtest_context_columns_max_255.context_columnsstates the context-matrix axis bound as "the count fits in au8" (255), andcellsis the other axis of that same matrix, so its expected boundary is 255 pass / 256 fail regardless of what the code did.cellscap. (2) is fixed here with the boundary test above. (1) is ruled rather than changed: it is a count cap and caps are not raised, socontext_columnsand its two boundary tests are deliberately untouched and the symmetry added here is the issue's own "document 255" branch. Both covered.cargo test -p rain-metadata --lib meta::types::interpreter_caller::v1(17 passed),cargo fmt --check -p rain-metadata,cargo clippy -p rain-metadata --lib --all-targets -- -D warnings(clean).