Markdown for LLMs
Read an external limit from a snapshot
The source Markdown for this article. Copy it into your assistant or download it as a text file.
# Read an external limit from a snapshot
## Intention
I want to obtain an external indicator from a precisely pinned data set.
An external indicator is read only from a presented snapshot; there is no ambient access.
## Incorrect form and why it stays silent
Declaring a function without a link to a snapshot does not specify a reproducible call.
```law title="Incorrect form"
external snapshot function limit(key: Text) -> Decimal {
capability "recipe.limit/1";
}
```
Even a complete declaration without a presented snapshot yields EXTERNAL_SNAPSHOT_MISSING.
## Correct form
The package declares the contract; the scene presents the resource `resources/04-limit.json`. Its hash is produced by the neighbouring generator, with no semantics of its own.
```law
language "law.core" version "0.2";
package recipes.n.r04 version "0.1.0";
namespace "urn:recipe:n-package:04";
external snapshot function limit(key: Text) -> Decimal {
capability "recipe.limit/1";
snapshot_from context.limits;
}
relation measured(key: Text, amount: Decimal);
relation exceeds(key: Text);
rule Exceeds strict {
for key: Text;
for amount: Decimal;
when measured(key, amount) and amount > limit(key);
then exceeds(key);
}
```
## Frozen execution scene
| Facts | Question | Answer |
|---|---|---|
| measured("lead",2.0), snapshot limit 1.0 | exceeds("lead") | TRUE_ONLY, COMPUTED |
| Same facts, no snapshot | exceeds("lead") | NEITHER, EXTERNAL_SNAPSHOT_MISSING |
The external snapshot is passed as an evaluation-request input; the command-line test runner has no such argument, so for this scene the test runner checks both evaluators through the same lowered test.
```law
test "limit reads from snapshot" {
given {
context {
legal_time @2026-09-13;
decision_time @2026-09-13T09:00:00+05:00;
knowledge_time @2026-09-13T09:00:00+05:00;
timezone "Asia/Almaty";
}
assert measured("lead", 2.0);
}
evaluate truth(exceeds("lead"));
expect truth_status == TRUE_ONLY;
expect evaluation_status == COMPUTED;
}
```
```law
test "missing snapshot refuses external call" {
given {
context {
legal_time @2026-09-13;
decision_time @2026-09-13T09:00:00+05:00;
knowledge_time @2026-09-13T09:00:00+05:00;
timezone "Asia/Almaty";
}
assert measured("lead", 2.0);
}
evaluate truth(exceeds("lead"));
expect truth_status == NEITHER;
expect issue(EXTERNAL_SNAPSHOT_MISSING);
}
```
## Counterfactual
The teaches mutation removes snapshot_from and pins a static rejection. The second scene drops the resource under the same complete declaration and facts: there is no network lookup of a missing indicator.
## Boundary
This is a synthetic limit, not a live rate. Exchange rates, registries, and measurements are pinned by the supplier. Snapshot completeness and the policy for choosing a value belong to the subject-matter package; data is not requested by URL during computation. Request inputs are schema-checked before evaluation: the pinned resource carries a snapshot schema version, and without it the request itself is refused.
## Pitfall
Absence of a set is not a zero rate. The second scene holds EXTERNAL_SNAPSHOT_MISSING; the first applies the pinned value for real.