property.rent-review
New rent after an index-linked (CPI/RPI) rent review, with an optional collar and cap and upward-only option.
1.0.0 (not the latest) · published 2026-10-03 by charlie · Anterra
Pinned by 19 tests, run in TypeScript, Python and Rust.
Not professional advice. This capability calculates property figures from published rules. It is a software component for developers, not legal or financial advice. Rules change and every rate here has an effective date. Check that the dates cover your case. Verify results against the official sources listed in its README, and have a conveyancer or tax adviser review how you use it, before anyone relies on the output. Provided “as is” under its licence, without warranty.
What it does
An index-linked rent review, the usual kind in a commercial lease: the rent moves with an inflation index (CPI or RPI, or CPIH) between a base date and the review date, often held between a **collar** (a minimum increase) and a **cap** (a maximum), and often **upward-only** (it can never go down).
The caller supplies the two index values, in any integer unit as long as both use the same one (CPI 128.4 and 133.9 can be 1284 and 1339). The function never looks an index up: which month's figure counts, and which series, is a term of the lease.
For example
rent_review(£50,000.00, 1,200, 1,320, —, —, true)→ new rent £55,000.00, index rent £55,000.00, index change basis points 10%, applied by index index up 10%, no collar or cap: £55,000rent_review(£50,000.00, 1,200, 1,320, 2%, 4%, true)→ new rent £52,000.00, index rent £55,000.00, index change basis points 10%, applied by cap index up 10% with a 4% cap: £52,000rent_review(£50,000.00, 1,200, 1,236, 2%, 4%, true)→ new rent £51,500.00, index rent £51,500.00, index change basis points 3%, applied by index index up 3% between a 2% collar and 4% cap
The function
The same function in TypeScript, Python and Rust, pinned by the same tests. Pick your language; the choice follows you around the registry.
pub fn rent_review(passing_rent: &Money, base_index: i64, review_index: i64, collar_basis_points: Option<i64>, cap_basis_points: Option<i64>, upward_only: bool) -> RentReviewResult
| passing_rent | Money | the rent before the review, zero or more |
| base_index | int | the index at the base date, in any integer unit (1284 for 128.4), greater than zero |
| review_index | int | the index at the review date, in the same unit, greater than zero |
| collar_basis_points | int? | the least increase over the whole review period, 200 = 2%; null for none |
| cap_basis_points | int? | the most increase over the whole review period, 400 = 4%; null for none |
| upward_only | bool | true: the rent never falls below the passing rent |
| returns | RentReviewResult |
The types it declares, generated into your project
// RentReviewRule is a string in Rust, one of: "index", "collar", "cap", "upward-only".
// Parameters take it as &str and results hold it as String.
/// The reviewed rent, what the index alone would give, and which term decided it.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RentReviewResult {
/// the rent from the review date
pub new_rent: Money,
/// passing rent × reviewIndex ÷ baseIndex, before any collar, cap or floor
pub index_rent: Money,
/// the index movement, rounded half-up; for display only
pub index_change_basis_points: i64,
/// the term that set the new rent
pub applied_by: String,
}
Your code names it in one line, in the file that uses it
fune!(property.rent-review@^1); // then call rent_review(…)
Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.
use super::funejson::Value; ← the fune runtime: the JSON value the test vectors use; fune build keeps it only where a signature takes one
use super::math_round_div::round_div; ← from math.round-div ^1.0.0 · built alongside by fune
use super::money_amount::{money, money_from_value, money_to_value, Money}; ← from money.amount ^1.0.0 · built alongside by fune
const MAX_RENT: i64 = 1_000_000_000;
const MAX_INDEX: i64 = 1_000_000;
fn check_basis_points(name: &str, value: Option<i64>) {
if let Some(v) = value {
if v <= -10000 || v > 100000 {
panic!("{} must be an integer from -9999 to 100000, received {}", name, v);
}
}
}
/// The rent after an index-linked review, held between an optional collar and
/// cap, and not below the passing rent when upward-only. Every comparison is
/// on exact fractions and the rent is rounded half-up once.
///
/// # Panics
/// Panics on a rent or index out of range, a collar or cap out of range, or a
/// collar above the cap.
pub fn rent_review(
passing_rent: &Money,
base_index: i64,
review_index: i64,
collar_basis_points: Option<i64>,
cap_basis_points: Option<i64>,
upward_only: bool,
) -> RentReviewResult {
if passing_rent.minor < 0 || passing_rent.minor > MAX_RENT {
panic!("passingRent must be between 0 and {} minor units, received {}", MAX_RENT, passing_rent.minor);
}
for (name, value) in [("baseIndex", base_index), ("reviewIndex", review_index)] {
if value <= 0 || value > MAX_INDEX {
panic!("{} must be an integer from 1 to {}, received {}", name, MAX_INDEX, value);
}
}
check_basis_points("collarBasisPoints", collar_basis_points);
check_basis_points("capBasisPoints", cap_basis_points);
if let (Some(collar), Some(cap)) = (collar_basis_points, cap_basis_points) {
if collar > cap {
panic!("collar {} is above cap {}", collar, cap);
}
}
let p = passing_rent.minor;
// The multiplier as a fraction num/den: the index ratio, or 1 + collar/cap.
let (mut num, mut den, mut rule) = (review_index, base_index, "index");
match (cap_basis_points, collar_basis_points) {
(Some(cap), _) if review_index * 10000 > base_index * (10000 + cap) => {
num = 10000 + cap;
den = 10000;
rule = "cap";
}
(_, Some(collar)) if review_index * 10000 < base_index * (10000 + collar) => {
num = 10000 + collar;
den = 10000;
rule = "collar";
}
_ => {}
}
if upward_only && num < den {
num = 1;
den = 1;
rule = "upward-only";
}
RentReviewResult {
new_rent: money(round_div(p * num, den, "half-up"), &passing_rent.currency),
index_rent: money(round_div(p * review_index, base_index, "half-up"), &passing_rent.currency),
index_change_basis_points: round_div((review_index - base_index) * 10000, base_index, "half-up"),
applied_by: rule.to_string(),
}
}
pub fn rent_review_result_to_value(result: &RentReviewResult) -> Value {
Value::obj(vec![
("newRent", money_to_value(&result.new_rent)),
("indexRent", money_to_value(&result.index_rent)),
("indexChangeBasisPoints", Value::Int(result.index_change_basis_points)),
("appliedBy", Value::str(&result.applied_by)),
])
}
fn optional_int(value: &Value, name: &str) -> Option<i64> {
match value {
Value::Null => None,
Value::Int(v) => Some(*v),
_ => panic!("{} must be an integer from -9999 to 100000, received {:?}", name, value),
}
}
fn int_arg(value: &Value, name: &str) -> i64 {
match value {
Value::Int(v) => *v,
_ => panic!("{} must be an integer from 1 to {}, received {:?}", name, MAX_INDEX, value),
}
}
pub fn fune_vector(args: &[Value]) -> Value {
rent_review_result_to_value(&rent_review(
&money_from_value(&args[0]),
int_arg(&args[1], "baseIndex"),
int_arg(&args[2], "reviewIndex"),
optional_int(&args[3], "collarBasisPoints"),
optional_int(&args[4], "capBasisPoints"),
args[5].as_bool(),
))
}Install
fune build
With that line in your source, in a Rust project (language rust in fune.project), fune build resolves it and its 2 dependencies, pins them in fune.lock, downloads only the Rust package of each, and builds the code above into your project’s .fune/build, one readable file per capability with a header linking back here. A crate’s build.rs runs it before every compile. Or pin a range in fune.project and build in one step:
fune add property.rent-review
The manifest, vectors and README with only the Rust implementation. Install it without the registry with fune add ./property.rent-review-1.0.0-rust.fune, or fetch it from a terminal with fune pull property.rent-review@1.0.0:rust.
The whole function, every language, is one file too: property.rent-review-1.0.0.fune, 23,138 bytes, sha256 11f422817ecdd81cdfd1978d0b5952d1439bfd09691e5e2fef8fc0e5aa29d59e. It installs into a project of any language.
Customise it in your app
The seams this capability offers. Put a marker directly above a function of your own and fune build wires it into the built code; the package on the registry is not changed, the built file’s header lists it under CUSTOMISED, and fune hooks lists every hook in the project. How hooks work.
before — your function gets the arguments and returns them, changed or not, or throws to refuse the call.
// fune: before property.rent-review
after — your function gets the result and the arguments, and returns the final result.
// fune: after property.rent-review
replace — inside this capability’s code only, calls to a dependency go to your function, with the same signature. Other capabilities that use it are unaffected; write in * to replace it everywhere.
// fune: replace math.round-div in property.rent-review
// fune: replace money.amount in property.rent-review
step — your function runs at a numbered point inside the function’s body, receives the in-scope values it names as parameters, and may return replacements. List the points with fune show property.rent-review --steps.
// fune: step property.rent-review after <n|label>
Tests
A version published now needs at least 8 tests for every function, and one that expects the error for each function that throws; the registry refuses it otherwise. fune verify --all runs each case in TypeScript, Python and Rust, and a project runs them again with fune verify. This page lists the cases; it does not run them. The exact JSON is vectors.json.
| Case | Arguments | Expected | |
|---|---|---|---|
| index up 10%, no collar or cap: £55,000 | £50,000.00, 1,200, 1,320, —, —, true | → | new rent £55,000.00, index rent £55,000.00, index change basis points 10%, applied by index |
| index up 10% with a 4% cap: £52,000 | £50,000.00, 1,200, 1,320, 2%, 4%, true | → | new rent £52,000.00, index rent £55,000.00, index change basis points 10%, applied by cap |
| index up 3% between a 2% collar and 4% cap | £50,000.00, 1,200, 1,236, 2%, 4%, true | → | new rent £51,500.00, index rent £51,500.00, index change basis points 3%, applied by index |
| index up 1% under a 2% collar: the collar sets it | £50,000.00, 1,200, 1,212, 2%, 4%, true | → | new rent £51,000.00, index rent £50,500.00, index change basis points 1%, applied by collar |
| index exactly on the cap: the index sets it | £50,000.00, 1,250, 1,300, —, 4%, true | → | new rent £52,000.00, index rent £52,000.00, index change basis points 4%, applied by index |
| index falls 5%, upward-only: rent stays at £50,000 | £50,000.00, 1,320, 1,254, —, —, true | → | new rent £50,000.00, index rent £47,500.00, index change basis points -5%, applied by upward-only |
| index falls 5%, not upward-only: rent falls to £47,500 | £50,000.00, 1,320, 1,254, —, —, false | → | new rent £47,500.00, index rent £47,500.00, index change basis points -5%, applied by index |
| index falls 5% with a 1% collar and no upward-only: the collar still lifts it | £50,000.00, 1,320, 1,254, 1%, —, false | → | new rent £50,500.00, index rent £47,500.00, index change basis points -5%, applied by collar |
| a negative collar limits a fall to 2% | £50,000.00, 1,320, 1,254, -2%, —, false | → | new rent £49,000.00, index rent £47,500.00, index change basis points -5%, applied by collar |
| a flat index, upward-only: unchanged, by the index | £50,000.00, 1,200, 1,200, —, —, true | → | new rent £50,000.00, index rent £50,000.00, index change basis points 0%, applied by index |
Show the other 9 tests
| Case | Arguments | Expected | |
|---|---|---|---|
| applying the index, not a rounded percentage: 1200 to 1277 is £53,208.33, not £53,210.00 | £50,000.00, 1,200, 1,277, —, —, true | → | new rent £53,208.33, index rent £53,208.33, index change basis points 6.42%, applied by index |
| the rent is rounded half-up once | £12,345.67, 1,000, 1,033, —, —, true | → | new rent £12,753.08, index rent £12,753.08, index change basis points 3.3%, applied by index |
| a tiny movement: 8 basis points shown, exact rent used | £50,000.00, 1,200, 1,201, —, —, true | → | new rent £50,041.67, index rent £50,041.67, index change basis points 0.08%, applied by index |
| a peppercorn stays a peppercorn | £0.00, 1,200, 1,320, 2%, 4%, true | → | new rent £0.00, index rent £0.00, index change basis points 10%, applied by cap |
| a collar above the cap is refused | £50,000.00, 1,200, 1,320, 5%, 4%, true | → | error: collar 500 is above cap 400 |
| a zero base index is refused | £50,000.00, 0, 1,320, —, —, true | → | error: baseIndex must be an integer from 1 to |
| a fractional index is refused | £50,000.00, 128.4, 133.9, —, —, true | → | error: baseIndex must be an integer from 1 to |
| a negative rent is refused | -£0.01, 1,200, 1,320, —, —, true | → | error: passingRent must be between 0 and |
| a cap of -100% is refused | £50,000.00, 1,200, 1,320, —, -100%, true | → | error: capBasisPoints must be an integer from -9999 to 100000 |
More from the author
## How the rent is set
1. The index rent is passing rent × reviewIndex ÷ baseIndex. 2. If a cap is given and the index rises by more than the cap, the rent is passing rent × (1 + cap). 3. Else, if a collar is given and the index rises by less than the collar (or falls), the rent is passing rent × (1 + collar). 4. If upward-only and the result would be below the passing rent, the rent stays at the passing rent.
`appliedBy` says which of these set the rent (`index` when the index lands exactly on the cap or collar). Every comparison is made on exact fractions, and the rent is rounded half-up to the penny once, at the end. The index movement in basis points is returned for display only: applying a rounded percentage (6.42% for a 6.4166…% rise) gives a different rent from applying the index itself, and it is the index that the lease applies.
## Collar and cap are for the whole period
The collar and cap are the total increase allowed over the review period, not a yearly rate. A lease that says "between 1% and 4% a year, compounded, over five years" has a collar of (1.01^5 − 1) = 5.10% and a cap of (1.04^5 − 1) = 21.67%; work those out as the lease specifies (it may say how to round them) and pass the totals.
## Edge cases
- A collar above the cap is an error. A negative collar (a maximum fall) is allowed; so is a collar with no cap and a cap with no collar. - Upward-only with a falling index and no collar leaves the rent unchanged. - Leases that round the reviewed rent to the nearest pound, or to a multiple of £50, need that rounding applied to `newRent` afterwards.
## Limits
Passing rent up to £10,000,000 (1,000,000,000 minor units), indices from 1 to 1,000,000, collar and cap from −9,999 to 100,000 basis points, which keeps all the arithmetic exact in every language.
Files
| Path | Bytes |
|---|---|
| README.md | 2,403 |
| impl/python.py | 2,804 |
| impl/rust.rs | 3,971 |
| impl/typescript.ts | 2,717 |
| vectors.json | 6,640 |