---
title: "U3021: Call that grants a boundary module more than its ceiling"
url: https://una-lang.org/en/docs/errors/U3021/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U3021.md
---

# U3021: Call that grants a boundary module more than its ceiling

A call into a boundary module grants it more than its ceiling.

## Why Una rejects it

From edition `0.3`, each entry of `[boundaries]` in `una.toml`, or from edition `0.4` of the `boundaries` section of `ita.una`, gives a boundary module its ceiling: the most authority it may ever receive, as `C[ops]` strings (ADR 0093). At every call into the boundary, what the call grants must lie within the ceiling:

- each `with` binding that the callee's `uses` name counts at every operation the binding permits, not only those the callee declares, so rebinding a read-write binding as it is grants both;
- a handler counts with its own `uses`, the authority it runs with on the boundary's behalf;
- the `uses` of a function value or lambda given as an argument count too, since the boundary can run it.

The examples of a boundary module grant it their `given` handlers, each with its own `uses`, and are checked the same way, at the `given` line.

## How to fix it

- The repair narrows the grant to the ceiling, with `with @x = @y[ops]` or a handler whose `uses` lie within it.
- When the callee needs more than the ceiling, no grant keeps both, and the repair says so: the consumer decides between the library and the ceiling.

Raising the ceiling is a decision about trust, never a repair, and `una fix` never applies an edit of U3021 nor writes `una.toml` or `ita.una`.

## The repair at a glance

`src/demo/app.una`

```diff
  module demo.app

  import demo.store (Files)
  import demo.vendor (load)

  pub open(path: Text) -> Text
    uses @files: Files[read, write]
  =
-   load(path) with @files = @files
+   load(path) with @files = @files[read]
```

## Failing example

`una.toml`

```toml
[package]
name = "demo"
version = "0.1.0"
edition = "0.3"

[boundaries]
"demo.vendor" = ["Files[read]"]
```

`src/demo/store.una`

```una
module demo.store

pub capability Files
  op read(path: Text) -> Text
  op write(path: Text, data: Text) -> Unit
```

`src/demo/vendor.una`

```una
module demo.vendor

import demo.store (Files)

pub load(path: Text) -> Text
  uses @files: Files[read]
=
  @files.read(path)
```

`src/demo/app.una`

```una
module demo.app

import demo.store (Files)
import demo.vendor (load)

pub open(path: Text) -> Text
  uses @files: Files[read, write]
=
  load(path) with @files = @files
```

## Fixed example

`una.toml`

```toml
[package]
name = "demo"
version = "0.1.0"
edition = "0.3"

[boundaries]
"demo.vendor" = ["Files[read]"]
```

`src/demo/store.una`

```una
module demo.store

pub capability Files
  op read(path: Text) -> Text
  op write(path: Text, data: Text) -> Unit
```

`src/demo/vendor.una`

```una
module demo.vendor

import demo.store (Files)

pub load(path: Text) -> Text
  uses @files: Files[read]
=
  @files.read(path)
```

`src/demo/app.una`

```una
module demo.app

import demo.store (Files)
import demo.vendor (load)

pub open(path: Text) -> Text
  uses @files: Files[read, write]
=
  load(path) with @files = @files[read]
```
