Skip to main content
Every act (an entry, a read, a write, a submit, a grave act) is decided by the host against the frame it runs in. These rules hold for every function and every client.

The frame clears through its surviving grants

Three parties must each be covered by their own grants:
  • the credential: the session the call arrives on must speak for the caller (see Authenticate callers);
  • the caller: its grants must hold the entry (enter, carried by the roles in the function’s allow) and clear every label the act touches;
  • the code: the function’s own grants must hold the same entry and clearances, and the reads, writes and releases it performs.
Each live grant is offered to the guards in scope on its own, and the grants that no guard refuses are the act’s survivors. The union of a party’s survivors covers it: two grants that together hold what the act needs are enough. The frame’s clearance is the set of labels that both the caller’s survivors and the code’s survivors clear, and nothing else:
  • a grant a guard refused clears nothing in that frame;
  • a non-public under requires surviving grants of both the caller and the code that clear it.
ctx.frame.grants lists the survivors. Inner acts are decided through the same survivors, and a ctx.call narrows again to the callee’s.

Open entries

Nothing is ambient: a caller with no grant reaches nothing. allow: [role.anyone] opens a function to every caller, signed in or not, and allow: [role.signedIn] to every authenticated person. Each declares a class grant that the program issues at install: it carries enter of those functions and clears nothing above the public label. A class grant carries more only when the app declares it: app(tree, { classes: { signedIn: { register: [family] } } }) lets every signed-in person found members of the family (Found a family member). The lock prints each class grant with its rights. Review it like any other grant.
A signed-in caller of list receives { ok: false, code: "Disallowed", reason: "NotCleared" }. Use a declared role whose grant clears the label.
Grant member to the principals who should read, for example with the membership library. Keep role.anyone and role.signedIn for entries that run at the public label, such as team.accept, and for entries under the caller’s own label.principals member, such as team.acceptance, which reads only the caller’s invitation receipt.

The order of a refusal

A decision is one conjunction: the act is admitted when every party is covered, the labels flow, and the guards leave survivors. When it refuses, the reason is reported in this order:
  1. Identity: the credential speaks for no caller (Disallowed).
  2. Cover: no surviving grants of the caller or the code hold what the act needs (Disallowed).
  3. Flow: the act would read above its clearance or write below its label (Disallowed or Invalid).
  4. Rules: guards refused every grant that would otherwise cover the act (Forbidden).
The report reads only what the caller may see.

Decision inputs are reads

Everything a decision uses is an entry in the transaction’s read set, validated at commit: the grants it went through, the installed catalog, every fact a guard read and the clock interval. Consequences:
  • Revoking a grant conflicts with every in-flight transaction that decided through it. That transaction is retried and decided again, or refused.
  • A guard’s fact that changes before commit invalidates the decision.
  • A trial is the same run, never accepted.

Reads are validated by what they revealed

A read is valid if the values it revealed are unchanged at commit. A change hidden above the reader’s label never aborts the reader, so a writer above a reader cannot signal to it through conflicts. A timed lowering is an ordinary write by a task, so a read sees the fact at its earlier label until that write commits (eventual labels).

Committed work is decided again

A transaction that commits a task, a continuation or a reaction does not carry its authority forward. A task records the grants that admitted its submit, never a verdict. Every later step that commits (the task’s run, a retry, the delivery of then, a background batch) decides its acts afresh, in its own transaction, through those grants that are still live. A grant that lapsed or was revoked in between refuses the step, and a grant issued again later does not revive it. The second factor’s age is read when the step runs. A committed send’s delivery to the performer is not a new act.

Timeouts are written, not fired

A machine edge with due moves a fact at the instant its field holds. Nothing runs at the instant: the write that left the fact in the timed state placed the transition, so it happens exactly once. Each write that leaves the fact in the timed state judges the edge’s act again, against its own grants and guards.

Explanations are labelled

A refusal’s message and a client.trial result are labelled by the join of everything the decision read. A caller sees only details within its clearance. If guards refused every grant, the result is Forbidden with the guard path and message from the first refusal in grant order. Missing clearance or positive authority yields Disallowed.