rslc submission writes and reads the log. rslc script plays a whole submission from a script
file. Run a submission shows the commands at work.
The example on this page
The examples read the staffing example of the synthetic carrier Example Mutual. Itsbind.script
plays one submission to a bound quote, and --keep writes the log:
Commands
Each command takes the log as its first argument.contract takes a log or a program file.
Each row but the last follows
rslc submission. Six commands write entries: open, answer,
retract, quote, bind and close. These rules decide who may write:
- A role acts for itself and for each role below it in
Roles. - An input that lacks
bytakes an answer from each declared role. - A write replaces only an answer or a sign-off from the writer’s own role or a role below it.
- An act that
Actsleaves out is open to each declared role. - A program that lacks
Roles, such as a rater alone, accepts each role name. - One
answercommand with several answers records all of them or refuses all of them.
open compiles the program, and then holds it to four more rules:
rslc check passes a program that breaks one of these rules. open, contract --program and
rslc script then stop with the message and exit code 1. To give a role to an input of another
record, write its path on the root record, as in policy.experience by @Role.uw.
Options
rslc submission help prints the usage text, which Commands shows.
Exit codes
These commands read their own arguments. For the other
rslc commands, 2 marks a wrong command line.
Log stores
The end of a log’s name selects its store:
A name with another ending is an error with exit code 1. Both stores keep the same rules:
- An entry is the same JSON text in both stores, so a log gives one status and one history in each.
- Commands only add entries. Entry
nhasseqn, and each read checks it. - A write adds all of its entries, or it adds zero.
- A write lands only while the log still ends at the entry that the command read. When another writer came first, the command reads the log again and decides again.
- A
.sqlitelog refuses a changed entry, a removed entry and an entry out of place, from each program that writes to the database.
copy writes every entry of one log into a new log:
- The new log starts empty. A target that holds entries is an error.
copykeeps each entry as it is, so the copy stores the same path to the program. Put the new log in a folder where that path names the same program file.copywrites the entries only. The refused commands stay with the first log.
Questions and values
A question is one of two things:- An input’s path from the program’s root record: field names joined by
., such aspolicy.payroll. - A referral’s name, such as
new_venture.
_. List items gives the path of one item of a list.
A value is JSON. Text that JSON leaves unread, such as a bare word, is a string.
- The log checks each answer against the input’s type and its rules before it writes.
- Two spellings of one number, such as
2500000and25e5, are the same answer. - A record that holds a question of another role is stored field by field, one entry for each field.
- To retract an answer, name the path that its entry holds.
List items
The log names an item of a list by its key: the field that the program gives afterkeyed by.
- A key’s value is a JSON string or a JSON number.
- An answer under a key that the list lacks adds the item, with that key. The writer also needs the role of the key field.
- An answer to a whole item is a record. The record leaves the key out, or repeats the key of the path.
- A key names its item for the life of the log. An answer to the key field itself is refused as BAD_PATH.
- A place in a list, such as
[0], is refused as BAD_PATH. A place moves when an item before it comes or goes. - A list that lacks a key has zero item paths. Answer it whole, as one JSON list.
- A keyed list is a map from key to item. The same items in another order are the same answer, and a quote of them stands.
- Open questions, declines, the answers that a referral reads, lapsed quotes and
STALEmessages name items by these paths. - In a shell, put the pair in single quotes, as the commands below do.
fn-folds example. It is a rater alone and lacks Roles, so
each role name writes. Its modifiers list is keyed by number, and its endorsements list lacks a key:
Stages
The log stores entries only. Each status computes the stage from the entries and the program. The first row of this table that holds gives the stage:- An answer is recorded or refused, and the submission stays open either way.
Ineligibletakes corrections: a new answer or a retracted sign-off moves the stage again.Declinedcomes only fromclose declined, by the role of thequoteact, while a rule or a sign-off declines.Bound,DeclinedandClosedare final: the log refuses each later write as CLOSED.- With
--in, the stage is the stage of that quote option.
Referral and quote states
A status gives each referral one state:
A sign-off stands for the answers that the referral’s condition reads. The status shows those
answers, and the
signed_off entry records them as read.
A sign-off lapses when one of those answers changes after it. A lapsed sign-off stops counting:
the state follows the condition alone, and lapsed is set. The sign-off stands again when the
answers return to the signed values.
A status gives each quote one state:
Quote options
One submission may hold several quotes that stand at once, each on its own terms.--in OPTION puts a command in an option:
The setup below opens a log, makes it
Quotable and gives a first quote on the shared answers:
high then answers the limit, which the rater marks per quote, and gets its own quote:
- An option’s name starts with a lowercase letter and holds lowercase letters, digits and
_. - An option begins with its first answer or sign-off.
quotein an option that holds zero of them is NOT_QUOTABLE. - An answer to a fact in an option is refused as NOT_A_TERM, so every quote prices one risk.
- A record answer in an option is stored field by field, and each field is a term.
- A record that the shared answers lack enters an option only when the record itself is a term.
- A write in an option changes that view alone, so it lapses only the quotes of that option.
- A write to the shared answers changes each view. Each quote whose view changes lapses.
- A shared sign-off counts in each view that holds the answers it read. A sign-off in an option counts in that option alone.
- A command with
--inchecks roles, values and STALE in the option’s view, and prints the status of that view. - A status lists the quotes of every option. Its other blocks read one view: the shared answers, or the option that
--innames. status --inwith a name that the log lacks prints the shared answers.bindnames a quote, and the quote keeps its option. The bound policy is that option’s view.--inwithopen,bindorcloseis an error with exit code 1. So is a malformed option name.- A role’s answer is always a fact:
E-ROLE.
Status output
Each command that writes prints the entries it wrote, and then the status.status prints the
status alone. This is the example after entry 10:
- An open question of every role shows
any role. A role shows as@uw. - An open
signoffline ends withbecause:and the referral’s reason. - Under an open
signoffline, eachreadsline gives one answer that the referral’s condition reads. A sign-off stands for exactly these answers. - An open
inputline ends withone of:and the answers it takes, when a table lookup limits them. - A record such as
policystands for its inputs. An input of another role inside it gets its own line. - An open list shows as the list. An open input of a keyed item shows by its path.
- An outcome is listed as soon as the answers decide it. Later answers to open questions leave it as it is.
declines:. Here one rule is the rater’s and one
is the guideline’s:
- A rule of the root record has an empty path, so its line ends with the message.
- A sign-off of
Declinedshows the referral’s name, thendeclined byand the signer. - In the
Ineligiblestage, the block ends with a line that names the two ways on.
close declined then records the decision, and names the codes it rests on:
JSON output
With--json, a command prints one JSON value on one line:
readslists each answer that the referral’s condition reads now. An unanswered input is left out.- With
--in,stage,outcomes,declines,open,referralsandinvaliddescribe that option’s view.
declined.jsonl are these:
- A rule of the root record has an empty
path. - A decline by a sign-off has the referral’s name as
code, the signer inmessage, and an emptypath. - A citation of the rater carries the rater’s short name, as in
ts__rules:p1. - A number in the JSON keeps the digits that the answer or the program gave it.
History output
history prints one line for each entry: its number, its writer as role:name, and what it
records. The example shows the lines of a whole submission.
- Each part after the first appears only when the entry holds it.
- After
on, a sign-off line lists each answer that the signer saw, aspath = value. historyreads the log alone. It prints a list among those answers as one value.
The contract
contract prints what a program asks, who may write each answer and take each act, and what blocks
each act. The value comes from the compiled program, the same one that decides each write.
Both forms print the same value for the same program. This excerpt keeps one part of each field:
ruleslists each rule of a record, and each rule of one input that has a code. A plain range or type of an input sits inquestions.- A rule of the root record has an empty
path. - With
--json, the value is{"ok": true, "contract": {...}}on one line. - After the program’s files change,
contract LOGis refused as PROGRAM_CHANGED.
Refusal codes
A refused command leaves the log as it was. The output starts withrefused, the code and a
message, then a candidates: line when the log knows what it accepts, then the status.
The examples below run on a second log that holds the four answers of the application:
ALREADY_OPEN
open ran on a log that is open. Go on with the log, or open a new log.
NOT_OPEN
A script step ran before the script’sopen step. Put open first. The script under
Script files has such a step.
On the command line, a command on a log that is missing or empty is an error. It prints
error: and a hint to run open, and it exits with code 1.
PROGRAM_CHANGED
The files of the program differ from the files that the log was opened with. The log holds a hash of each source file and each table of the program. Restore the files, or open a new log.history
still reads the log. This is the refusal after one edit to guideline.rsl:
CLOSED
The submission isBound, Declined or Closed, and the three stages are final. Open a new log for a new submission.
UNKNOWN_ROLE
The role in--as is outside the program’s Roles. The candidates are the declared roles.
NOT_AUTHORIZED
The writer’s role is below the role that the question or the act needs. The candidates are the roles that may write. Ask a person in one of them.- A write replaces an answer or a sign-off of a higher role, or of a role beside the writer’s role.
close declinedcomes from a role below the role of thequoteact.- An answer adds a list item, and the item’s key field belongs to a higher role.
BAD_PATH
The question is other than an input’s path or a referral’s name. The candidates are the open questions.
A whole item whose record holds another key than its path gets the same code.
INVALID_VALUE
The value breaks the input’s type, its precision, its range or another rule that lacks a code. The message names the input and quotes the rule, and it ends withnothing was written. A sign-off
value other than Approved or Declined gets the same code.
Ineligible.
NOT_REFERRED
The sign-off names a referral whose state isNotReferred or Unknown. Sign off a referral that
the status lists as open. Here the premium is still unknown:
NOT_ANSWERED
retract names a question whose answer or sign-off is missing. The candidates are the paths that
hold one. The payroll’s answer sits at policy.payroll, so a retract of policy finds it missing:
--in, retract looks at the option’s own answers and sign-offs, and the candidates are those.
NOT_A_TERM
An answer in a quote option names a fact: an input that lacks theper quote
mark. Every quote shares a fact. Give the answer again with --in left out, and it reaches each option.
NOT_DECLINABLE
close declined ran while zero rules and zero sign-offs decline: the stage is Open or Quotable.
A decline rests on a rule or a sign-off. The candidates are the other reasons to close.
NOT_QUOTABLE
quote ran outside the Quotable stage. The candidates are the open questions. Answer them first.
- The stage is
Ineligible. The candidates are then the codes that decline. - The log holds the quote name already, or the name is malformed. A name starts with a lowercase letter and holds lowercase letters, digits and
_. --innames an option that holds zero answers and zero sign-offs. The candidates are then the options of the log.
NOT_QUOTED
bind names a quote that the log lacks, or a quote that lapsed. The candidates are the quotes that
stand. Bind one of them, or quote again under a new name.
STALE
The command names the last entry that its writer read, with--based-on, and what the command
reads changed after that entry. The message names each changed answer. Read the status again, then
decide on what it holds.
- A change elsewhere in the log passes.
- An entry number past the end of the log is
STALEfor each command. - With
--in, the log compares the option’s view at the named entry and now.
Entries
Two more commands give the second log aretracted entry and a closed entry:
.jsonl log holds it as one line. A .sqlite log holds it as the
text of the entry column, in the table entries, beside its seq.
A read of a log stops with an error when an entry is out of place, or when a path names a list
place. The seven types follow, each with a line from a log of this page.
opened entry
answered entry
An answer in an option under a union counts while each union in
arms keeps that arm.
signed_off entry
The sign-off stands while the referral’s present key equals
key. So it stands for the answers
in read, which are the answers that the status showed to the signer.
retracted entry
quoted entry
The quote stands while the present key of its view equals
key.
bound entry
closed entry
Refused commands
The log keeps each refused command beside its entries. A.jsonl log writes one JSON line for
each to a second file. The file’s name is the log’s name with .refused.jsonl in place of
.jsonl. A .sqlite log writes the same JSON to the record column of its table refusals.
These are two lines of second.refused.jsonl:
rslc script keeps its log in memory and leaves this record unwritten.
Script files
A script file plays one submission and checks what it expects. It is a plain text file with one line for each step. Save this script beside thestaffing/ folder as lines.script. It uses
every form of line:
lines.script
- A step that the log refuses fails the script, unless its line starts with
refusedand the code. - A line with both prefixes puts
refused CODE:first. - A step is written as the command is. Spaces around
=are optional. - A script’s log lives in memory, and each of its entries has
atset toscript. --keep LOGwrites that log to a new log. A log that holds entries is an error.- A line outside these forms stops the script with
error:and exit code 1.
rslc script prints one FAIL line and a note for each step that fails, then a summary line.
The summary counts the steps and expect lines, the failures and the log entries, and names the last stage.
With --json, the value has four fields:
Related
- Run a submission works through the commands on one submission, with two quote options.
- Write your first guideline builds the staffing guideline that these examples read.
- Raters and guidelines explains why sign-offs and quotes lapse, and why a decline is a decision.
- Language reference states the
per quotemark. - Refusals lists the
INPUTcodes that anINVALID_VALUEmessage quotes.