Bounded Contexts
The server and client bounded contexts of Alexandria: their domain, use cases and ports.
Bounded Contexts
Each side is a self-contained module with the same internal shape: domain/, app/, adapters/ and a module.go that wires them. The standalone binaries and the in-process tests build the module the same way.
Server (internal/server)
Domain
Namespace, Steward, Principal, Vocabulary and Revision, Draft, Candidate, Event, and the authorization decision of §3.5 as a pure function of the operation, the principal and steward membership.
Use cases (app)
| Use case | Responsibility |
|---|---|
Namespaces | Create and read namespaces; assign, list and remove stewards. |
Vocabularies / vocabulary reader | Register vocabularies, store content, refresh proxies; a separate read path with no upstream fetcher. |
Authoring | Drafts: create, replace under If-Match, validate, propose. |
Release | Approve or reject a candidate; plan dates, check invariants, publish and sign. |
Revocation | Revoke a version under REV-1–REV-4 and issue a listing. |
Listing | Issue and serve the signed listing and records. |
Publication | Resolve /pub routes. |
Query | Events and candidates. |
Ports
| Port | Purpose |
|---|---|
NamespaceRepo, StewardRepo, VocabRepo, DraftRepo, CandidateRepo, ReleaseStore, ListingStore, EventLog | Persistence, combined in Store. |
BlobStore | Content-addressed bytes. |
KeySigner | Signs with the hub key. |
DIDResolver | Resolves the hub's own DID document. |
UpstreamFetcher | Downloads a proxy vocabulary. |
ProfileCompiler | Validates a draft and compiles its package. |
Client (internal/client)
Domain
Rules and rule selection, the state machine, classification, the action tables, the admission table, the snapshot of in-force versions, retention, and the VHub-Verdict header. All are pure functions: Decide receives everything a decision depends on.
Use cases (app)
| Use case | Responsibility |
|---|---|
Sync | The S1–S13 pipeline and the atomic acceptance of a listing. |
HubTrust | The cached hub DID document and proof verification V0–V4. |
Edge | The hot path: decide, forward or reject, capture agreements, feed the audit, emit events. |
Explainer | The same decision without effects. |
Rules | Rule-set CRUD with optimistic concurrency. |
Agreements | The agreement registry and revocation notices. |
Audit | The passive audit buffer and report. |
Status | Status documents, the clock-skew estimate and state-change events. |
GC | Package collection. |
Ports
| Port | Purpose |
|---|---|
HubAPI | Listing, manifests and package files. |
DIDResolver | Hub DID document. |
Evaluator | Evaluates a message against the artefacts of one package. |
ContinuityStore, PackageStore, RuleStore, AgreementRepo / AgreementReader | Persistent state. |
EventSink, Metrics | Observability. |
Upstream | The connector behind the proxy. |
The published snapshot is immutable and swapped atomically, so a request always sees one consistent listing, one set of packages and one rule-set revision.
Profile Language (internal/dsl)
The alexandria.profiles/v1 compiler is independent of both contexts. alexandriac uses it directly, and the server reaches it through the compiler_dsl adapter when compiler: dsl is configured.