MiCyte

← The wiki

43 — The local domain

BuiltRendered from 43-local-domain-log.md in the public repository. Edits belong there.

Every sandbox has a local domain (lcl_domain): its own node id space, stored as one document that both defines each node and records what it names.

Base structure

Every local domain starts with the same tree. Readers find each branch by its label, not its address, because insert_node can re-key any address.

1        local_domain
1-1      meta
1-1-1    glyphs      1-1-1-n    a drawing (the eleven canonical glyphs, circle first)
1-1-2    documents   1-1-2-n    a slot naming a datum document
           1-1-2-1  anchor        reserved
           1-1-2-2  local_domain  reserved
1-1-3    sources     1-1-3-n    a pin: <msn>.<name> and a content hash
1-1-4    artifacts   1-1-4-k    a kind: image, record, video, memo
                     1-1-4-k-n  an artifact slot, under its kind
1-1-5    the sandbox's own node: its title and the glyph it wears
1-1-6    the channel's own node, when the sandbox publishes one
1-2      classes     1-2-1 archetypes, 1-2-2 datum_types, 1-2-3 events
1-3      objects     the instance's own tree, free-form below here

There is one root. A new top-level branch is filed under objects.

The tree names itself

Meta's fifth child is the sandbox's own node, and its sixth the channel's, when the sandbox publishes one. Unlike the branches, these two are found by their place (SANDBOX_IDENTITY_ORDINAL, CHANNEL_IDENTITY_ORDINAL), because their label is the sandbox's title rather than a fixed word. LocalDomainLog.identity() returns the sandbox's node, and identity(channel=True) returns the channel's node, or the sandbox's when there is no channel node. Every surface that shows a sandbox or a channel reads its name and glyph from there, so no surface keeps its own icon for one.

An identity node is structure: it is never moved, deleted or given a document. rename_node retitles it as written ("Workshop" stays "Workshop"). The host's name_sandbox defines or retitles either node and dresses it in a glyph, bringing that glyph from the glyph library if the sandbox does not hold it. It refuses a channel node on a sandbox that has not named itself.

What a node wears

A structural node wears the mark its role fixes (STRUCTURAL_GLYPHS), and a node filed under one wears its branch's mark too, so a reader tells a branch's members apart at a glance:

NodeMark
documentsa page with a folded corner
sources and every pin under itsilcrow (§), except a pin to an archetype (below)
artifactsthree hexagons
image and each file filed under ita picture
record and each file filed under ita record button
video and each file filed under ita play button
memo and each file filed under ita waveform
the sandbox's own node (meta-5)the sandbox mark, a ring of six dots, until somebody chooses another
classestag
a miscellaneous class, wherever it hangshannunvaakuna (⌘)
a person's profile node (natural_entity_profile)a folder holding a person
a business's profile node (legal_entity_profile)a folder holding a building

A tree whose library lacks one of these wears the role's fallback (STRUCTURAL_FALLBACK). Only a node wearing a generic mark is re-dressed: the default, the role's previous mark (SUPERSEDED_CLASS_GLYPHS), or the branch's present one. A glyph somebody chose stays. apply_convention brings an older tree up to these marks in its one write.

The graph draws a node with nothing under it with a small dot where the expand arrow would be.

A type's glyph, and an archetype in brackets

Every datum document type has a glyph: the convention's class glyph for it, else TYPE_GLYPHS, else what the archetypes vocabulary wears (type_glyph). A name derived from a type (kind_job, viewscope_job, job_txa) wears the type's. The tree document's own type, local_domain_log, wears the hollow node tree; the convention, lcl_domain, wears the filled one; an anchor wears the anchor.

An ARCHETYPE wears its type's glyph inside four corner brackets. This is a rule of drawing, not a second glyph: the node holds the type's glyph, and the surface frames it when the node is:

  • a word of the archetypes vocabulary;
  • a source pin to the archetype library (<msn>.archetype_<name>);
  • a document of the archetype library itself, placed under its kind.

A pin to the archetype library is dressed in the type it names rather than the silcrow. It keeps the silcrow while the tree cannot wear that type's glyph. Every pin is drawn in the slot ink, and its tip names the sandbox it comes from.

A new tree is born this way: the seed gives each archetype word and archetype pin its type's glyph, and apply_convention mints the convention's own pin in the filled node tree. So a tree is converged by one write, and a new sandbox is not stale on its first day.

A sandbox's face

The glyph the sandbox's own node wears is the sandbox's face. A surface that names a sandbox draws it, read from the owner's tree: the sandbox switch and the shelf, and a source row naming the sandbox its document comes from, in this instance or another. A sandbox still in the default circle, or holding no tree, is drawn with the generic sandbox mark.

A drawing the glyph library changes reaches every tree that holds a copy: apply_convention compares each held copy with the library's drawing and redraws the ones that differ, saying so in its dry run first. The health report cannot see a copy behind, because a copy is a document of its own and the report reads each tree's pin. So the script visits every tree after a redraw, a fresh one too, and seed_glyph_library --redraw ends by saying so.

A label and its lens

A label is written once, in snake case (lawn_care, pressure_washing). What a person reads is its lens: underscores become spaces and each word's first letter is capitalised, with the rest of the word kept as written (Lawn Care, HVAC). The lens is local_domain.lens in the package, and chdLens in the channel viewer. No surface keeps a second, display-only name for a node.

ConcernCode
Labels, branches, kinds, glyph choicesmicyte/core/datum_ops/local_domain.py
Seed rows for a new sandboxseeded_local_domain_rows and seeded_anchor_rows in micyte/core/instance_baseline.py
Provisioning, called by every creator of a sandboxlocal_domain_provision_runtime.py in the host application

Row shapes

The value group of a datum address is its tuple count, so a row's shape follows from its address:

AddressRowMeaning
4-3-N[addr, lcl_id, <node>, title, <bits>, lcl_id, <glyph>]A node with its glyph. The minimum written
4-4-N… lcl_id, <glyph>, lcl_id, <slot>]A node that also refers to one thing
4-4-N… lcl_id, <glyph>, mss_source_binary, <hash>]A source pin
4-2-N[addr, lcl_id, <node>, title, <bits>]A node without a glyph. Read, not written while a glyph branch exists

The fourth cell of a 4-4 row is the one thing the node refers to: a document slot, an artifact slot or a source pin. The branch the slot is under says which.

Writers keep every node at 4-3 or above: LclBuilder._add_row defaults the glyph to circle, set_node_icon will not remove a glyph, a created document's slot gets document, and an inserted group gets the default. A tree with no glyph branch keeps writing 4-2.

A title is one title babelette: at most 64 printable ASCII characters.

One definition row per node

A node has one definition row. Attaching a document moves the row from 4-3 to 4-4; detaching moves it back. NameIndex resolves a node by its first row in document order, so a second row would make its label depend on row order.

The anchor matches the tree

The anchor's lcl-SAMRAS magnitude encodes the set of nodes in the tree. A copied anchor keeps the source sandbox's magnitude, so the seed recompiles it and every editing verb recompiles it after writing. A node the magnitude contains but the log does not define is drawn as (undefined); check_denotation reports the mismatch.

References

A node that refers to a document names a slot, and the document is reachable at that slot. A source pin names a document in another instance (<msn>.<name>) and its version hash; the sources resolver reports fresh, stale, missing or unverifiable (micyte/core/sources.py). A stale pin is a fault; missing and unverifiable are reported, not gated.

The convention is a document

The base structure is also stated by the archetype library's own lcl_domain tree, and the seed reads it from there. micyte/core/datum_ops/local_domain_convention.py reads a tree into a Convention: branch labels, structural glyphs, canonical glyph titles, artifact and class kinds, and the class vocabularies it seeds (project_roles, project_facts; 44). The code's constants are the fallback for a store with no library; a test requires disagreements(stated, expected) to be empty.

The convention surface opens the library's tree in the Domain editor (set_node_icon, rename_node, move_node, insert_node) with a viewscope beside it.

Every tree pins the library's lcl_domain in its sources branch. The host's health report carries convention: fresh, stale(n) or library_disagrees(n). apply_convention adds the kinds and vocabulary a tree lacks, names a tree that does not name itself (meta-5, titled from the sandbox's name, and meta-6 when its channel profile declares a channel), re-applies the structural glyphs, and moves the pin, in one write; it removes and renames nothing. A tree without its own node reads stale.

Trees in the older shape

read_log reads only the base structure. A tree without a local_domain root has no log to it, and every verb refuses it by name. The older shape (a root labelled documents with icons and documents beneath) is read only by migrate_local_domain_base._read_legacy_log, which converts it.