Functional Weave
Code in Python

property.rent-review Unreviewed

New rent after an index-linked (CPI/RPI) rent review, with an optional collar and cap and upward-only option.

1.0.1 · published 2026-10-03 by charlie · Anterra

Pinned by 19 tests, run in TypeScript, Python and Rust.

Unreviewed. This capability’s implementations agree in every language and pass its published test vectors, which were worked out from the official sources cited. But no qualified conveyancer or tax adviser has yet checked those vectors, or confirmed that the capability covers the cases it claims. Treat it as a draft. Do not use it for real people, money or decisions without your own expert review. Once a qualified reviewer signs off, this notice is replaced with their name, qualification and the date. Each new version needs fresh sign-off.

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,000
  • rent_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,000
  • rent_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.

def rent_review(passing_rent: Money, base_index: int, review_index: int, collar_basis_points: Optional[int], cap_basis_points: Optional[int], upward_only: bool) -> RentReviewResult
passing_rentMoneythe rent before the review, zero or more
base_indexintthe index at the base date, in any integer unit (1284 for 128.4), greater than zero
review_indexintthe index at the review date, in the same unit, greater than zero
collar_basis_pointsint?the least increase over the whole review period, 200 = 2%; null for none
cap_basis_pointsint?the most increase over the whole review period, 400 = 4%; null for none
upward_onlybooltrue: the rent never falls below the passing rent
returnsRentReviewResult

The types it declares, generated into your project

RentReviewRule = Literal["index", "collar", "cap", "upward-only"]

@dataclass(frozen=True)
class RentReviewResult:
    """The reviewed rent, what the index alone would give, and which term decided it."""

    #: the rent from the review date
    new_rent: Money
    #: passing rent × reviewIndex ÷ baseIndex, before any collar, cap or floor
    index_rent: Money
    #: the index movement, rounded half-up; for display only
    index_change_basis_points: int
    #: the term that set the new rent
    applied_by: RentReviewRule

Your code names it in one line, in the file that uses it

from fune.property.rent_review import rent_review  # property.rent-review@^1
impl/python.py · 59 lines · open · raw

Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.

from typing import Optional

from .math_round_div import round_div  ← from math.round-div ^1.0.0 · built alongside by fune
from .money_amount import Money, money  ← from money.amount ^1.0.0 · built alongside by fune
from .property_rent_review_types import RentReviewResult, RentReviewRule

_MAX_RENT = 1_000_000_000
_MAX_INDEX = 1_000_000


def _is_int(value: object) -> bool:
    return isinstance(value, int) and not isinstance(value, bool)


def _check_basis_points(name: str, value: Optional[int]) -> None:
    if value is None:
        return
    if not _is_int(value) or value <= -10000 or value > 100000:
        raise ValueError("%s must be an integer from -9999 to 100000, received %r" % (name, value))


def rent_review(
    passing_rent: Money,
    base_index: int,
    review_index: int,
    collar_basis_points: Optional[int],
    cap_basis_points: Optional[int],
    upward_only: bool,
) -> RentReviewResult:
    """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."""
    if passing_rent.minor < 0 or passing_rent.minor > _MAX_RENT:
        raise ValueError(
            "passingRent must be between 0 and %d minor units, received %r" % (_MAX_RENT, passing_rent.minor)
        )
    for name, value in (("baseIndex", base_index), ("reviewIndex", review_index)):
        if not _is_int(value) or value <= 0 or value > _MAX_INDEX:
            raise ValueError("%s must be an integer from 1 to %d, received %r" % (name, _MAX_INDEX, value))
    _check_basis_points("collarBasisPoints", collar_basis_points)
    _check_basis_points("capBasisPoints", cap_basis_points)
    if collar_basis_points is not None and cap_basis_points is not None and collar_basis_points > cap_basis_points:
        raise ValueError("collar %d is above cap %d" % (collar_basis_points, cap_basis_points))
    p = passing_rent.minor
    # The multiplier as a fraction num/den: the index ratio, or 1 + collar/cap.
    num, den = review_index, base_index
    rule: RentReviewRule = "index"
    if cap_basis_points is not None and review_index * 10000 > base_index * (10000 + cap_basis_points):
        num, den, rule = 10000 + cap_basis_points, 10000, "cap"
    elif collar_basis_points is not None and review_index * 10000 < base_index * (10000 + collar_basis_points):
        num, den, rule = 10000 + collar_basis_points, 10000, "collar"
    if upward_only and num < den:
        num, den, rule = 1, 1, "upward-only"
    return 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,
    )

Install

fune build

With that line in your source, in a Python project (language python in fune.project), fune build resolves it and its 2 dependencies, pins them in fune.lock, downloads only the Python 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. Or pin a range in fune.project and build in one step:

fune add property.rent-review
Download for Python property.rent-review-1.0.1-python.fune · 17,324 bytes sha256 1b555a6ba6ab3717ea3e5553853164507001cdbd6adefe17adeef91414df550d

The manifest, vectors and README with only the Python implementation. Install it without the registry with fune add ./property.rent-review-1.0.1-python.fune, or fetch it from a terminal with fune pull property.rent-review@1.0.1:python.

The whole function, every language, is one file too: property.rent-review-1.0.1.fune, 24,294 bytes, sha256 a99fdebf211fc8b8352ce6c5280a8c91645000b6a5b3b61bc5c61c419be7c331. 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.

CaseArgumentsExpected
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
CaseArgumentsExpected
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.

## Before you rely on this

**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 above, 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.

**Unreviewed.** This capability's implementations agree in every language and pass its published test vectors, which were worked out from the official sources cited. But no qualified conveyancer or tax adviser has yet checked those vectors, or confirmed that the capability covers the cases it claims. Treat it as a draft. Do not use it for real people, money or decisions without your own expert review. Once a qualified reviewer signs off, this notice is replaced with their name, qualification and the date. Each new version needs fresh sign-off.

1.0.1 marks it unreviewed. The code and the tests are unchanged.

Files

PathBytes
README.md3,521
impl/python.py2,804
impl/rust.rs3,971
impl/typescript.ts2,717
vectors.json6,640