Skip to main content

Module subject

Module subject 

Source
Expand description

Evidence subjects: every declaration a verdict can be asked about, what it is made of, and the tests it reaches.

A subject is a declaration a person or a page asks “is this proven?” about: a claim of docs/CLAIMS.yaml, a rule of the layer, a feature, a public command, a builtin capability of the executable, an MCP tool (an alias of its capability) or a use case. Its key is <kind>:<id> — claim:scope-integrity, command:commit plan, mcp:majordomus_get.

§Derived only

Nothing lists a subject, a member or a route by hand. index reads the declarations that already exist and nothing else:

  • the claims, through the evidence join (crate::evidence::report) with an empty ledger, so a claim’s test identity is the one grammar TestId::of owns;
  • the rules, through crate::rules::definitions;
  • the features, through the product model;
  • the use cases and the public shell commands, from the index;
  • the documented command-line examples (crate::cli::EXAMPLES);
  • the builtin capabilities of the registry, with the file each was composed in;
  • the first # majordomus-covers: and the first # majordomus-negative: line of every case under test/cases/, and the integration test binaries of the crate.

Adding a declaration adds its subject, and removing it removes it. The committed index, PATH, carries structure only — no ledger row, no commit — so recording a run never makes it stale, and majordomus generate --check refuses a copy that differs from this derivation.

§The shell derivations it replaces or holds equal

Before this index, six shell programs derived “which tests prove this subject”:

  • the command pages (scripts/generate-site-data, commands.json) read the first covers and negative header of every case — the index reads the same first line, and case 507 holds the two equal;
  • the command-coverage doctrine (lib/commands.sh) reads the same first line;
  • the command-furnished gate and the use-case impact trace match a command as a whole word of any header line, so they would read a second header of a kind where the index reads only the first; a prefixed word such as capability:commit.plan is a command for none of them — case 507 holds every case to one header of each kind, and every header to naming the same public commands under both readings, so they cannot yet disagree;
  • the capability pages (scripts/lib/executable-site.jq) give every capability the claims implemented in its module’s file — the index gives capability:<id> the same claim members, and case 507 holds the two equal;
  • the doctrine pages (doctrines.json) name the first test of each rule — case 507 holds every one of them to a route or a mechanism of rule:<id>.

The command words are the command graph’s (crate::command_graph) as well: the public commands of the shell tool and the runnable commands of the executable, which the documented examples name one for one. Case 507 holds the command subjects, and the programs each names, equal to majordomus commands graph.

§Example

use majordomus_cli::evidence::subject::{self, SubjectKind};
use majordomus_cli::synthetic::SyntheticRepository;

let repo = SyntheticRepository::small().unwrap();
let ctx = repo.context().unwrap();
let s = subject::index(&ctx.index, &ctx.product, &ctx.registry);

// an MCP tool is an alias of the capability that declares it, never a subject of its own
let tool = s.get("mcp:majordomus_capabilities").unwrap();
let capability = tool.alias_of.as_deref().unwrap();
assert_eq!(SubjectKind::parse(capability).unwrap().0, SubjectKind::Capability);
assert_eq!(tool.members, vec![capability.to_string()]);
assert!(tool.page.is_none(), "an alias has no page of its own");

Structs§

Judge
Judges many subjects at one presented revision with one set of comparisons.
MemberProof
One member of a subject, with the member’s own verdict.
Page
One page the site renders for a subject.
Route
One way a subject reaches a test, or the path it names when no runner drives it.
RouteProof
One route of a subject, judged at the presented revision.
SubjectEntry
One subject of the index: what it is, what it is made of and the tests it reaches.
SubjectEvidence
What the repository can say about one subject at the presented revision: its verdict, the parts it was made from and the totals beside it.
SubjectFinding
A structural finding about a subject: something its declarations say, not something a run said. Advisory until the gate slice holds it.
SubjectIndex
Every subject of a repository, and every test nothing reaches.
UnknownSubject
A key that names no subject of this repository.

Enums§

Category
What kind of test a route reaches, read off the test’s identity and never declared.
Program
Which program answers to a command word: the shell tool, or the Rust executable. A word both answer to names both, in this order.
SubjectKind
What kind of declaration a subject is. The declaration order is the order the committed index lists its kinds in.
Via
How a subject reaches a test. The declaration order is the order routes are listed in, which puts the behavioural routes before the scenario.

Constants§

COMMAND_IN_TWO_PROGRAMS
A command word both the shell tool and the executable answer to: structural, advisory.
DANGLING_MEMBER
A rule a subject is made of names a path that is not in the tree.
DOCUMENT
The manifest’s document id of the committed index.
FEATURE_WITHOUT_EVIDENCE
A feature that reaches no test a runner drives: structural, advisory until the gate.
FRESHNESS_UNKNOWN
Git could not compare an evidence commit with the presented revision.
PATH
Where the committed index lives: the Rust executable’s site directory, never the shell site generator’s, which that generator replaces wholesale.
ROUTE
The site route every subject page lives under.
SCHEMA
The schema the committed index declares, validated against its published contract.
SOURCE
What the committed index is derived from, as its banner says.

Functions§

answer
One subject, judged at the presented revision from the two reports of the given ledger.
artifact
The committed index, as majordomus generate site writes it to PATH.
index
Every subject of a repository, derived from what it declares.
verdict
A subject’s verdict over its parts: the one aggregation (crate::evidence::freshness::aggregate) over the declared order, and whether any part can carry proof. A failing part makes the subject failing; otherwise the weakest part that can carry proof decides; otherwise the weakest of all; and no part reads no_test.

Type Aliases§

Adjust
A route judgement as a surface that reads records beyond the tracked ledger may weaken it: called with the test, the execution the judge holds for it and the judge’s judgement, before any aggregation. The identity leaves every judgement as the tracked ledger made it.