Downloads

Machines read back with the types they were planned with

A machine’s text writes no types, so a machine read back from its text is typed by what its steps need, in the Rust, Go, Python and JavaScript libraries alike:

  • Each input of the machine holds what every step after it needs, carried back through the steps that pass on what they are sent (effect=none) or change part of it (effect=patch), and through a gather into a step that takes a sequence. JSON converted to YAML and saved as a YAML list of records reads back with a JSON list of records as its input. YAML converted to JSON and gathered with JSON records that are not lists reads back with a YAML record that is not a list.
  • Each step’s output holds what the step gives for what it is sent: the node between those two steps is a YAML list of records, content and no file, not only the YAML the converter declares.
  • What a step passes on or changes part of is still a complete thing when what it is sent is one: a JSON record a step produced, converted to YAML, is a YAML record and not a list, so it feeds a save that takes a record and refuses lists.

Before, such a machine either failed to read back (“… accepts …, and its source is …”) or could be planned and not read again from its saved text. What a requirement on a step’s output asks of what the step is sent is decided by code generated from the proved CapDAG model (CapDAG.Exec.capRequires), which every library carries with the claims that the answer is sound and the widest that is. The libraries gain CapUrn::requires (Rust), CapUrn.Requires (Go) and CapUrn.requires (Python, JavaScript).

capdag plan names the ways it does not offer

A way the planner finds that cannot be written as a machine no longer fails the whole plan. It is not offered, and capdag plan names it under the machines it does offer, with why: not offered: <strand>: <reason> on stderr, or an excluded record (strand, reason) under --json. When no way found is offered, the command fails and names each of them. Before, one such way ended the plan with “no machine could be planned”, so capdag plan of a CSV file to a JSON, YAML or CSV file planned nothing.

In the Rust library, PlanOutcome carries these as excluded, a list of ExcludedCandidate (strand, reason). A plan whose ways are all excluded is that outcome with no candidate; PlanError::NoPlan is a plan that found no way at all.

A run checks what a step hands on by what it is

When a run hands one step’s output straight to the next, it checks the value against what the next step takes by what the value is. For a step that passes on or changes part of what it is sent, that is what the step gives for what it was sent, not only the type its stream is labelled with. A JSON list of records converted to YAML now reaches a step that takes YAML lists of records; it failed with “output stream URN … does not conform to the downstream declared arg URN”. A plan in which such a step is sent something its input does not take is refused before it runs, naming the step, what it is sent and what it takes.

Converting between JSON and YAML

The data cartridge answers convert-json-to-yaml and convert-yaml-to-json, the converters the fabric publishes, and no longer lists the eight per-shape conversions they replaced. In the Rust, Go, Python and JavaScript libraries each format conversion path names the marker its published converter carries (json-to-yaml, yaml-to-json), so format_conversion_urn(path) gives the published converter’s URN and format_conversion_cap(registry, path) fetches it. The JavaScript library gains allFormatConversionPaths, and its conversions carry their effect.

Saving content as files

The data cartridge saves content as the file it writes is read back: save-as-json, save-as-yaml and save-as-ndjson for a list of records, a record or a value, and save-as-csv. A save writes the bytes unchanged after checking that they read back from the file as the type the cap gives, and refuses content that would read back as another type, saying what it reads back as. capdag plan of a CSV file to a JSON, YAML or CSV file plans through them, from one file or from several.

Two registries opened at once

Two fabric registries opened at the same time on a cache that holds no registry charter yet no longer fail: any number of writers, threads of one process or separate processes, can store a registry’s charter at once. The second failed to store it with ENOENT.

Download CapDAG