Skip to content
Alpha: see what works today →
Menu

For tools: runtime/the-kit.feature

The conformance kit

The scenario the examples run

A kit is a scenario every runtime must pass: a folder under conformance/ holding a feature file, its scripted input and its right answers only. conformance/alex-rivera/ is Alex Rivera's pod, from https://github.com/the-cascade-protocol/cascade-vocabulary/issues/4, and FHIR only. conformance/priya-natarajan/ is Priya Natarajan's, from https://github.com/the-cascade-protocol/cascade-runtime-js/issues/70: one pod from FHIR and C-CDA together, with medications and lab results, laid out as Alex's and with its own planted cases P1 to P17. conformance/martin-okafor/ is Martin Okafor's, from https://github.com/the-cascade-protocol/cascade-vocabulary/issues/138: one variant in two FHIR reports, each saved as a pull, with the story's subset of ClinVar's table and its own planted cases M1 to M6. conformance/tamsin-vale/ is Tamsin Vale's, from cascade-runtime-js#343: one hospital's record pulled twice, a year apart, a medication stopped between the pulls, with its own planted cases T1 to T4. What follows says it of Alex's kit; Priya's, Martin's and Tamsin's are alike.

A runtime passes a kit when every rule below holds for one replay of its story. An EARL report names checks 2 to 6 as tests by an IRI relative to the kit's folder: check 2 is #check-2-each-final-view-equals-expected, check 3 is #check-3-every-file-conforms-to-the-shapes, check 4 is #check-4-every-name-follows-its-rule, check 5 is #check-5-every-file-is-where-the-layout-says, and check 6 is #check-6-no-view-holds-the-pods-address.

6 rules, 0 examples: 0 pass, 0 fail, 0 not run

Check 1. Every example passes

No decision note rules this: it is mechanics every runtime follows alike.

Every example of the kit's feature file, and every example of the rules' feature files. Check 1 is no test of its own: its tests are the examples.

kitresult
Alex Rivera's podpass
Martin Okafor's podpass
Priya Natarajan's podpass
Tamsin Vale's podpass

Check 2. Each final view equals expected/

No decision note rules this: it is mechanics every runtime follows alike.

Take the view graph the replay builds at the last step under everyday (the graph <address>clinical/<view>.ttl), keep each subject that has cascade:entryMember with its triples but its members' current values (cascade:memberCurrentValues), which the fixtures of queries/questions/entry/What it shows.rq hold to it, and replace each entry, which the file writes as <#hex> (N13) and the graph holds resolved against the view's address, with a blank node. The result is the expected file's graph, up to its blank nodes.

No example states this check: SPARQL cannot compare two graphs up to their blank nodes.

kitresult
Alex Rivera's podpass
Martin Okafor's podpass
Priya Natarajan's podpass
Tamsin Vale's podpass

Check 3. Every RDF file of the pod conforms to the vocabulary's shapes

No decision note rules this: it is mechanics every runtime follows alike.

Each read with the files that describe what it names, less clinical/labels.ttl. That file gives a label, for people to read, to things other files describe, the subject among them, and cascade:SubjectShape is closed: read with the rest, it would refuse the subject's rdfs:label.

No example states this check: SPARQL cannot run SHACL.

kitresult
Alex Rivera's podpass
Martin Okafor's podpass
Priya Natarajan's podpass
Tamsin Vale's podpass

Check 4. Every name follows its rule

No decision note rules this: it is mechanics every runtime follows alike.

N1 to N7, N9, N10, N14 and N15, computed from that run's own inputs, its random import and matcher run IDs among them. Each saved Bridge output is in the pod less its arrivals, with its import replaced by the import its step wrote and the runtime that performed it left out (A9, A11), and each revision follows an earlier revision of the same record. Each act leaves one snapshot, named by its rule, whose first parent is the snapshot before it and whose added files are the files of the set its act wrote; its set hash is the set's after its step, and the last snapshot's is the set hash of the files the final pod lists of that set: a pod with one file of the set removed or changed fails it.

No example states this check: SPARQL cannot hash a canonical graph.

kitresult
Alex Rivera's podpass
Martin Okafor's podpass
Priya Natarajan's podpass
Tamsin Vale's podpass

Check 5. Every file the runtime wrote is where pod-layout.ttl says

Ruled by Where a host keeps a pod's files, row the kit's check

The check is open-world: the pod may also hold files another app wrote. A file is where the layout says when its path is, whether the runtime keeps it at that path or in an archive (X1); an archive is where the layout says when it is named as N9 names an archive and holds only files an archive may hold. A pod that holds an archive holds the file O4 names for cascade:ReadingFilesHeldInArchives, with O4's bytes.

No example states this check: SPARQL cannot read a stored document's bytes.

A host may keep files either way. A browser host keeps a step in one IndexedDB transaction and never had many operating-system files; it keeps doing so. The rules say how a host that keeps archives writes them and how every reader reads them, and require no host to keep them.

Where a host keeps a pod's files: the whole Why, the alternatives that lost and what would change our mind.

kitresult
Alex Rivera's podpass
Martin Okafor's podpass
Priya Natarajan's podpass
Tamsin Vale's podpass

Check 6. No view the runtime wrote, nor any view it shares, holds the pod's address

Ruled by How everything in a pod is named, row view entry; When a source moves, switches vendor or issues a new edition, row what leaves the pod

A view entry is written in the view file as <#hex>, relative to its view (N13), never as the derivations' placeholder urn:cascade:entry:<hex>, and no IRI a view file holds, as its bytes write it, begins with the pod's address: a view says nothing of where the pod lives.

No example states this check: SPARQL reads a file's IRIs resolved against its address, never as its bytes write them.

Why the rest. Escaping closes a verified collision, ("a|b") and ("a","b") named one thing; a list carries its count so two lists back to back are unambiguous; the rule IRI makes two rules of equal arity never collide and lets a v8 name say which rule made it (ni: names take none, being content). Base URLs are normalised because :443 and none are one server, and userinfo is refused because a credential must never be a name input. The host is an ASCII reg-name, or a bracketed IPv6 address or IPvFuture with no zone id, and the port is empty (no port) or ASCII digits read as an integer, leading zeros dropped, above 65535 refused, then the scheme's default dropped, so :0443 and none are one server too and a URL two parsers read apart names nothing. A contained resource is scoped by its container's source version because a renumbered one would otherwise become a revision of another record. An entry hashes a session the app minted because the subject and a timestamp collide across writers in one instant. Custodian and patient in a C-CDA name stop two patients' id-less statements from one clinic fusing. A C-CDA entry is named by its CDA id across documents where a FHIR document's entry is not, because the two promises differ and the measurements differ (research 4 on #130): FHIR says a document's ids are unique within that bundle only, and converters mint them at random per run; CDA's networks say "organizations SHALL send the same ID for clinical data which has not changed", HL7's companion guide makes it a SHOULD, and in the only public pairs from one system every observation, medication and procedure kept its id (verified, counted: Greenway, 77 of 91 statements; Allscripts, 26 of 26; Synthea a month on, 97%), as did every record with a source id in two downloads seven weeks apart from one EHR (verified, cascade-cli #121). What failed was the wrappers, a concern act or a vitals organizer re-minted per export, which the matcher joins like any duplicate, and an id reused for two different entries (verified, counted: 2 in Synthea; 22 of 344 within one document in #121), which would fuse two facts under one name that no judgment could split; so the collision inside a document falls back to the document's name with a finding, and the rare reuse across documents is accepted over the per-document alternative's cost, thousands of records and a matcher judgment file per join on every re-download of a stable sender. A person's judgment keeps its IRI because whoever made it minted it once, so another pod can cite it. A document and a finding are named by content so the same one from two writers is one file, and Web Annotation wants exactly one IRI per annotation. A view entry is a fragment of its view because the view is rebuilt from the set, so its entries are too, and nothing outside the view may cite one; what an app names instead is the paragraph after this one. A retraction is an activity because PROV already says how an entity is invalidated. A fragment on a hashed parent (#source-version, #identifier-n, #padded-onsetDate, #absent-onsetDate) is a stated convention because the node is inside the parent's hashed content; RFC 6920's grammar has no fragment, and we say so. The opaque default hides a hospital from a casual reader of a shared view; the scheme declaration says in plain words that only a key hides it from a determined one. The address stays out of every name because a hostname in a name is a commitment nobody can undo. The vocabulary owns the rules because a pod reader has only the vocabulary; vectors are cross-checked because an implementation that minted its own vectors proves nothing.

How everything in a pod is named: the whole Why, the alternatives that lost and what would change our mind.

kitresult
Alex Rivera's podpass
Martin Okafor's podpass
Priya Natarajan's podpass
Tamsin Vale's podpass