Release per August 5, 2024: MyContexts v0.23.0 (PDR version 0.25.0)
This release features 'effortless onboarding'
MyContexts Version v0.23.0 delivers the following milestones in the project Perspectives: Making Models as supported by NLnet:
- Effortless onboarding (Milestone 6)
This has been described as follows: For InPlace to be useable to the average end user, setting up should be a breeze. However, the system requires signing up to a message broker service for transport of data updates. This we solve by 1) having that service offer invitations to use it for free (possibly for a limited period of time) on its website and 2) making use of that invitation effortless or indeed automatic on setting up.
The video below demonstrates self-signup to a BrokerService. It shows MyContexts as it runs on a MacBook mid 2015, 2,5 GHz quad core, 16 Mb internal memory. The current version has been shown to run on macOS Monterey 12.7.5 in Chrome and in FireFox.
NOTICE: If you want to experience effortless signup but have a previous installation, you're advised to remove it completely first. Visit the https://mycontexts.com/manage.html page.
Effortles onboarding
proved to be easier said than done. It required many building blocks, such as
- being able to access the RabbitMQ management API in a Perspectives Model;
- effective public contexts, stored in locations that can be managed from within MyContexts;
- incorporating Markdown in model texts and entering it as an end user in order to build readable web pages to guide new users through the necessary steps;
- extended database- and broker service models.
We find that many of these things required a deep thinking through before we were able to integrate them in the Perspectives framework. And the functional result is somewhat disapointing; it is not as if markdown and wiki-like frameworks are world-class innovations. However, we think the solutions are elegant contributions to the Perspectives Language and still it is quite compact. And we have shown how familiar concepts like static web pages and web forms are but special forms of the far more general concept of context, while in the same stroke bringing the users involved in those artefacts into the picture. For example, a web page is just a context with a lot of readable text with both an Author and a Reader user role. Usually, Readers are a multirole; optionally, the Reader role may be declared as public.
Realising the building blocks and actually using them to build a smoothly working service for auto-signup also brought out a lot of parts that were not yet up to their task. All have been fixed; a number of the most important are listed below.
By now we have experienced that approaching an information infrastructure for cooperation from a distributed perspective gives rise to a completely different development experience than traditional stand alone applications. Automatic synchronisation is wonderful when it works, but a pain in the neck for the developer who has to remedy situations that have run off the rails. For not only should the executable be fixed, obviously, but in many cases the data needs fixing, too. And then one finds out that errors have been spread all over the place - meaning, over many installations of the program. Each of these installations maintains (overlapping) parts of the Perspectives Data Universe; none oversees all. There are many interconnections and inter-dependencies. For example: an installation needs adequate models, but one needs a functioning installation to adapt a model. All in all this gives rise to a messy development cycle where fixing the data universe is periodically punctuated by rebooting the Universe.
Given these circumstances, we are proud to present this next step and are hopeful for the near future. The scaffolding nears its completion; now let's grow some really useful models on it!
Major changes in the PDR
- Self registration. We have a tiny custom Node service that can be executed as a deamon on a server that runs RabbitMQ. This service allows for auto-signup of clients, capping the number of accounts at a configurable maximum. This goes hand in hand with a new version of BrokerServices that allows any user to sign up to a particular service.
- Markdown. Markdown is now a property range type. Screen controls generated for Markdown either allow editing it (for the update verbs), or display it rendered as HTML (for the Consult verb). Markdown can be static text entered in models, too. We have two Markdown extensions: one for hyperlinks to other contexts and another for executing modelled actions.
- Abstract Data Type. In order to perform type tests in compile time, we use a so-called Abstract Data Type (ADT). Such a type is a composition of simple types with the keywords
and
and or
. Comparing types relies on expanding types by substituting type definitions for their identifiers and then normalizing their shape. These algorithms now rely on more explicit data structures supporting the various stages. By caching the normalised form with types, we speed up type comparision by an order of magnitude.
- Bespoke databases. CouchdbManagement now offers the facility of a
Bespoke database
. That is a Couchdb database managed by a particular Perspectives Account. Such a database can be used to publish resources to. It is a requirement for public contexts and roles.
- Disconnecting users. A user may decide to leave the universe. Her peers should be informed and should refrain from trying to sync data changes with her installations.
- Restoring identities on setting up an installation. Both cryptographic keys and user identity files can be uploaded on creating an installation. This allows us to create an federated account for a single peer identity; it also allows us to restore an account. This is extremely important for the Perspectives Universe, as installations keep many tabs on their peers.
- New execution model. The execution model had grown too complicated. It has been rationalised and re-implemented. We now postpone a state query evaluation when it proves to be based on a resource that is about to be removed. This comes closer to modeller expectations.
- A new system for Inverted Queries. Inverted queries allow us to detect state change and they allow us to update result sets for clients that have subscribed to a calculated role or property. Up till now, these queries (really descriptions of functions that perform searches over the network of contexts and roles) were stored with the models themselves. This ran into a wall as models grew larger and Couchdb turned out to have a maximum file size limit that is little advertised... We now publish the inverted queries in a separate file that is attached to the model file in the repository. Updating a model is now a lot faster. Queries are cached in an LRU cache in compiled form, also speeding up overal execution.
- Remodelling CouchdbManagement. To facilitate self-signup and preparing for automatic account expiration with timely warnings. Account re-signup, etc.
- Continued remodeling of System, SocialEnvironment and TheWorld. As role
User
of PerspectivesSystem is no longer the bottom of the user role chains, most models have had to be adapted. We introduce a new indexed individual role: SocialMe.
- Broker services for multiple installations remodeled. A single identity (Perspectives Peer) can now declare a RabbitMQ queue for each of her installations. Messages sent by a peer to an identity is duplicated to all her queues by RabbitMQ.
Selected minor changes in the PDR
A selection from the 205 commits that have been made on the PDR since the previous release.
- On closing the client, we save resources. The PDR caches all resource modifications but only periodically saves them to its database. However, the end user could close down a client at any moment. If that client was the last one carried by the PDR, cached changes would get lost. This has been fixed.
- Screen definitions 'inherited' from Context Aspects. A user role with an Aspect might acquire a screen definition from that aspect. Only parts for perspectives on context roles that have an Aspect from the same Aspect context are included.
- A new way of synchronizing perspective properties. Previously, we regarded looking up a property as a kind of property calculation. We now rely on the query interpreter. This reduces the number of inverted queries by a large amount.
- Stronger type enforcement by the Purescript compiler. By introducing newtypes for a number of standard Perspectives roles (such as PerspectivesUser and PerspectivesSystemUser), and for 'functional roles' of roles (like Filler and Filled), that the Purescript compiler can enforce, we have improved the quality of the PDR code.
- A scaffold for performing data upgrades. We have a system that allows us to automatically execute some Purescript procedures when a new version of the PDR is published. This allows us to fix user data that are no longer compatible with PDR code. We also have such a system for MyContexts (the client side).
- Automatically Restoring Referential Integrity. The PDR is built on the assumption that an identifier will always resolve to a resource. Many safeguards have been built in to guarantee this. Nevertheless, data may break due to circumstances that cannot be controlled (power outage, etc). We now have a system in place that detects such a situation and will correct it by looking for and removing any references to a resource that is no longer there.
- Public resource caching. Uncache public resources before changing them. Contrary to regular privately stored resources, publicly stored resources can actually be modified by multiple actors (working on the same database).
- Refactored system initialisation. As the boiler plate perspectives code for model initialisation grew larger and unwieldy, I've removed a number of standard things to the PDR, relieving the burden on the modeller.
- Indexed individuals. Indexed individuals caused a lot of problems in synchronisation and in state handling on creation. We now have a scheme in place that works for fresh indexed user individuals and sync.
- Boundary functions. Additional error boundaries for the functions in the following libraries: Parsing, Files, RabbitMQ, Sensors, Utilities and Serialise.
- Dynamic property getters. Up till now we constructed calculated getters in compile time for properties on a role chain. However, as we can fill a role with a type that is specialised w.r.t. what is required, this can fail. All such properties are now retrieved by runtime searching.
- Functional queries. We can now declare a calculated role or property to be functional, overriding the automatically derived value. There are situations where the modeller can prove satisfactorily that a query will return just a single value, where the compiler cannot.
- System Clock. We now have all machinery in place to do decent date and time comparing,
adding durations and formatting such items flexibly. We also have a ticking clock in the form of a date and an hour system property that can be used in state conditions.
- Durations and date-time values. We have a set of new property range types: durations, like Hour, Year, etc.These cannot yet be used in property declarations. However, we have duration literals in the expression syntax: 1 day, 1 hour, etc. Calculated properties take their duration type from their expression. Durations can be added or subtracted from Date range types. They may also be combined in arithmatical expressions.
- CUID2. The Perspectives utilities lib now generates symbols with CUID2. This library has been shown to have far fewer collisions that the previously used GUID function.
Selected changes to the MyContexts client
- Refinement of the serviceworker. Improved caching; build- and version number as pop ups in the toolbar.
- Wait cursor. The cursor now consistently changes shape in all of the splash pages.
- Notifications. Notifications are now fetched for each context we visit.
- Data upgrade. The data upgrade mechanism for the client (e.g. used to update the version number).)
- Account creation refactored. We can now download and upload cryptographic keys. We can also upload an Identity document (for second installations or for installation re-creation).
- Indexed context is a live query. A model may add a new indexed context. The list of indexed contexts displayed when no context is open is now immediately updated.
- Startpage. MyContexts now opens a context on firing up. The identifier of the context is configurable from WebPack.
Selected changes to the React library
- SmartFieldControl handles Markdown.
- SmartFieldControl handles data and time.
- Creating contexts. The end user now can choose to just create a context role and not immediately fill it with a new context.
- Create context in remote context. The end user can now create a context using a remote perspective.
- Stricter use of live queries. In some situations, live queries were used where a single shot approach was more correct. These have been replaced by promise-based solutions.
- No duplicate behaviours. Occasionally a behaviour would be established multiple times on a screen component representing a role. This caused a lot of confusion.