Skip to content

Releases

v0.0.22

Choose a tag to compare

@github-actions github-actions released this 04 Dec 22:05
b10d7a2

26 merges since v0.0.21. Some decisions were wrong in earlier releases, and this one corrects them. Arithmetic is now exact: (1 / 3) * 3 is 1, and a calculation is never rounded on the way. A value must still fit a decimal to be kept, and a very large calculation is refused. The semantics version moves from 6 to 9, so the same programme can decide differently.

It is also much faster in places: 1,440 prices under unique by, in one transact, went from 12.8 to 1.6 seconds. Migrations 033 to 035 are needed.

Decisions this release corrects

What was wrong Releases Who is affected
A rule with not over an or could accept a change that broke it (#955) v0.0.15 to v0.0.21 A rule such as not ((((not X(x)) and A(x)) or B(x)) and K(x)): a top-level not, an or under it, and a condition inside one branch that reads a variable nothing has bound yet
The same rules could refuse a lawful change (#955, #960) v0.0.18 to v0.0.21 As above
A remainder (%) by a high-precision divisor could be a wrong number, with no error (#953) every earlier release A programme that takes remainders by divisors with many decimal places, including ones a division leaves. The size of the number does not matter: 4294967295 % 1.0000000000000000000000000000 was wrong. Ordinary lot and tick sizes are not affected
A quotient was rounded to 28 digits mid-calculation, and a step past the decimal range was an error (#962) every earlier release A programme that divides, or whose intermediate figures are very large

One thing is now refused. A value no decimal holds, such as 1 / 3, can be computed and compared but not kept. Admitting or emitting it, a derived value or digest refuses it and names the fix, round. Before, it was silently rounded to fit a decimal (#962).

What to do

Two different questions, and neither answers the other:

Question Command
Is the historical record intact? morpholog audit verify
Would this release's semantics have made the same decisions? morpholog rehearse, on a copy of the database

An intact record can hold a decision that was wrong.

  1. On the copy, run the checks in step 9 of docs/operating.md for each programme, unchanged.
  2. Read the rehearsal's report before you upgrade production. It exits zero whatever it finds. Look into every row marked would_reject, would_error or different_delta. Look into unreplayable rows too: rehearsal could not decide them again, so it says nothing about whether they were right.
  3. Look at refusals separately. Rehearsal decides only committed proposals again, each against the state recorded before it. It cannot show a lawful change that was refused. inspect rejections lists the refusals Morpholog recorded, but not necessarily all of them, so check your own logs of rejected requests too.
  4. Correct a wrong decision with an ordinary governed act. Upgrading repairs nothing, and the evidence stays as it was. If the decision already led to a payment, an order or an obligation, that needs putting right outside Morpholog as well.

Upgrading

Follow the upgrade checklist in docs/operating.md.

  • Run morpholog migrate (033 to 035).
  • Run provision indexes --prune, naming every programme the database serves in that one command (#937). A unique by over several fields now gets one index over its whole key. Indexes over one field are not rebuilt. On the gallery's programmes, the claims table went from 527 indexes to 436.
  • Programme hashes do not change. Every gallery programme has the same hash as under v0.0.21, and as many of its rules compile to SQL.
  • Regenerate every generated view surface with generate views, and run refresh derived for cache views. A live view that divides, generated before this release, fails and says so (#962).
  • Regenerate every Python client. What reaches existing code:
    • A check --json finding has a required code, and a subject when it concerns a declaration (#669). A client from v0.0.21 or earlier refuses a report that holds any finding. A clean report still reads.
    • provision indexes --json gives each index positions, a list, in place of position (#937).
    • A passing audit verify with an anchor carries anchor (#961). An older client refuses that report.
    • A refusal can report a number no decimal holds, as a fraction (#962). The client reads it as values.Exact.
    • The error kind round_out_of_range is gone (#962). Read a report saved under an older binary with the client generated then.
  • Named reads refuse a field stored as another kind than its declaration (#935). Before, the value was printed as if it were the declared kind. check --database-url finds such claims.
  • Some figures have fewer trailing zeros (#962): (2.00 / 3) + (1.00 / 3) was 1.0000000000000000000000000000 and is 1. A quotient in a live view is shortened the same way. Values compare equal either way. A consumer that compares figures as text is affected.
  • PostgreSQL 18 is recommended where latency matters and many indexes are provisioned. 19.0 works and is tested, but plans each statement more slowly as indexes grow: an act took 9% longer with 6 indexes, and about twice as long with 434 (#964). PostgreSQL 18 stays the minimum.
  • Formats: evidence packs stay format 19, the score report 6, the rehearsal report 2 and the view description 5.

For embedders

  • check --json findings have a stable code (#669). Match on code, not on the wording. A code keeps its spelling and meaning, and new ones appear, so accept one you do not know.
  • A uniqueness check finds its key directly (#937). It used to slow down as a batch grew.
  • A transact authorises each actor once when no act in it can change who may do what (#938). On 1,440 prices that went from 1.39 to 1.19 seconds.
  • audit verify names the anchor it checked (#961).
  • After restoring onto another cluster, migrate and check --database-url warn when the deployment's root login no longer matches, and print the fix (#935).
  • The embedder guide answers more questions (#930): several reads that must agree, what each rule costs, and what --mentions searches.
  • Independent cases on one database can still abort each other (#906). The guide says what to expect, and what to do when retries run out.
  • The Python client's provision_indexes takes history (#935).

The language

  • Rules that take things in an order are fast (#933, #942). "The total of what comes before this one" and "is anything ahead of this one" are answered from one sorted list per act, not a fresh search per row. Shipping 1,600 allocations in one act took 23 milliseconds, against 4.9 seconds with that turned off. check -v lists where it can apply.
  • A live view's sum can call a condition that can fail, such as the exchange rate in force (#920). One definition can now serve both a rule and a live total, when the total adds up rounded rows. Comparing timestamps is about five times faster (#967): live totals for 1,000 orders went from 5.1 to 0.9 seconds. Existing views need no regeneration for this change alone; #962 still requires it. Ordinary tables are still far faster.
  • check -v shows what a time grid can cost (#940).
  • Clearer findings: a repeated clause on a predicate is marked where it repeats (#657), and a computed value in a call's arguments gets an error that names both fixes (#935).

Safeguards

  • CI runs the database tests on PostgreSQL 18 and 19 (#931).
  • curve25519-dalek 5.1.0, for RUSTSEC-2026-0620 (#951). Released binaries never ran the affected code.

Rust API

Changed, so code that uses them needs editing:

  • SourceMap::span_for_error and span_for_lint are now place_error and place_lint, which return the declaration and the span (#669).
  • ValidationError::DisciplineDuplicateClause gains clause (#657).
  • EvalError::RoundOutOfRange is gone, and EvalValue gains Fraction (#962).
  • IndexPlanEntry::position is now positions (#937).
  • In the CLI crate, CheckDiagnostic::new takes a code and a subject (#669), and ProvisionedIndex::position is now positions (#937).
  • The Intact verdicts gain anchor (#961), and DeploymentIdentity::Closed gains root_login_matches (#935).

Added: ValidationError::code, Lint::code and SourceMap::place (#669); the numeric module and EvalError::sum_out_of_decimal_range (#962); grid_costs (#940) and ordered_sums (#933); AnchorEvidence (#961).

A correction to the v0.0.21 notes

They said the InvenTree stock history tests ran "under four workers". They ran under three, in every run, before and after, so the comparison stands.

The generated Python client is regenerated and stamped v0.0.22.

Prebuilt binaries for linux (x86_64, arm64) and macOS (Apple Silicon). Install guide: docs/install.md (select by uname -s / uname -m, verify the checksum; the worked examples ship in the source archive below, no Rust toolchain needed). Intel Macs build from source - GitHub retired the free Intel runner.

main (rolling)

main (rolling) Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 04 Dec 16:17
b10d7a2

Rolling build of main at b10d7a2. Recreated on every merge; not a versioned release - pin a v* tag for anything durable. Install guide: docs/install.md.

v0.0.21

Choose a tag to compare

@github-actions github-actions released this 22 Nov 22:22
64a1136

32 merges since v0.0.20. With the optional history index provisioned, one entity's history reads only the audit rows that mention it, not the whole audit log. On the InvenTree fork under four browser workers, the stock history pages' reads went from a median of 10.5 seconds to 0.44.

A refusal at an or of comparisons names every branch's figures. Live derived views take more of the language: max and min, a sum whose target is computed from each row or by a value definition, a domain over a condition with an or, and a choice of live or cache per derived claim. A read of one key of a live view computes that key alone. And example 27's planned GB gas-day demonstration is complete, covering nominations, trade matching, the clock change, who may do what, and cash-out.

Migration 032 is needed. The semantics version stays at 6. For a programme valid under both releases, decisions over the same state and inputs are unchanged. Two programme shapes that v0.0.20 accepted are now refused by check, as below: one failed at its first decision, and the other put a derived claim's values in the wrong columns.

Upgrading

Follow the upgrade checklist in docs/operating.md: stop every process, back up, migrate, verify the audit, check provisioning, regenerate the clients, and start on the new binary.

  • Run morpholog migrate (032). It adds compared_branches to morpholog.rejections: a nullable list, checked to be non-empty, that never sits beside compared on one row. Older rows read with it absent.
  • Run provision indexes --check for every programme. On a database v0.0.20 provisioned for every gallery programme, nothing is outstanding: all 525 indexes are kept. To read history views through the audit log's index, run provision indexes --history once (#909). It is the deployment's choice, and no run prunes it.
  • Regenerate the views with generate views. The view description moves from format 4 to 5. A history view now carries a condition the history index serves, and gains a lookup function per declared key, <view>_by_<key fields> (#909). Lookups are granted to no one: grant EXECUTE where you grant SELECT on the views. A lookup returns its view's row type, so dropping a history view now needs CASCADE. A live view is distinct on each key's column (#898); its rows do not change.
  • check refuses a little more:
    • a comparison like < of two timestamps in one branch of an or, through a definition's parameters (#908). v0.0.20 passed it, and the first decision failed on it;
    • a derived claim's value whose name is not the column at its place (#872). v0.0.20 filled the columns in order whatever the names said, so such values landed in the wrong columns. No programme measured had one.
  • A propose --batch row with a field the row does not read gets an invalid_request receipt naming the field, and is not proposed (#884). The rows around it run as before. Before, the field was dropped without a word, so explain_on_reject in a batch row looked honoured and was not.
  • Regenerate every Python client with the v0.0.21 binary. A client pins the binary version. What reaches existing code:
    • Rejected, AtomicRejected, both explanation verdicts, rehearsal rows and rejection rows carry compared_branches (#910); an envelope carrying it and compared together is refused;
    • an explanation's gate verdict carries related_parameters (#882);
    • ViewDescription carries lookups, in format 5, and ProvisionReport an optional history entry (#909);
    • Session.process is the child a session spawned (#885);
    • local_days and business_days run the calendar generators and return their rows, ready for transact (#887).
  • Gallery programmes changed. If you copied one, compare it:
    • example 27, the GB gas day, gains renominations, trade nominations, the clock change, and who may do what (#894, #896, #902, #914);
    • example 23 changes only in its comments, but its canonical hash moves with them (#891).
  • Formats: evidence packs stay format 19, the score report format 6, the rehearsal report format 2. The view description moves from 4 to 5.

For embedders

  • One entity's history, read through the log's index (#909). A history view used to expand every audit row's operations. With the index, a whole view reads the audit rows that mention its predicate, and a lookup reads those that mention one entity. On the InvenTree fork's record:

    • the stock history browser tests pass under four workers, in 3.3 to 12.9 seconds, against 10.9 to 27.0 with the index alone;
    • the median history read is 0.44 seconds, against 8.1 with the index alone and 10.5 on v0.0.20, over 4 successful reads;
    • the page bodies are byte-identical.

    Most of the gain needs the host to call the lookups: the index alone took the median from 10.5 to 8.1 seconds.

  • A refused or names each branch's figures (#910). A refusal at an or whose branches are each a comparison carries compared_branches, one {op, left, right} per branch in branch order, and no compared. before <= cap or after < before, refused at a cap of 10, names 20 <= 10 and 30 < 20. An or with a branch that is not a comparison names none. It appears on the rejected envelopes, in explain's verdict and prose, in rehearse, and in the rejection log, which --mentions searches.

  • A preview names the parameters a refusing gate reads (#882): explain's gate verdict carries related_parameters, as a refusal does.

  • A read of one key of a live view computes that key alone (#898). On 10,000 orders and 30,000 fills, one order's figure went from about 106 to about 4 milliseconds. Only a comparison with values reaches the key: = $1, = ANY($1), IN (...). A join, IN (SELECT ...) or LATERAL computes every key first, on the generated view as measured (#905). So read a page's keys, then the view by = ANY of them.

  • Live or cache per derived claim (#873). generate views --derived-source <Derived>=live|cache chooses one claim's source over the --derived default. A claim chosen live that cannot render refuses the run by name.

  • Independent cases on one database can still abort each other (#912). PostgreSQL tracks serializable reads by index page, and unrelated cases' entries can share pages. The guide now says what makes it worse and what to do: retry. The adapter's tests pin that such an abort is a retryable serialization failure, and that the retry commits.

  • The embedder guide gains: a figure shared between a rule and a read, and the local date of an instant (#876); that the generated client carries durations and collections (#880).

The language

  • Live derived views take more of the language:
    • max(x | body) and min(x | body) over a decimal position (#881);
    • a sum's target computed from each row, such as q * price * (1 - d / 100) (#889), or by a value definition's call (#893);
    • a domain over a condition whose body is an or (#877).
  • A key crosses a call and a forall's source (#870). A value a pattern inside a called condition finds now narrows the reads after the call, and a forall's source narrows its body. A key nesting more than 64 lookups reads whole.
  • One evaluation computes each repeated aggregate once (#888). Within a gate, an invariant's judgement or a derived claim's rows, a sum, max or min keeps its result for the same values and state. A figure used three times went from a 2.15 to a 0.77 second median.
  • check passes an antecedent that calls a definition calling itself through an or (#869). v0.0.20 overflowed its stack.
  • Two parse errors name the rule they break (#879).

Worked examples

  • 27, the GB gas day: its planned demonstration is complete. Renominations, judged on their window, effective hour and lead (#894). Trade nominations that pair, are rejected, expire on the network's own completeness evidence, or are withdrawn (#896). The clock change's outage and deferral, from National Gas's notice (#902). A receipt racing the report that the record is complete (#904). Who may do what: a Trader User nominates no flow, and the OCM operator nominates both sides of a market trade (#914). Each slice was held to an independent reference, frozen before the programme.
  • 23 writes up the breakpoint form of its hourly cap (#891).

Safeguards

  • release.sh keeps its temporary files where gh can read them (#890). The v0.0.20 release stopped before publishing its register record.
  • url 2.5.9 for RUSTSEC-2026-0592 (#901).
  • Three collecting walks use the shared fold walk (#883).

Rust API

Changed, so code that uses them needs editing:

  • render_views takes a derived source per claim, not one flag (#873).
  • RejectedWithExplanation::new takes compared and compared_branches as one pair (#910).
  • RejectionReason::{Invariant, Require, BindNone}, RowClass::WouldReject, PgProposalOutcome::Rejected, PgAtomicOutcome::Rejected, GateRejection and InvariantRejection gain compared_branches, and RejectionRow an optional one (#910). Code that builds them names the new field.

Added:

  • Kernel: ValidationError::DerivedValueOutOfPlace (#872); GateRejection::related_parameters (#882); Hash on the IR's expression types (#888).
  • Adapter: ViewRefusal::NotDerived (#873); HISTORY_INDEX, HistoryIndexEntry, plan_history_index, provision_history_index, LookupDescription and ViewDescription::lookups (#909).
  • CLI envelopes: ProvisionedHistoryIndex, ProvisionReport::history and ProvisionReport::new (#909).

The generated Python client is regenerated and stamped v0.0.21.

Prebuilt binaries for linux (x86_64, arm64) and macOS (Apple Silicon). Install guide: docs/install.md (select by uname -s / uname -m, verify the checksum; the worked examples ship in the source archive below, no Rust toolchain needed). Intel Macs build from source - GitHub retired the free In...

Read more

v0.0.20

Choose a tag to compare

@github-actions github-actions released this 18 Nov 18:38
7f81d4a

44 merges since v0.0.19. A deployment can now be closed, so that a login needs authority to assert any actor, and a host can enrol its own new users without reaching anyone else's identity. A refusal by a named gate names the act's parameters the gate reads, so a form can mark the field. A programme can be split into parts.

More rules run on the compiled route, a large act no longer exhausts the planner, and a read keyed inside one rule loads a dozen rows where it loaded thousands. And this release is the first to carry its own register record, signed.

Migration 031 is needed. The semantics version stays at 6: no decision changes for the same programme, state and inputs. Some duration spellings and some ill-kinded programmes that v0.0.19 accepted are now refused before anything is decided, as below.

Upgrading

Follow the upgrade checklist in docs/operating.md: stop every process, back up, migrate, verify the audit, check provisioning, regenerate the clients, and start on the new binary.

  • Run morpholog migrate (031). It creates morpholog.deployment_identity, a table holding one row that says whether the deployment is open or closed. A database without that row refuses every proposal.
  • A migrated deployment stays open, as it was. init, migrate and check --database-url now print a note on stderr saying so, with the command that closes it (#826). Stdout is unchanged. Closing is opt-in: see "Closed deployments" below.
  • Run provision indexes --check for every programme. Newly keyed reads (#810) and rules that moved to the compiled route (#804) can need an index a programme did not need before. On a database v0.0.19 provisioned for every gallery programme but the new example 27, this binary needed nothing new: all 426 indexes and 9 statistics objects were kept. Your programme may differ.
  • check, migrate and provision indexes print a coded error on stdout when there is no report (#850). With --json on check --database-url and provision indexes, and always on migrate, a failure to connect or a schema that does not fit prints one object and exits 1: {"status": "error", "code": "...", "error": "..."}. The codes are connect_failed, not_initialised, schema_behind, schema_ahead, schema_below_baseline and schema_record_altered. Before, stdout was empty. The prose stays in error and on stderr. migrate --check still reports the schema states it can inspect in its own report. Pending migrations are what migrate applies, not a schema_behind error. A failure after migration work has begun gets no code.
  • A duration is ISO 8601 exact time units, or refused (#784). The friendly form (1h 30m), lowercase designators (PT6h), fractional hours or minutes (PT1.5H) and a leading + were accepted by mistake, on the wire and in a .morph duration(...) literal. Now each is refused. A programme with such a literal no longer parses; the gallery has none.
  • check refuses a little more (#815). A definition whose body is an or now holds its callers to a kind every branch agrees on. A caller passing a count where every branch needs a part was accepted before.
  • A closed stdout ends a command with status 141 (#811), as a shell reports for a writer SIGPIPE ended. Before, inspect audit | head panicked with exit 101. For propose, 141 means the outcome is unknown, like any other unexpected status.
  • audit verify counts transitions only (#812). On a database migrated through 027, it no longer counts the baseline and activation control rows, so it agrees with rehearse and evaluate. tree_size still counts every row.
  • Printed output changed in three places. Scripts that read --json are unaffected.
    • provision indexes --check and --dry-run list only what is outstanding, then a count of what is kept (#819).
    • check -v says invariants: 18 (9 declared, 9 from declarations) when declarations add rules (#814). Its read line is now body read plan: all keyed, and with --database-url a second line says provisioning was not checked (#851).
  • Regenerate every Python client with the v0.0.20 binary. A client pins the binary version. What reaches existing code:
    • a Duration field or parameter is a values.Duration, not a str, and no longer refuses generation (#784);
    • ClaimRead is a ClaimInstance and NamedClaimRead a NamedClaim, each adding only asserted_in (#849);
    • check, migrate and provision_indexes raise MorphologRequestError with the code above (#850);
    • Rejected and AtomicRejected carry related_parameters (#833);
    • check(with_database=True) and the session's ready line carry identity, open or closed (#826);
    • init() takes root_actor, root_login and confirm (#843), and audit_checkpoint() takes wait (#820);
    • an explanation's transition carries decided_at (#817);
    • the view description is format 4 (#832).
  • Gallery programmes changed. If you copied one, compare it:
    • example 03, the ledger: each journal line carries line_no, and JournalEntry declares unique by (entry_id) (#840, #842);
    • example 16, the release register, gains a signing key and a published record (#778);
    • example 27 is new.
  • Formats: evidence packs stay format 19, the score report format 6, the rehearsal report format 2. The view description moves from 3 to 4.

Closed deployments

  • init --root-actor A --root-login L makes a closed deployment (#826). A login may then assert an actor only with an ActorAssertionAuthority grant for that actor, or a grant for its kind (below). The root actor is different: only login L may assert the root actor A, and no claim can grant it to anyone else. The login is held by OID as well as by name, so a role dropped and made again is not the root.
  • An existing deployment closes with init --skip-if-exists --root-actor A --root-login L. It first lists the actors the log records that no grant names, and stops unless --confirm is given. Stop the writers while closing.
  • Grants to a kind of actor (#827). ActorKindAuthority(kind, login) lets that login assert any actor ActorKind gives that kind. ActorKindEnrolment(kind, registrar) lets a host admit ActorKind(x, kind) only for an x the same act mints. So a host can enrol new users at sign-up, but never move an existing actor into a kind it may assert. On a closed deployment only the root otherwise writes these claims, and an actor holds at most one kind.
  • A plain init still makes an open deployment. To require authority for every actor, initialise or close the deployment as above.

The language

  • A programme in parts (#793). A .parts manifest lists .morph files in order, and every command takes it in place of a .morph. The parts read as one text, so a programme in parts hashes as their concatenation. A part is refused where a construct could run into the next one. check --json places a finding in its own file.
  • A derived claim may compute nothing (#828). With no value clause, its rows are its keys over the over condition: the claims that meet it.
  • A live derived view chooses with if(...) (#829), and may hold a flag or a subject, not only a decimal.
  • A sum's body may compare, sum, and call a condition with an or on the compiled route (#804). Rules of these shapes move from the interpreted to the compiled route, and generate views --derived live accepts them. In the gallery, settled_within_effective_terms in example 10 moved. Still refused: an or directly in a sum's body, and a sum whose body can raise inside arithmetic.
  • generate local-days --at HH:MM starts each day at a local hour (#838). A GB gas day is --zone Europe/London --at 05:00, 23 or 25 hours long on the clock changes. --skipped and --repeated choose what a start time a clock change skips or repeats becomes. A transformation that declares tzdb_digest gets the sha256 of the zone file.

For embedders

  • A refusal names the act's parameters the gate reads (#833). A refusal by a named gate carries related_parameters: the act's parameters the gate's expression reads, directly or through the statements before it, in parameter order. It is a static dependency, not a verdict on which input is wrong. It is absent for an invariant and an unnamed gate.
  • Fewer rows loaded, fewer conflicts (#810). A pattern keyed in a rule now keys the patterns around it. On the InvenTree spike at 5,000 records, allocate loaded 12 rows where it loaded 14,335, and 16 concurrent complete_order acts retried 0.6 to 0.8 times per commit, from 6.7 to 7.5.
  • A large act plans in linear memory (#797). A check bound to hundreds of cases held each case as an OR arm, and planner memory grew with their square. An InvenTree ship of 750 allocations ran the database out of memory at 24 GB; it now takes 250 MB and 3.1 s.
  • explain answers for an act that reads decided_at (#817). It judges the act at its read transaction's start, and names that instant.
  • audit checkpoint --covering ID --wait 30s retries for up to 30 seconds while the transition is outside the stable prefix, then records the checkpoint. If the wait runs out, it gives the same coded transition_not_covered refusal as before (#820).
  • The view description names a key for every view it can stand behind (#832). A predicate with no unique by is keyed by all its fields. A key holding a timestamp or a duration is left out, since a view column holds microseconds; the exact _morpholog_arguments column stands in.
  • A compiled check that added two sums, each through a definition with a list test, failed every proposal with a SQL error (#824). Fixed.
  • A hostless database URL reaches the socket of the port it names (#798), not the default port's.
  • The embedder guide gains: seeding a ledger once and copying it per test with createdb -T, and what a copy shares (#8...
Read more

v0.0.19

Choose a tag to compare

@github-actions github-actions released this 14 Nov 11:10
58280fb

32 merges since v0.0.18. A host has less to write. More of what it used to restate now lives in the programme: a branch, a pass over every matching claim, a figure named once, a typed parameter, and a gate that follows a tree up through a condition that calls itself. A rule can range over a grid built from a claim's bounds, and a commitment can be held to its reveal. Writers conflict less: more reads load only the rows a decision names, not a whole predicate. And generated views do more of the reading: they describe themselves, compute derived claims live, and show each predicate's history.

No migration is needed. The semantics version moves to 6: a receipt decided under 5 reads not_re_evaluated from this release's verifier, never a mismatch.

Upgrading

  • No migration. The schema head is still 030, so this binary runs on a v0.0.18 database as it is.
  • Run provision indexes again for every programme. The new keyed reads (#732, #738, #769) and live derived views (#741) seek on positions that v0.0.18 did not index. Without the indexes the reads stay correct but scan, and concurrent proposals conflict as before. provision indexes --check says what is missing.
  • Decisions move: semantics version 6 (#718). A value admitted into a claim, or emitted into an intent, must be of the kind its field declares. Before, a subject could land in a Date field, a bare decimal in a Decimal[USD] one, or a quantity in another unit, and the claim contradicted its own programme. Now each is a kernel error naming the field (claim_kind_mismatch, intent_kind_mismatch), and nothing is written. Claims already stored that way are untouched.
  • A decimal is admitted as written, or refused (#761):
    • a tagged decimal written 1e10, +1, 01 or 1. is refused, as the named codec already did;
    • a decimal with more than 28 fractional digits, or a coefficient past 96 bits, is refused, where before it was rounded.
  • check refuses more.
    • A definition named like a bare-word builtin (if, periods, period_index, period_start_of, digest) is refused by name (#755).
    • Under --strict, two new hints fail a programme that passed before: a sum calling a definition with a wildcard argument (#748), and a sum holding an or whose branches can hold together (#751).
  • Regenerate every Python client with the v0.0.19 binary. A client pins the binary version. What reaches existing code:
    • a commit's receipt carries drawn_subjects, required (#765);
    • every kernel_error carries kind, and the client refuses one without it (#718);
    • invalid_arguments carries parameter when one argument is at fault (#766);
    • the rehearsal report is format 2: would_error rows carry kind (#718);
    • the client's decimal reader and writer refuse what the binary refuses (#761).
  • Session and serve errors are shorter (#766). They no longer suggest running morpholog schema, and no longer name the server's file. One-shot commands keep the hint.
  • A large record may need a PostgreSQL setting (#769). Under SERIALIZABLE, every read leaves predicate locks. They block nothing. But once one transaction holds more than 32 of them under the claims table, PostgreSQL replaces them with one lock on the whole table, and conflicts between unrelated proposals become more likely. With sixteen allocators on a 50,435-part tree, 7 of 8 runs at the defaults retried 0.45 to 0.51 times per commit; with max_pred_locks_per_transaction = 256 they were about 0.2. On that machine, at 100 connections, the setting took 6.7 MiB more shared memory. It needs a restart. The embedder guide says how to tell whether a deployment needs it. #772 tracks the wider question.
  • Building from source needs Rust 1.100 (#770). Release binaries are built by 1.100.0, and now check integer overflow instead of wrapping silently (#775). A reachable overflow would panic, and would be a kernel defect. None is known.
  • Gallery programmes changed. If you copied one, compare it:
    • examples 18 and 21 use x in (a, b) (#730);
    • example 23 gains hourly prices (#757);
    • examples 25 and 26 are new.
  • Formats: evidence packs stay format 19, the score report format 6. The rehearsal report is format 2. The description generate views --describe writes is new, at format 3.

The language

  • if / else in a transformation (#753). Only the branch taken runs. if and else are not reserved words.
  • for Pattern(...) (#754): one pass per claim the pattern matches, in the canonical order of the claims' arguments, so every platform runs them alike. Its read is keyed.
  • A definition that names a figure (#755): define allocated(item) = (sum(...)), read wherever a value stands.
  • A parameter's declared kind (#756): transformation cancel_order(order, force: Bool). The schema and the client type it. A wrong-kind argument is the kernel error argument_kind_mismatch.
  • A condition that calls itself (#768, #769). A define may call itself, directly, in shapes check can bound. That lets a gate follow a tree where the record holds only each node's parent. Loops in the data end. Mutual recursion is still refused. A rule that reads one is checked whole on every change to what it reads. Only a gate that walks one link up from a known node loads just the chain above it.
  • A rule ranges over a grid (#757): forall h in periods(start, end, duration("PT1H")), on the interpreted route.
  • digest(...) (#758): a sha256: subject over values, so a sealed bid can be held to its reveal. The Python client computes the same digest.
  • Smaller things:
    • true and false literals (#730);
    • x in (a, b) (#730);
    • new Subject() written inline in admit or emit (#752);
    • a misfit argument error prints its operators as written (#718).

For embedders

  • Fewer conflicts between writers that touch different rows. A read is now keyed:

    • by a value an earlier bind found (#732). On the InvenTree spike, retries fell from about 5.5 to 0.31 per commit;
    • by the elements of a list argument (#738);
    • up a tree from a known node (#769).

    check -v marks a whole read of a predicate the same act writes (#730).

  • Generated views:

    • --describe PATH writes a description of the views, pinned in schema --result, with read_view_surface() in the client (#740);
    • --derived live computes derived claims in the view itself (#741);
    • --history adds a view of each predicate's history from the audit log (#750).
  • Receipts: drawn_subjects lists every subject an act drew, in order, including any that reached no admitted claim (#765). parameter names a malformed argument (#766). kind classifies a kernel error (#718).

  • One view for every write (#728): the embedder guide shows a single host view that serves every write a family exposes. It uses an allow-list of names, passes the body through, takes the actor from the login, and gives each outcome its own HTTP status. The InvenTree spike measured it.

  • The compiled route hands an invariant to the kernel when a stored value drifted from its declared kind. It used to give a kernel error (#719).

  • A load past PostgreSQL's parameter limit widens its keys, and is refused before it is sent if it still cannot fit (#740).

Worked examples

  • 25, stock allocation (#753 to #756, #768): shipping visits every allocation, splitting or whole. A line takes stock of any variant below its part, and the gate follows the variant tree.
  • 26, sealed bids (#758): a bid is a digest, and the reveal is held to it.
  • 23, delivery hour limits: hourly prices on a grid (#757).

Safeguards

  • The kernel's purity check now reads resolved paths, so a renamed import of the clock, the environment, the file system or the time-zone database is caught (#774). It is a tripwire, not a proof.
  • A match in the kernel names every variant it handles, so a new construct is a warning at every place in the kernel that must decide about it (#771).
  • A dependency update in this repository takes only releases at least a week old (#770).

Rust API

Changed, so code that uses them needs editing:

  • Definition::body is a DefinitionBody, not a Prop (#755).
  • Prop::In takes a ValueExpr source, not a Term, and Lint::LargeGrid names its owner, not its transformation (#757).
  • Builtin::arity() and ValidationError::BuiltinArity::expected are an Arity, not a usize (#758).
  • ReadFilter::resolve pairs each position with a Key, not a value (#732, #738, #769).
  • render_views takes a DerivedSource and a history flag (#741, #750).
  • In the CLI's envelopes, ErrorReceipt::new and RequestError::new take the error's kind, and TracedError::new takes the EvalError (#718).
  • The lexer's Token::ReservedBoolLit is Token::BoolLit (#730).

Added:

  • Language: Stmt::If, Stmt::ForEach, TraceEntry::{If, ForEach}, ForEachIterationTrace (#753, #754); DefinitionBody and ValueExpr::Defined (#755); Transformation::declared_kinds and declared_kind() (#756); Value::Bool (#730); Builtin::Digest and pub mod digest (#758); Definition::calls_itself, RecursionRefusal, Widening::RecursiveCall (#768). Each has an ir_builder constructor: if_, for_each, value_definition, defined_value, transformation_typed, in_grid.
  • Errors: EvalError::{ClaimKindMismatch, IntentKindMismatch, ArgumentKindMismatch}, EvalError::kind() and KINDS, EvalValue::kind(), PredicateArgKind::holds(), and kind on RowClass::WouldError (#718, #756); new ValidationError variants for definitions, declared kinds, grids and recursion; Lint::{WildcardedCallUnderSum, OverlappingOrUnderSum} (#748, #751); parameter and naming() on the CLI's ErrorReceipt and RequestError (#766).
  • Reads: Key (with OneOf and Reached) and Key::reads_any(), KnownTerm::{Field, Element, Reached}, Link, MAX_ELEMENT_KEYS (#732, #738, #76...
Read more

v0.0.18

Choose a tag to compare

@github-actions github-actions released this 07 Nov 14:31
635bf37

28 merges since v0.0.17. A caller that runs arbitrary code can now propose without holding the rules or the logins: morpholog serve keeps both behind a Unix socket, an executor role can only deliver what was admitted, and a transformation reads its decision time from the runtime, never from the caller. Rehearsal and the case-local check no longer scan what a change did not touch, so a long record re-decides in seconds. As-of reads can start from a kept snapshot instead of the first row.

Two plain migrations are needed; neither is the staged kind that pauses writers. The semantics version moves to 5: a receipt decided under 4 reads not_re_evaluated from this release's verifier, never a mismatch.

Upgrading

  • Run morpholog migrate. Migrations 029 and 030 are pending for a v0.0.17 database. 029 records an executor role beside the writer and reader, and narrows the writer's grant on the outbox: it keeps INSERT and UPDATE on the delivery columns, and loses table-wide UPDATE, so no provisioned role can change an admitted intent (#701). 030 adds the two tables refresh snapshots keeps (#377). Neither rewrites history. A v0.0.17 binary refuses the migrated database as ahead of it.
  • A role prefix is now at most 55 characters, so <prefix>executor fits PostgreSQL's name limit. It was 57. A deployment with a longer prefix moves to a shorter one with roles move, which also adds the executor; init --skip-if-exists --least-privilege adds it to a deployment that keeps its prefix.
  • Decisions move: semantics version 5 (#673). The case-local check now seeks only the cases a change touched. Two decisions change. A rule whose antecedent errors on a case the change did not touch no longer errors the proposal; a touched erroring case still errors, and a failing case is refused rather than lost behind the error. And a rule whose exists, forall, not, nested rule or sum reads a case variable's name before the rule has bound it is now checked whole: version 4 bounded it to a case the scope never read, so it could admit a change that left a broken obligation unchecked. Over the shared corpus no admission or refusal moved. Refusal witnesses moved in one shape: a unique by rule's refusal now binds the claim being admitted to its first pattern's variables and the claim already held to the second's. evaluate's scoring is case_bound_admission_v6.
  • decided_at is a reserved name (#378). A programme that uses it as a parameter, a let, a for or quantifier binder, or in a pattern matched against stored claims is refused by check, by name; rename the variable. It is never silently rebound. Example 13 renamed its own.
  • Regenerate every Python client with the v0.0.18 binary. A client pins the binary version, so a v0.0.17 client refuses this binary at its first call. What reaches existing code:
    • rehearsal rows carry model_hash, and an unreplayable row because, with totals.unreplayable_because (#667); the strict models refuse unknown keys by design;
    • init's report carries executor_role (#701);
    • new: connect_service() and Session.connect() for serve (#700), refresh_snapshots() and its RefreshSnapshotsReport (#377).
  • Gallery programmes changed. If you copied one, compare it:
    • example 07, chess, has one move action, move_piece, that works out a capture and the next turn, and two invariants keeping pieces on the board (#694, #695);
    • example 13's verify_match and decide_on_identification take no instant: both read decided_at (#378).
  • Evidence packs stay format 19, the rehearsal report format 1, the score report format 6. No programme hash outside examples 07 and 13 moves.

The language

  • decided_at (#378): a timestamp a transformation body reads, given by the runtime like actor. It is the start of the transaction deciding the act, which the act's audit row records as committed_at; a replay, live or from a pack, gives each row that instant back, and a refusal's explanation replays it. It is the logical decision time, not the moment of evaluation or commit, and not the moment the SERIALIZABLE snapshot is taken: a transaction that waits after it began is decided as of its start. Only a transformation body reads it; for a rule to read a time, admit the time. A retry is a new decision at a new instant. Decision times are not in log order, and a gate on time is not a seal against a race: to order a bid against a close, admit the close as a claim and gate the bid on its absence, and even then the order is SERIALIZABLE's logical one, not the wall clock's. explain, which has no recorded instant, refuses a body that reads it; --explain-on-reject has one.
  • check -v names the body reads that load a predicate whole (#396), with the statement, its rule and the definitions it went through. A read is keyed only by what the act knows before it runs. A gate summing terms in force through the selector effective by generates reads every key's terms; a definition keyed by a parameter does not.

For embedders

  • morpholog serve (#699): the resident runtime on a Unix socket. The programme is pinned by a required --expect-hash; --presenter UID=LOGIN maps each caller's OS user to its own database login, checked before the service listens; an unmapped caller is closed before anything is read; reads and explanations need --grant. The wire is the session's, unchanged. session --expect-hash pins the stdio session the same way (#666).
  • The executor role (#701): init --least-privilege provisions <prefix>executor, which reads the outbox and moves a row through delivery and nothing else: it cannot change an intent, read claims or audit, or propose. Give it to the process that holds an external key.
  • Rehearsal at scale (#673, #677, #683, #688, #689, #691, #692). A rehearsal of forty thousand register rows was stopped after more than eight minutes before this cycle's work; a hundred thousand rows now take two to five seconds on the same laptop. The case-local check seeks its cases instead of scanning, the candidate is a view over the pre-state, a replay's state is kept for the fold, and several quadratic paths in the kernel are linear. Measured figures are in the bench README. rehearse reports progress on stderr every ten thousand rows (#672).
  • morpholog refresh snapshots (#377) keeps the admitted state after every --every rows of the log (default 10,000), and an as-of read replays only from the nearest one. On a 146k-row record with two thousand live claims, a read at the end fell from 4.8 seconds to at most 0.34. Run it on a schedule. The snapshots are a cache, never evidence: a read with none replays the log, and no verifier, pack, rehearsal, score or receipt reads them. A large live set gains less.
  • What rehearse and evaluate re-decide against. Unchanged in this release, and worth restating: the prefix each row is decided against is the recorded effects applied in the one audit order, the order of effects, not the state each decision saw. A proposal that read a claim, then committed after another that removed it, sorts after the removal, so re-deciding it can find the claim gone. For a serial history the two coincide. rehearse reproduces effects exactly; it does not reconstruct a concurrent decision's own context (#644). decided_at follows the same rule: each row's recorded instant is given back, so a decision time can be earlier than a row before it in the log.
  • Operator checklists (#665): a new page, docs/operating.md, lists the steps for upgrading, deploying a changed programme, closing a day, keeping as-of reads fast, serving callers you do not trust and running the executor, each linked to its explanation.

Worked examples

  • 07, chess: a tutorial that runs against a released binary, and one move action (#694, #695).
  • 13, biometric identification oversight: verifications and decisions are dated by the runtime, so the two-people-first rule checks the order of events, not the account of the person acting (#378).

Rust API

  • Term::DecidedAt; Transition.decided_at (not serialised); EvalError::UnboundDecisionTime; ValidationError::{DecisionTimeNotAvailable, DecisionTimeAsName, DecisionTimeMatched}; RecordedProposal.committed_at; RejectionStateOutcome.decided_at (#378).
  • ReadPlan::whole_reads and WholeRead (#396).
  • refresh_state_snapshots and SnapshotRefresh (#377).
  • SEMANTICS_VERSION is 5; Widening::ScopeReadsBeforeBinding (#673).
  • Rehearsal: RecordedProposal.model_hash, RowReport.model_hash, RowClass::Unreplayable { because }, Unreplayable, UnreplayableTotals and Totals.unreplayable_because (#667); rehearse_candidate and rehearse_candidate_against_pack take a progress callback, RehearsalProgress (#672); rehearse_recorded (#675).
  • State and decision: State is no longer Clone, and the candidate is a view, Candidate (#677); Decided, decide_staged_delta_with and advance_recorded (#679); State::admits (#680); State::layering, Layering and apply_compacting_when (#681); State::apply_replayed (#683).
  • session_login (#699). The executor in the role records: DeploymentRoles::executor, RolePair.executor, RoleMembers.executor, MovedLogin.executor, DeploymentRoles::same_deployment and listed_roles (#701).

The generated Python client is regenerated and stamped v0.0.18.

Prebuilt binaries for linux (x86_64, arm64) and macOS (Apple Silicon). Install guide: docs/install.md (select by uname -s / uname -m, verify the checksum; the worked examples ship in the source archive below, no Rust toolchain needed). Intel Macs build from source - GitHub retired the free Intel runner.

v0.0.17

Choose a tag to compare

@github-actions github-actions released this 01 Nov 23:57
596fa0e

28 merges since v0.0.16. The audit log has one order. Every transaction takes one place in it when it writes its first audit row, and every row records what its commit did to the claims table, so replay rebuilds the table exactly even when writers overlapped. A read as of a timestamp follows that order too. Arithmetic is exact: +, - and * return the mathematical result or refuse, where they used to round, and the compiled checks compute arithmetic and builtins in SQL with the kernel's values. A new command, rehearse, re-decides every committed proposal under a candidate programme. Two generators write a year of calendar days as proposal rows.

Three migrations are needed, and one of them pauses writers, so read Upgrading before you deploy. The semantics version moves to 4: a receipt decided under 3 reads not_re_evaluated from this release's verifier, never a mismatch. No programme hash moves.

Upgrading

  • Run morpholog migrate, with a procedure. Migrations 026, 027 and 028 are pending for a v0.0.16 database. 026 and 028 add SQL functions and take no lock of note. 027 is the canonical order: it adds columns, indexes and a Merkle pass over the existing history with the database in service, then one cutover that holds every writer while it writes the baseline (measured 3.6 seconds at three hundred thousand live claims and 22 at two million; readers are never held). The install guide's "Running the migration to the canonical order" gives the steps: back up, migrate --check for the preflight (legacy rows, estimated preparation and pause, anything that refuses the cutover now), migrate --prepare ahead of the window and again just before it, migrate in the window, then audit verify and audit checkpoint. A plain migrate with no window does all of it in one run. The cutover refuses a prepared transaction left open or a session the login cannot see, by name; fix that and run it again. Interrupted at any point, migrate resumes. A v0.0.16 binary refuses the migrated database as ahead of it.
  • Decisions move: semantics version 4 (#616). +, - and * over decimals and quantities now refuse where they used to round half to even into the digits that fit: 1e-28 * 0.5 was 0, the largest decimal plus 0.4 was unchanged, and round could return a figure that was not a multiple of its quantum. A result that fits is unchanged, digits included, so a rule over ordinary figures decides as before. A transformation whose arithmetic used to round now errors, which propose reports as a kernel error, not a rejection. To find them before anyone does: after the migration, run morpholog rehearse <your programme> with the programme you serve, unchanged. Read the report as a diagnostic, not a proof. A row reported as would_error is a proposal that errors under this binary when re-decided against the audit prefix before it, and under the same programme the arithmetic is the likeliest cause; but the prefix is the order of effects, not the state each original proposal saw while writers overlapped, so a row can also error or differ for that reason, and a row the record cannot replay, an act the programme no longer has or arguments it no longer takes, is unreplayable rather than judged. Look at each would_error row's reason before concluding anything about it. The known limit: a product of two wide figures, about twenty-eight significant digits in total, refuses where it rounded; rounding the operands first is not the same figure, and a rounded multiplication waits for an example that needs one. Division keeps its rounding rule. Audit rows and receipts stamp the version they were decided under; a verifier on another version says not_re_evaluated.
  • Regenerate every Python client with the v0.0.17 binary. A client pins the binary version, so a v0.0.16 client refuses this binary at its first call. Three contract changes reach existing code:
    • writer_roles is gone from audit(), audit_named() and audit_checkpoint(), as --writer-role is gone from the binary: the watermark reads the lock table, so it needs no view of other sessions and no assertion of who writes (#632). A call that passed it is a TypeError.
    • deadlock_detected is a new proposal-row code beside serialization_failure (#626): PostgreSQL chose this transaction as the victim of a lock cycle and nothing was recorded. retriable is true for both, and envelopes.RETRIABLE_CODES is the list. A v0.0.16 client refuses the receipt as an unknown code, which is the safe side.
    • Audit rows written since the migration carry audit_order, act_ordinal, ordered_at and operations (#632); the strict models refuse an unknown key by design. The new models: Ordering, Operation, the rehearsal report family, ActivationPreflight, ReplayIndeterminate, ReplayConflict, TreeActivationFaulty. New methods: rehearse(), and migrate(prepare=True).
  • Scripts that pass --writer-role to inspect audit or audit checkpoint fail at argument parsing. Drop the flag; the lossless resume no longer needs it.
  • The tail's rows change shape. Rows from before the migration are as they were. The migration itself writes control rows at the first order: morpholog.baseline chunks, then morpholog.activate, each with the attestation {"mode": "migration"}. They are not transitions of any programme: coverage, evaluate and rehearse skip them, and --as-of a chunk's id is refused with the record's id to use instead. A projector that dispatches on transformation names sees them once. A fresh database has none.
  • Evidence packs are format 19 (#632). This release verifies format 19 and format 17, which v0.0.15 and v0.0.16 wrote, when every row of a format 17 pack is from before the order. A v0.0.16 verifier refuses a format 19 pack as unsupported. Format 18, which only development builds wrote, is refused by name. Keep old packs with the release that wrote them, or export them again.
  • audit verify has a third replay verdict, and it is not corruption. The report carries two verdicts: the tree verdict, which says whether the log up to its latest checkpoint still matches its checkpoints (a rewrite that also rewrote the checkpoints is caught only against a checkpoint you hold outside the database, and rows after the latest checkpoint are not yet covered), and the replay verdict, which says whether replaying the log rebuilds the claims table. consistent and divergent as before, and now indeterminate: a legacy history whose replay does not reach the baseline the migration recorded, which two legacy writers overlapping before the order existed can lawfully cause, since their rows were sorted by transaction start. The two are judged apart: an indeterminate replay beside a passing tree is not itself evidence of an edit, only that the pre-migration order cannot be told apart from the table. Rows written since the migration replay exactly. A divergent report now lists conflicts, such as a delete of a claim the history never held, which is what to read first. audit verify-pack holds a complete-prefix pack to the activation's shape, activation_faulty otherwise.
  • --as-of <timestamp> needs the primary (#645). "As of t" is the state after every transition placed in the order at or before t. The reads settle the instant against the orders still held on the connected server, so a standby cannot answer one; a transition id still can. An instant later than the last settled row while a writer is in flight is refused as not settled; retry once that writer finishes. The same holds for --after with a transition that is not yet settled. evaluate --train-until <timestamp> selects by the same order, and its report is format 6.
  • No programme hash moves. The twenty-four gallery programmes hash the same under the v0.0.16 binary and this one, checked side by side. The canonical encoding is unchanged.
  • Index plans are unchanged. Planned with the v0.0.16 binary and with this one, each on its own database, the whole gallery needs the same 371 indexes and 9 statistics objects, by name. The compiled arithmetic adds no seek. Run morpholog provision indexes --check <programmes> after the migration as the upgrade sequence says.
  • check may newly hint. BindOnlyToRetract (#614): a bind whose fields are read by nothing but the retract that follows, where the kept fields cover a uniqueness key, can be the pattern form retract Row(row: row, ..), which has always matched and retracted every hit. A require keeps the refusal a bind gave on no match. A hint fails check --strict.
  • Gallery programmes changed. If you copied one, compare it:
    • example 02 gains replay guards on its two revenue acts and refuses a reused id (#620);
    • example 08 takes one result per screening and refuses a stale result moving the pointer back (#623);
    • twenty-six acts across nine examples that sent a notice and could be accepted again unchanged are now refused, and seven ids or notices that could stand for two records are disambiguated, in 03, 06 and 13 among others (#621);
    • example 24 is new (#612).

The language

  • Exact arithmetic (#616). The syntax sheet always promised exactness, and a sum that did not fit refused; now +, - and * do the same. round(v, q) computes over exact integers and is judged on the multiple it selects: an unchosen candidate or the doubled remainder outside the range is no reason to refuse. Nothing in the surface changes.
  • No new construct. The erratum (#534) is an idiom: an append-only claim about a claim, RecordedInError(claim_id, reason), naming the recorded line by its own identity, with rules reading the line through a definition of standing. The retract by key (#390) was always there; the syntax sheet shows it now. The generated grid stays in transformation bodies.

For embedders

  • morpholog rehearse <candidate.morph> (#521), against the d...
Read more

v0.0.16

Choose a tag to compare

@github-actions github-actions released this 21 Oct 14:15
8de3ab0

23 merges since v0.0.15. Rules can now range over the hours, or any fixed periods, of an interval: periods(from, until, step) builds the grid inside the rule, and a rule says how long a window may be before the grid is built. Unary minus arrives as plain sugar, a definition can be called by the names of its parameters, and a literal in a programme is a parsed value rather than text, so two spellings of one value are one programme. That last change moves the programme hash of any programme whose literals were not already in their canonical spelling. A moved hash touches the generated client's startup check and the derived SQL views, so read Upgrading before you deploy.

No decision changed: the semantics version stays 3. No migration is needed: a v0.0.15 database is current. The generated client gains typed methods for scoring, guarantees, a covering checkpoint and session-side explain, and it decodes quantities with their unit, which is a change to what your code receives.

Upgrading

  • No migration. The schema is unchanged since v0.0.15; morpholog migrate --check reports the database current. A v0.0.15 database serves this binary as it is.
  • Some programme hashes move. A literal is now a value, and the canonical encoding is 2 (#600). A programme whose literals were already in their one spelling keeps its hash; one that wrote span(P1Y), duration(PT90M) or a timestamp with an offset gets a new hash, because those are now the same programme as span(P12M), duration(PT1H30M) and the instant in Z. 1.50 and 1.5 stay two literals, since a figure computed from one keeps its scale. In the gallery only the charging-years example moved. What to do:
    • run morpholog hash on each programme you serve with the new binary and compare it with the hash you pinned; update any deployment metadata or external reference that names the current programme by hash;
    • regenerate every generated Python client with the v0.0.16 binary whether or not the hash moved (below); where it moved, a client generated under v0.0.15 refuses the programme at its first call, and a resident session refuses to open, so start new sessions and drain the old ones;
    • derived SQL views. A generated view reads only the derived cache rows written under its programme hash. Where the hash moved, run morpholog generate views, apply the new views, then morpholog refresh derived for that programme; until the refresh, the regenerated views return no rows. This touches read projections only, never admitted claims or audit history. The embedder guide has the sequence;
    • keep the old hash and the programme as released under it wherever it admitted transitions. Audit rows keep the hash of the programme that admitted them, audit verify is unchanged, and the new hash is a new identity under the new encoding, not a sign that any decision changed. Do not rewrite historical hashes to the new value.
  • The formatter rewrites spellings. P1Y prints as P12M, PT90M as PT1H30M, an offset timestamp as its Z instant, and 0 - x as -x (#600, #601). A programme committed byte-exact from the formatter's output can change with this binary while its meaning does not.
  • check may newly fail.
    • A decimal the exact type cannot hold, a date that does not exist or a malformed instant is a parse error at its span (#600). Before, such a literal was accepted and silently matched nothing, or failed later.
    • check --database-url <url> and check --against <file> (#575) are new and refuse a programme that no longer fits the stored claims or a sibling programme's declarations; they run only when asked.
    • A periods grid without its window gate or with a computed step is refused by name (#603); a grid whose gate still allows more than ten thousand periods is a hint, which fails check --strict.
    • check no longer reports EmptySumUntyped (#597): the checker types every empty sum, and a hand-built seed it disagrees with is SumSeedNotFaithful, naming both.
  • Validation widens on two shapes, and some input contracts change (#595, #597). An empty sum whose target the old pass could not type, an outer-bound quantity or a builtin over a duration, was refused and now validates, with the typed zero (0 t, PT0S). A parameter used in p + sum(...) <= 10 is now typed Decimal, and one used in p <= cap * 2 with a Decimal[t] cap is typed Decimal[t]; if your programme has either shape, morpholog schema and the generated client's models change accordingly.
  • Regenerate every Python client, with the v0.0.16 binary, whether or not the programme hash moved: a generated client pins the binary version as well as the programme hash, so a v0.0.15 client refuses this binary at its first call. Several envelopes also gained fields, and the strict models refuse an unknown key by design: needed_by on each index of the provision report (#578), row on the session's explanation (#591), below_baseline on migrate --check (#574), the new guarantee envelope (#579), the checkpoint_refusal envelope (#589). Two behaviours change for existing code:
    • a tagged quantity decodes to values.Quantity(amount, unit) on claim instances, audit rows, witness and compared values, where v0.0.15 gave a bare Decimal and dropped the unit (#564). Generated intent payloads still give the amount as Decimal, after checking the unit. Where code read a quantity field:

      # v0.0.15
      amount = claim.args[2]            # Decimal("100"), the unit lost
      
      # v0.0.16
      quantity = claim.args[2]          # Quantity(Decimal("100"), "MWh")
      amount, unit = quantity.amount, quantity.unit

      The field index is illustrative. Check the unit rather than discard it;

    • audit_witness(...) and audit_checkpoint(witnesses=[...]) raise MorphologWitnessFailed when a timestamp authority fails after the checkpoint was stored (#592). Before, the client returned the checkpoint as a success and the witness was silently missing. The checkpoint is recorded, not rolled back: exc.checkpoint is the head as stored, with every witness that did arrive, and exc.retriable is true. Retry with audit_witness(tree_size, witnesses) against the same tree size; a proof already stored is not stored twice, and nothing records a second checkpoint.

  • Index plans. Planned with the v0.0.15 binary and with this one, each on a fresh database, the index requirements of the twenty gallery programmes both can parse are identical: 286 indexes and the same statistics objects. The three programmes v0.0.15 cannot parse (10, 15 and 23, for the named definition call, the unary minus and the grid) bring the whole gallery to 23 programmes and 339 indexes. The report's new needed_by names the rule behind each index, so a new line after an upgrade explains itself (#578). Run morpholog provision indexes --check <programmes> before writes resume, as the install guide's upgrade sequence says.
  • Gallery programmes changed. If you copied one, compare it:
    • example 15 gains a credit note, reversing a billed line with its figures negated (#601);
    • example 19's hash moved with the encoding (#600);
    • every pattern with three or more wildcards is spelled by the fields it reads, across twelve examples (#601), with no hash change;
    • example 10's selector call is spelled by its parameter names (#594), with no hash change.

The language

  • A grid over instants (#603). periods(from, until, step) is the start of every step-wide period that meets the half-open window [from, until), as a collection of timestamps, anchored at the Unix epoch in exact nanosecond arithmetic. A rule that must hold in every hour of a trade writes let hours = periods(starts_at, ends_at, duration(PT1H)) and ranges over hours with forall or sum, or directly with for. A window off the grid meets one period more than its length holds, so alignment is one identity: (until - from) / step = sum(1 | h in hours). The grid's size is the rule's own: the step is a literal, and the call must follow require until - from no_longer_than duration(...) with a literal bound, earlier in the same transformation. Validation refuses it otherwise, and no kernel constant caps the count. A loop binder over a grid is a timestamp before its first use. No zone and no calendar: a local day's bounds enter as a claim, and a 23-hour day gives 92 quarter-hours with no special case. Grids live in transformation bodies; an invariant over a generated grid waits for the rule that forces it.
  • Unary minus (#601). -x is 0 - x, nothing more: no new node, decimals only, and -100 is a subtraction over the literal, never a signed literal, so a claim argument still takes no sign. The formatter prints 0 - x back as -x; the hash is unchanged.
  • A definition is called by the names of its parameters (#594), trade_terms_in_force_on(trade: trade, as_of: d, ..), a generated effective by selector's included. The IR stays positional, so no hash moves.
  • A literal is a value (#600). The IR holds parsed decimals, dates, instants, durations, spans and quantities, read once at the source. A text the type cannot hold is a diagnostic at its span, never rounded in.
  • One kind inference (#595, #597, #598, #599). The static checker is the one place kinds are inferred: it owns the parameter contract that schema, generate python-client and --args-named read, types every empty sum, and validation keeps the contracts it observed so reading one is a lookup. Decisions did not move.

For embedders

  • check --database-url <url> (#575) compares the programme with the claims the database holds: a stored claim with another arity, kind or unit is an error on the declaration, and a stored predicate nothing declares is a hint. check --against <file> refuses a predicate two programmes declare differently, with no database. Python check(with_database=True). The guide's dep...
Read more

v0.0.15

Choose a tag to compare

@github-actions github-actions released this 12 Oct 14:04
85961c3

33 merges since v0.0.14. Admission is more selective: an old violation no longer necessarily blocks a change to records it does not touch. That changes some decisions, so the semantics version moves from 1 to 3. Refusals also say more. They carry the bindings at the point of failure, and when the failure is a comparison, its operator and the two values compared, so an application can explain a refusal without redoing the rule's arithmetic.

This release also replaces the evidence-pack formats with one, format 17, makes the generated Python client check the type of every value it decodes, and lets a deployment move to roles of its own. Existing databases need migrations 024 and 025. If you use a generated client or keep evidence packs, read Upgrading before you deploy.

Upgrading

  • Start from v0.0.14. This binary carries only the migrations after v0.0.14's schema (#516). A database that does not record v0.0.14's migration 23 is refused by name; upgrade it with a v0.0.14 binary first.

  • Stop every process on the database, back up, then run morpholog migrate. docs/install.md ("Upgrading an existing database") has the whole sequence. Two migrations are new:

    • 024 drops the rejection log's rule that only an invariant refusal carries a witness, since a gate refusal now carries one too.
    • 025 adds rejections.compared.

    A v0.0.14 process started after the migration is refused before its first query, because the database is ahead of it.

  • Then provision indexes, and check them. Run morpholog provision indexes <programmes> for every programme the database serves, then morpholog provision indexes --check <programmes> before writes resume; --check changes nothing. migrate now ends with a hint naming the check (#549). Planned with the v0.0.14 binary and with this one, each on a fresh database, the gallery's index requirements are identical: 21 programmes, 319 indexes and 91 statistics objects. That does not show your programmes are unchanged: a rule with or in its consequent now compiles (#544) and can need more indexes. Order(o, d) implies (Approved(o) or Waived(o)) went from one index to four.

  • Some decisions differ: the semantics version is now 3. For the same programme, state and proposal, this release can decide differently from v0.0.14. Both changes narrow what admission checks:

    • a change that touches none of a rule's reads no longer checks that rule, and arithmetic, an extremum or a builtin over bound terms no longer widens a rule to the whole state (#529);
    • an or in a consequent no longer widens a rule's cases (#544).

    So a proposal v0.0.14 refused because of an old violation the proposal did not touch can now be admitted. Version 2 was never released.

  • Evidence packs and receipts from v0.0.14. There is one pack format now, 17, for every kind of pack (#517).

    • A pack written by v0.0.14 is reported unsupported_pack, naming the format it carries: its evidence is not checked. Where you still have the database, export the pack again; a v0.0.14 verifier cannot read a pack this release writes, so upgrade verifiers with the database.
    • A receipt issued under v0.0.14 stays tied to semantics version 1. Export its evidence again at the receipt's own checkpoint and the evidence verifies, but the evaluation reports not_re_evaluated and the receipt does not pass. Only a release that implements version 1 re-evaluates it.
    • So keep your v0.0.14 packs, and a v0.0.14 binary to verify them. A holder of a pack without the database cannot export it again, and this release does not verify the older formats.
  • Python 3.12 is the floor for the generated client (#516).

  • Regenerate the Python client. Several envelopes gained fields: witness and compared on refusals, asserted_in on claims reads, cases in check --json, and refusals in coverage. A client generated before refuses them by design. The client is also stricter (#559). Malformed output raises EnvelopeError from an envelope and CodecError from a generated model, where it used to pass through or raise TypeError. A session error receipt with a code the schema does not publish now poisons the session.

  • check may newly fail.

    • check follows the runtime into not, implies, exists and forall, and refuses a programme whose binding flow can raise an unbound variable at runtime (#547).
    • Two new hints can fail check --strict (#532): a rule that re-checks history when a figure changes, and a field or parameter name the Python client would refuse.
  • Gallery programmes changed. If you copied one, compare it:

    • example 12's from and to are now starts_at and ends_at (#532);
    • example 13 records one deployment and enforces who may act (#552);
    • example 04's approval acts take only the document's id (#553);
    • two permanent events in 13 and 17 are append only (#532).

    Their programme hashes moved.

What a refusal says

  • A refused gate carries its witness (#531): the bindings at the part of the gate that failed, from the same walk that renders the trace, never the actor. It is on the rejected envelope, batch and session receipts, the rejection log and explain.
  • A refusal carries the two values its failing comparison compared (#537): compared with the operator and both values, kept only when they fail the comparison. It is on every refusal kind, explain and the rejection log (migration 025).
  • explain's invariant verdict carries the witness too (#542), held to the refusal's by a test.
  • check names the rules a change may check whole (#540). check --json gives each invariant cases: bound, or whole with the construct responsible. check -v prints them.
  • Coverage names what refused (#546). Each transformation's coverage lists refusals by kind and rule, summing to proposals_refused. Names this programme does not declare get their own section in the prose.

Admission

  • Arithmetic no longer widens a rule, and a change outside a rule's reads leaves it unchecked (#529). A rule over pre is still checked, since it judges the change itself.
  • or in a consequent compiles, and bounds (#544), as the last conjunct of the consequent or as a definition body. A conjunct after it is refused by the compiler as disjunction_shape, and the rule stays interpreted.

For embedders

  • morpholog roles move (#558) moves a deployment from a shared role pair to roles of its own, in one transaction. It moves only the logins you name, keeping their inherit and SET ROLE settings. It refuses and changes nothing when the old roles hold more than Morpholog's floor in this database, belong to another role, or when PUBLIC holds privileges the floor would revoke. install.md covers it, including how to tell whether a move committed when the reply was lost.
  • --mentions <subject> (#543) on inspect audit and inspect rejections, and mentions= on the client, keep only the rows that name a subject: in an audit row's arguments, claims or intents, or a refusal's arguments, witness or compared values. The actor is not searched.
  • Claims reads name the transition that made each claim present (#551): asserted_in on inspect claims, the session's claims and the client's reads. Read now, it is the claims table's own column, which audit verify does not check. Read --as-of, it comes from replaying the audit log.
  • The session answers audit, rejections and ping (#545). The protocol is still 1.
  • The client's init() takes role_prefix (#548).
  • The generated client is type-true (#559). Every parsed envelope holds the types its annotations declare, and the whole package type-checks under the pinned mypy in CI. It also passes a pinned ruff with no suppressions (#543).
  • audit verify reports progress on stderr (#554) every ten thousand transitions.
  • New guidance in the embedder guide:
    • the resident session behind a web server, measured at about half the time per proposal of a one-shot propose (#555);
    • a deadline sealed by a witnessed checkpoint (#418);
    • why checkpoint reports two shapes (#556);
    • how to read names for audit rows written before parameter names were recorded (#557);
    • keeping personal data out of the record, and what that does not cover (#560).

Evidence

  • One pack format, 17, for every kind (#517), described under Upgrading. Each manifest names its kind and the release that wrote it.
  • Witnesses (#515): a token whose signer's key is of another family than the signature it names is now invalid, where v0.0.14 said unsupported. An ECDSA or SHA-224 algorithm identifier carrying parameters the standard forbids is invalid too.

Tested more thoroughly, unchanged in behaviour

Tests now pin the following. No behaviour changes:

  • Outbox: a delivery lost to a worker crash is delivered again as the same intent, with the same idempotency key and payload, and the redelivery adds no audit row, claim or intent (#560). Delivery is still at least once.
  • Calendar: property tests check the calendar laws through the evaluator (#560).

Worked examples

  • 21, closed-loop execution (#518). An untrusted agent proposes orders, a custodied executor places them, and the venue's own report comes back as claims. A derived read exposes an order nobody authorised.
  • 13 enforces the trust boundary its README described (#552), and 04 decides an approval's route from the record (#553).

Documentation

  • docs/surface-syntax.md shows every form of the language once, and a test parses each block (#538).
  • A correctness pass made the docs say what the code does today (#539).
  • The case-width hint says what a respelling does, and a pin is the hash field of morpholog hash (#513).

Rust API

  • RejectionReason::Require and BindNone carry witness; every variant carries compared: Option<Compared> (#531, #537). `PgProp...
Read more

v0.0.14

Choose a tag to compare

@github-actions github-actions released this 08 Oct 07:25
f185e07

32 merges since v0.0.13. The headline: every commit now records the hash of the programme that admitted it, the version of the semantics that decided it and the fresh subjects it drew, so a past decision can be reproduced exactly, given the programme and the semantics the record names; and each deployment's least-privilege roles are its own.

Upgrading

  • Stop every process on the database, back up, then run morpholog migrate. docs/install.md ("Upgrading an existing database") has the whole sequence. Four migrations are new:

    • 020 adds audit.model_hash: the canonical hash of the whole programme that admitted the row.
    • 021 adds audit.semantics_version: the version of the rules' meaning that decided it. It is only allowed on a row that has a model hash.
    • 022 adds audit.drawn_subjects: the subjects the act drew from new Subject(), in draw order, as a JSON array of strings. It is only allowed on a row that has a semantics version.
    • 023 adds morpholog.deployment_roles, which records this database's least-privilege roles. A database whose fixed morpholog_writer and morpholog_reader hold the floor by direct grant has them recorded. Grants through PUBLIC or another role do not count.

    None of the audit columns is backfilled: older rows keep their earlier Merkle leaf encodings and stay NULL, as they must.

  • Stop every process before migrating; the database does not do it for you. A v0.0.13 process started after the migration is refused before its first query, because the database is ahead of it. One left running from before cannot commit a proposal: each new audit column comes with a constraint that leaves existing rows alone and refuses every new row without it. But a running outbox worker checks the schema only when it starts, and marking a delivery writes no audit row, so it can go on delivering. Migrate once, then start every process on the new binary. Rollback is restoring the backup.

  • Test suites that forge audit rows in raw SQL must now give each new row a model_hash, a semantics_version and drawn_subjects (an empty array when the act drew none). A forged row without them is refused at insert.

  • Name your columns. Column order in Morpholog's tables depends on the database's history, so a migrated database orders them differently from a fresh one. Replace any positional INSERT or SELECT * over Morpholog's tables with named columns.

  • Least-privilege deployments: migrate before init --reset --least-privilege. init --least-privilege, with or without --reset, now refuses before it creates or drops anything whatever it could not provision afterwards (#503), a connecting role that may not create roles included. A reset of a database that has not reached migration 023 is refused naming morpholog migrate: migrating records the existing pair, and the reset then binds them again.

  • Roles shared between databases. migrate now applies the privilege floor only to the roles this database records, not to whichever morpholog_writer the cluster holds. It warns when those roles also hold privileges in another database, as deployments provisioned before this release can. docs/install.md ("Moving a deployment to its own roles") gives the steps.

  • Regenerate the Python client. The audit rows, check_report, init_report and every verification report changed shape (below). A binary the client cannot start, such as a wrong MORPHOLOG_BIN, now raises MorphologError instead of FileNotFoundError.

  • Upgrade every verifier with the database. A pack that discloses a row written by this release carries a pack format version a v0.0.13 binary refuses as newer than it understands, before reading a row. Packs of older rows keep their old versions and stay readable to older verifiers.

  • check --strict may newly fail. Two hints are new: a rule whose case is wider than the claim it guards, and a variable a require matched being named again. Eight gallery rules were respelled for the first of them, which moved five gallery programme hashes; re-pin any you pinned.

  • generate python-client --check now fails on stray files in the output directory (__pycache__ apart), so a CI step over a directory with extra files will go red.

What a commit records

  • The programme that admitted it (#447). audit.model_hash is the same hash morpholog hash prints: the whole programme's identity, unaffected by comments or layout. A row is now a join key back to the exact rulebook. The audit row envelopes carry it, and AuditRow refuses unknown fields from now on.

  • The semantics that decided it (#458, #459). The kernel names its semantics version, and a fingerprint test holds it: a change that gives a different answer to an unchanged question must move the version. Verifying integrity does not need the named version; it reads bytes, not the evaluator they name.

  • The subjects it drew (#448, #466). Fresh subjects are now an input to the kernel, not something it makes, and every durable commit records the ones its act drew, in order. With the programme the hash names and an implementation of the semantics version, the record holds every other input a replay needs. An explanation of a refusal replays the draws of the run that refused.

  • Each field is in the Merkle leaf, so the leaf moved to versions 4, 5 and 6, chosen by which fields a row carries. Each pack kind gained one format version per step:

    Pack Before Programme Semantics Draws
    Complete prefix 4 5 9 13
    Window 2 6 10 14
    Selective 3 7 11 15
    Single document 1 8 12 16

    A pack's version is set by the newest row it discloses, and verifiers refuse a version above or below that.

  • The programme hash's encoding is frozen (#460). Freezing it moved no existing programme's hash (the gallery hashes above moved because their sources changed); a new construct may only add rendering for itself.

Proofs and evidence

  • Receipts (#462). audit receipt <file.morph> --pack <pack> --derived <Predicate> turns a derived read into a receipt, and audit verify-receipt recomputes it from a complete-prefix pack. It checks every layer: the evidence, completeness, the checkpoint, the programme, and the evaluation. It exits non-zero unless every layer holds. Window and selective packs are refused, since a derived read needs the whole prefix. The client has audit_receipt() and audit_verify_receipt().
  • Every verification report says whether it passed (#468). verify_report, pack_verification_report and receipt_verification_report lead with passes, and the exit code is the same answer from the same rule. It means this invocation passed every check it was asked for. Among witnesses, only an invalid one fails it; untrusted, unverified and unsupported say what could not be established.
  • FreeTSA witnesses verify (#470). freetsa.org signs with ECDSA on P-384 over SHA-512; its witnesses were unsupported and are now verified under its root (unverified without anchors). Path validation now checks a certificate with its issuer's key type, and carried certificates are judged by the bytes the token holds.
  • A path this build cannot check is unsupported, not untrusted (#498). Path search tries every issuer under a name. A path blocked only by a signature this build cannot check (a P-521 issuer, for example) makes the witness unsupported. It is untrusted only when every path was judged and none validated. The search is bounded, since a token chooses the certificates it carries.
  • Known limitation (#499): a token whose signer's key is of another family than the signature it names (an ECDSA key and an RSA signature, say) is reported unsupported, not invalid. It never counts as verified.
  • A complete-prefix pack is NDJSON whatever its file is called; readers go by content. Window and selective packs are single JSON documents.

For embedders

  • Each deployment's least-privilege roles are its own (#484). init --least-privilege --role-prefix acme_ creates acme_writer and acme_reader, grants them this database only, and records them. The default prefix, morpholog_, gives the old names. init refuses a role name that already exists unless this database records it. migrate never creates a role and refuses if a recorded one is gone. init_report's writer_role and reader_role are now the deployment's actual names, no longer fixed strings. The generated client's init() cannot pass a prefix yet (#501).
  • check --json reports each invariant's route (#445): invariants lists every invariant as compiled, or interpreted with the reason it did not compile. The client's CheckReport gains the field and a route summary.
  • provision indexes --check (#467) changes nothing and exits non-zero unless every index and statistics object the programmes need is in place: a deploy step can gate on it. The client has provision_indexes(check=True) and ProvisionReport.is_current.
  • Typed submit_all (#482) on the client and the session submits several requests as one decision over transact. Requests satisfy an exported Request protocol, and CI checks the client and session with a pinned mypy, including that a generated request model is accepted and anything else refused.
  • The client's pins are contract (#436): expected_version and expected_model_hash on Morpholog and Session are pinned surface, and a proposal that never started is an operational error, not an unknown outcome.
  • Diagnostics are coloured only on a terminal (#492), and never when NO_COLOR is set to a non-empty value, so a pipe or a log gets plain text.
  • docs/embedder-integration.md now has a table of every proposal error code, with what it means and whether to re-submit, held to the binary's list by a test.

Writing rul...

Read more