Expand description
Entities: the one projection that makes every object of the layer addressable.
An crate::model::Object already has a kind, an identity and a majordomus:// URI,
and every surface of this executable already reads it. What it did not have was an
address a reader can be given: the Cockpit showed one object at
/cockpit/object?uri=majordomus%3A%2F%2Frule%2Fproject.x%401, no page of the public
site showed a decision or a project rule at all, and nothing answered the two questions
a governance object is read for — what does it point at, and what points at it.
This module is that projection and nothing else. It holds no list of kinds, no list of entities and no list of routes:
index (objects) ─┬─> slug ──> route one deterministic function, per object
graph::RELATIONS ─┘ relations the same table the graph and the
backlinks dangling-reference check already read
capability registry ─> surfaces the exposures the registry already holdsAdding an object to the layer therefore adds its route, its page, its relations and its
backlinks, with no edit here and none in any consumer. That is the invariant
project.entities-are-routable states and scripts/ci/entity-check refuses to let
drift.
§The slug
An identity is not a path segment: project.a-rule@1 carries an @, and a document’s
identity is a repository-relative path with slashes in it. slug is the deterministic
reduction to one segment — lowercase, every run of anything else a single -, trimmed:
use majordomus_cli::entity::slug;
assert_eq!(slug("adr-0004"), "adr-0004");
assert_eq!(slug("project.a-diagram-is-drawn-not-typed@1"),
"project-a-diagram-is-drawn-not-typed-1");
assert_eq!(slug(".ai/repo/README.md"), "ai-repo-readme-md");
assert_eq!(slug("Continue"), "continue");Two identities of one kind can in principle reduce to one slug. That is a collision, not
a tie-break: collisions finds every one of them and the gate refuses the tree while
any exists, because a route that answers with one of two objects is worse than no route.
Structs§
- Collision
- Two objects of one kind whose identities reduce to the same route.
- Documentation
- The public documentation page of one entity, as its kind’s publication decision derives it. Every surface that shows an entity carries this value and renders it; none of them derives a public address of its own.
- Edge
- One edge, as an entity page reads it.
- Publication
- A repository’s publication declaration, with the base URL its site is built for.
- Published
Kind - How one kind reaches the public site, as the declaration states it.
- Surface
- One place this entity can be reached, and how.
Enums§
- Direction
- Which way a relation runs from the entity being read.
Constants§
- COCKPIT_
PREFIX - Where every entity route of the Cockpit starts. A kind index is this plus the kind; an entity is that plus its slug. Nothing else is under it, which is what makes the two route shapes unambiguous without a list of kinds to check against.
- PUBLICATION
- Where a repository declares, for every kind of its index, whether and where its public site publishes that kind. Repository-relative.
Functions§
- collisions
- Every route collision in an index. Empty is the healthy answer, and the only one the gate accepts: a route that resolves to one of two objects is not a route.
- edges
- Every edge of one object: the references it declares, and the references that resolve to it.
- find
- Find the object of a kind whose identity has this slug.
- kind_
route - The Cockpit route of one kind’s index.
- object_
route - The route of an object, from the object itself.
- route
- The Cockpit route of one entity, from its kind and identity.
- slug
- The deterministic, URL-safe reduction of an identity to one path segment.
- surfaces
- Every surface that answers for one object, derived from the registry’s exposures rather than listed here.