Skip to content
Alpha: see what works today →
Menu

For tools: runtime/currency.feature

Currency

The scenario the examples run

Which revision of a record is current, and which member of an entry leads it: derived, never stored, by the ladder decisions/currency.md rules, over the two clocks each revision carries, the source's change time and when the source was observed, and the person's Befores and Erroneous judgments.

Each pod starts empty, at https://pod.example/, with Ada as its subject (scripted-input/people.ttl). Ada imports Apple Health exports of four allergies, each stamped by its source (pav:lastUpdateOn): first-export, all stamped 1 December 2025; new-content, the peanut allergy inactive, stamped 5 January; stale-copy, exported on 8 January, a copy of the peanut allergy active as its source stamped it on 4 January: an older state, observed later.

9 rules, 4 examples: 4 pass, 0 fail, 0 not run

C1. A revision carries when its source was observed saying its state

Ruled by Which revision of a record is current, row two clocks; Partial dates, and values absent for a stated reason, row 4. the currency ladder

Its cascade:observedAsOf is the first there is of its document's cascade:answeredAsOf, the document's pav:retrievedOn, the source's own change time it carries as pav:lastUpdateOn, and the start of the act that generated it; for an entry, the session's start. It is one of the revision's own triples (N4), beside prov:generatedAtTime, when the pod wrote it.

Why `rec:asOf` ranks observations. rec:asOf ranks observations of one state, a later look at a source being better evidence of its current state, and a person's later session being their later edit; it is a writer's clock for a live pull or an entry, which is acceptable because a live pull has no other clock and an entry's order is the person's own. Between two pulls of one source where one's snapshot is an ancestor of the other's, ancestry orders the two acts whatever its clock says, so that pick is not a guess and is not listed; only picks ancestry does not order, two writers or two paths, go to the review page. Listed, a source that sends no change time and changes a tenth of 8k records a year gives about 800 lines a year and about 8,000 by year ten, each kept until someone files a Before (assumed, #206).

Which revision of a record is current: the whole Why, the alternatives that lost and what would change our mind.

1 example: 1 pass, 0 fail, 0 not run

passthe peanut allergy's revision was observed when its export's document was retrieved
Example: the peanut allergy's revision was observed when its export's document was retrieved
  Given a new pod for Ada on 2026-01-01 at 09:00
  When the export "first-export" is imported on 2026-01-02 at 10:00
  When the query is:
    """
    SELECT ?retrieved ?observed WHERE {
      ?revision cascade:revisionOf ?record ; cascade:observedAsOf ?observed ; prov:wasDerivedFrom ?document .
      ?document pav:retrievedOn ?retrieved .
      FILTER (?record = <urn:uuid:beaefb13-def8-8f7f-882d-eff4a1ee11d9>)
    }
    """
  Then it answers:
    | retrieved                            | observed                             |
    | "2026-01-02T10:00:00Z"^^xsd:dateTime | "2026-01-02T10:00:00Z"^^xsd:dateTime |

C2. A record's current revision is the ladder's pick

Ruled by Which revision of a record is current, rows current, heads, Erroneous; What a pod costs as it grows, row the ladder as a maximum; The variant interpretation, row which revision is current; The variant record, row which revision is current

Of the record's revisions, whatever revises what: remove each an Erroneous names; remove each a Before places before another still present, unless Befores form a cycle (C4); keep those at the latest source change time with those carrying none; of those, the greatest cascade:observedAsOf, but between two imports from documents reached by one path, the one whose act's snapshot descends from the other's; then the least IRI. queries/derivations/current-revisions.rq and the derivations before it derive it, and a record's current version is its current revision's. A record with nothing left has no current state and is in no view.

Why the source's state decides, not the arrival. The quantity that must decide is the source's state, not the messenger's arrival: "latest to arrive" let a transmitter's late copy of an old state overrule a correction, and A3 let a string the record had seen suppress new content, dropping a counter reset's correction. The source's change time ranks states of the source: a copy of an older state never beats a newer one, whatever clock the transmitter stamped on it.

Which revision of a record is current: the whole Why, the alternatives that lost and what would change our mind.

1 example: 1 pass, 0 fail, 0 not run

passa copy of an older state, observed later, does not undo the newer one
Example: a copy of an older state, observed later, does not undo the newer one
  Given a new pod for Ada on 2026-01-01 at 09:00
  And the export "first-export" is imported on 2026-01-02 at 10:00
  And the export "new-content" is imported on 2026-01-06 at 10:00
  When the export "stale-copy" is imported on 2026-01-08 at 10:00
  Then allergy "Peanut" has these revisions:
    | arrived             | version | clinical status | after               |
    | 2026-01-02 at 10:00 | 1       | active          |                     |
    | 2026-01-06 at 10:00 | 2       | inactive        | 2026-01-02 at 10:00 |
    | 2026-01-08 at 10:00 | 1       | active          | 2026-01-06 at 10:00 |
  And these records have:
    | record           | field   | value |
    | allergy "Peanut" | version | 2     |

C3. A person's Before outranks every clock

Ruled by Which revision of a record is current, row Before

A cascade:Judgment with the verdict cascade:Before, by a person, of two revisions of one record or of two records a Same joins, names the one it places before the other as cascade:earlierMember. The ladder removes the earlier before the clocks rank, so they cannot re-admit it.

Why a person's Before, not git's open fork. A pod is a mirror of sources it does not author, so git's open fork is wrong by default: the person cannot judge every pair, and the source's change time can. Where it cannot, a person outranks the clocks with a Before, which states a fact the clocks were only inferring and composes across three states where a verdict on one would not.

Which revision of a record is current: the whole Why, the alternatives that lost and what would change our mind.

1 example: 1 pass, 0 fail, 0 not run

passAda places the newer state before the older, and the older is current
Example: Ada places the newer state before the older, and the older is current
  Given a new pod for Ada on 2026-01-01 at 09:00
  And the export "first-export" is imported on 2026-01-02 at 10:00
  And the export "new-content" is imported on 2026-01-06 at 10:00
  When Ada files the judgment "new-content-before-first-export" on 2026-01-10 at 09:00
  Then these records have:
    | record           | field   | value |
    | allergy "Peanut" | version | 1     |

C4. Befores that form a cycle remove nothing, and the record is listed for review

Ruled by Which revision of a record is current, rows Before, review page

Two Befores ordering two revisions both ways, directly or through others, remove neither, and queries/questions/record/What needs review.rq lists each such Before, as tests/fixtures/a-cycle-of-befores-removes-nothing shows.

Why a person's Before, not git's open fork. A pod is a mirror of sources it does not author, so git's open fork is wrong by default: the person cannot judge every pair, and the source's change time can. Where it cannot, a person outranks the clocks with a Before, which states a fact the clocks were only inferring and composes across three states where a verdict on one would not.

Which revision of a record is current: the whole Why, the alternatives that lost and what would change our mind.

1 example: 1 pass, 0 fail, 0 not run

passtwo Befores ordering the two states both ways leave the clocks' pick
Example: two Befores ordering the two states both ways leave the clocks' pick
  Given a new pod for Ada on 2026-01-01 at 09:00
  And the export "first-export" is imported on 2026-01-02 at 10:00
  And the export "new-content" is imported on 2026-01-06 at 10:00
  And Ada files the judgment "new-content-before-first-export" on 2026-01-10 at 09:00
  When Ada files the judgment "first-export-before-new-content" on 2026-01-11 at 09:00
  Then these records have:
    | record           | field   | value |
    | allergy "Peanut" | version | 2     |

C5. The review page lists every pick the source's change time did not decide

Ruled by Which revision of a record is current, row review page; What a pod costs as it grows, row the review page bounded

queries/questions/record/What needs review.rq lists each record whose current revision was picked from candidates at other versions by the observation time ("observed later") or the least IRI ("no basis"), beside the state shown and each state not shown, but not a pick between two live pulls of one source whose snapshots ancestry orders: documents with a pav:retrievedOn and no cascade:answeredAsOf, naming one transmitter agent or none. Two exports, a file and a pull, or two transmitters are two paths, which ancestry never orders.

No example shows this rule: every export the scripted input holds is stamped by its source, so its change time decides. The fixtures under tests/fixtures/ named for ancestry, two writers and a tie show it.

Why `rec:asOf` ranks observations. rec:asOf ranks observations of one state, a later look at a source being better evidence of its current state, and a person's later session being their later edit; it is a writer's clock for a live pull or an entry, which is acceptable because a live pull has no other clock and an entry's order is the person's own. Between two pulls of one source where one's snapshot is an ancestor of the other's, ancestry orders the two acts whatever its clock says, so that pick is not a guess and is not listed; only picks ancestry does not order, two writers or two paths, go to the review page. Listed, a source that sends no change time and changes a tenth of 8k records a year gives about 800 lines a year and about 8,000 by year ten, each kept until someone files a Before (assumed, #206).

Which revision of a record is current: the whole Why, the alternatives that lost and what would change our mind.

C6. An entry shows every member, its lead's first

Ruled by Which revision of a record is current, row entry on a Same group

An entry's cascade:leadMember is a record the person entered when it holds one; otherwise the member left once a Before outside a cycle has placed the others' current revisions before it, ranked as the ladder's last three steps rank revisions. A view takes the entry's name and codes from its lead, and holds each member's current values as a node of its own (cascade:memberCurrentValues), named after the entry and the member (N13), which names the member it came from (cascade:valuesOfMember); queries/questions/entry/What it shows.rq lists them from the view alone, the lead's first. No merged record is stored, and no triple of a version is copied into a view, so no count over the union sees one twice.

No example here shows this rule: no scripted input but a kit's joins a record the person entered to an imported one. Priya's kit shows it, P15 and P11, and tests/fixtures/the-lead-member and allergies-view show the rest.

Why: Which revision of a record is current, with the alternatives that lost and what would change our mind.

C7. A person's ClockDiscounted ranks every revision its act generated as carrying no observation time

Ruled by Which revision of a record is current, rows wrong writer clock, review page; What a judgment is, and what it borrows, row a clock known wrong

A cascade:Judgment with the verdict cascade:ClockDiscounted, by a person, whose one member is an act, says the times its writer's clock gave are known wrong, usually in answer to a finding that the clock was behind (A19). It carries no offset. While it stands, the ladder ranks every revision the act generated as carrying no cascade:observedAsOf (queries/derivations/revision-judgments.rq): at step 4 such a revision stands beside the greatest observation time, so a pick between them falls to the least IRI, and queries/questions/record/What needs review.rq lists it with "no basis"; the lead and the members an entry takes its status and dates from are ranked the same way. A pick ancestry orders is untouched, ancestry being no clock. Nothing is rewritten, and retracting the judgment restores the ranking. It is not Erroneous over the act: the content is sound, only its clock is not. The review page lists a finding that a writer's clock was behind with each revision it names until the person acknowledges it, with an acknowledgement of that kind naming the act that generated the revision, or discounts the act, and a finding that a source reported older states as one line, "this source reports N records at states older than it reported on" the last date of the revisions it contradicts, expanding to each record, until the person acknowledges it, with an acknowledgement of that kind naming the record, the document of its older state and the document of every state of it the finding says the source contradicted, or files a Before between a record's older revision and one the finding names it contradicts (A18); N counts the records neither answers. One person's acknowledgement naming some of those documents and another's naming the rest do not add up: the record stays listed, since neither saw the whole.

No example here shows this rule; A19 shows a discount answering a finding. The fixtures tests/fixtures/an-act-whose-clock-is-discounted, a-clock-found-behind and a-source-that-went-back show the rest.

Why a rollback is one finding, and the later state stays. A rollback is noticed by the same test that keeps a stale copy quiet: a source contradicting its own earlier report is one fact, so it is one finding and, if the person agrees with the source, one Before with the per-record orderings derived, where a copy that is merely behind is what the ladder already expects. The pod keeps showing the later state because a hospital that restores a backup has usually lost data it will re-enter. One finding per import that goes back, naming every earlier act, because a finding per earlier act made a 30-day restore about 30 findings; an acknowledged finding still stands, or a daily pull of the rolled-back state would file one again every day; and a skewed writer has one clock finding while one stands, where one per act is up to 365 a year (computed, #206).

Which revision of a record is current: the whole Why, the alternatives that lost and what would change our mind.

C8. An act rebuilds only what it reached, and the views it leaves are those of a build of the whole pod

Ruled by Which revision of a record is current, row view; What a pod costs as it grows, row current per act, incrementally

After an act, the derived state, the views and the labels are those a build of the whole pod gives. A runtime need build again only the records the act wrote a revision of and those its judgments, retractions, assertions and findings reach through what each names, retracts, replaces, asserts or targets: a revision's record, each record an act a judgment names revised, and each record one of whose versions names what a judgment names, as an About's profile; closed over every record currently the same as one, before the act or by a judgment it wrote, each a version of one names or whose version names one, each with one's source record id once two servers are judged the same, and each member of a matcher Same over an older table version with one among its members, which M7 joins by their current versions. An act that changes the current version of a reference series the pod described before, a migration of the rule list versions (N15), an open, which gives the pod the tables it is read with, and a change to the trusted makers change what every record's judgments count, and are built whole; a runtime may build any step whole. The manifest's build activity used the writer's last snapshot (prov:used), and may name by cascade:buildInputsHash a hash of everything the build read: the pod's files it read, the derivations, queries and layout it ran, what the tables it was read with hold of the versions the pod files, and the runtime that ran it, whose IRI (N7) every such hash covers, so no other runtime computes the same one. A runtime that opens a pod again may take the views, the labels and the type index from the pod instead of building them only when the manifest names the hash it computes for the pod as it stands, and only from a build it kept itself under that same hash: the derived state, and the bytes of each file the build wrote, which each of those files must still hold. Otherwise they are stale, and are built again, by a read as by a step. A read that built them writes again each file the build writes whose bytes the pod does not hold: all of them where the manifest names another hash, and where it names the same, those a crash or a sync left holding other bytes. The manifest written again is the one the pod held but for the hash, so a read changes neither the time it names nor its prov:used. A read writes nothing when the manifest or the pod's listing changed since it read them, as when another session's act landed meanwhile. Two runtimes reading one pod compute different hashes, so each rebuilds and rewrites on every read. The manifest is written after the files it describes.

No example shows this rule: an example reads a dataset built whole from the files its story wrote, so a build in part and a build whole give it the same rows. Each runtime tests it itself, replaying every kit and building the pod both ways after each step, and opening a pod again: a build read back answers as a build whole does, and a change to anything it read builds it again.

Why a view rebuilds only what an act reached. The ladder is per record and an entry is a closure over its members' judgments, so an act changes current only for the records it wrote revisions for and those its judgments reach by derivation, and rebuilding those gives what the full rebuild gives; two writers still agree, since the result is a function of the set. A full rebuild per act is the ladder over 200k revisions, counting over 32k judgments, the pairs, the entries and nine views, 10 to 60 s on Node and too much for a browser, 34 to 205 hours over 12,300 acts (assumed, #206). What changes every record's inputs at once rebuilds everything: a migration, a change to the trusted makers, a change of rule list version.

Which revision of a record is current: the whole Why, the alternatives that lost and what would change our mind.

C9. A condition its source refutes is an entry, ruled out, and an allergy so marked is still left out

No decision note is named by this rule yet.

cascade-vocabulary#333; a person's ruling on #287, 2026-11-02. A condition whose current version has the verification status refuted is not left out (queries/derivations/excluded-at-source.rq): it is joined to the records it is the same as and makes an entry. One entered in error is still left out, and so is an allergy refuted. The entry takes its clinical status, verification status and abatement date from the member it takes its status from, as every status is taken (queries/derivations/status-sources.rq), and a verification status refuted states a status by itself, so a record that states no clinical status can be that member. queries/views/conditions.rq holds the entry's verification status and each member's own beside its clinical status, so the status of a member the entry did not take is still shown. queries/questions/pod/My condition history.rq reads the entry as "ruled out" whatever its clinical status, never as resolved, and queries/questions/pod/My active conditions.rq leaves it out.

No example here shows this rule: no scripted input holds a refuted condition. The fixtures tests/fixtures/conditions-ruled-out-at-source and left-out-at-source show it.