The graphical session's seats, a display's machine reach, and the session's slots (hq ADR 0208)
Seed the eleven node seats with the verbs they start with. A provision may have the machine's reach: a requirement for it resolves only to a provider in the node's own set, is never pulled in, and is refused naming who could. A shell contribution's for gains xinitrc and xresources, placed only by the holder of node-display-server.
This commit is contained in:
@@ -147,8 +147,17 @@ type Offer struct {
|
||||
// shared by every consumer (novox/hq ADR 0158): software that holds one password or one key
|
||||
// cannot give each consumer a login of its own. The named secret must say how it is taken.
|
||||
Credential *OfferCredential `json:"credential,omitempty"`
|
||||
// Reach is ReachMachine for a provision usable only on the provider's own machine — a display
|
||||
// (novox/hq ADR 0208 §3). Node scope already keeps a provision off other machines; what this adds
|
||||
// is that a requirement for it is never answered by installing a provider: the display server is
|
||||
// a seat's holder gated by the machine's graphical session, and pulling one in for whatever asked
|
||||
// is the misassignment research 026 found. Unmet, the requirement is refused naming who could.
|
||||
Reach string `json:"reach,omitempty"`
|
||||
}
|
||||
|
||||
// MachineReach is whether a provision is usable only on its provider's own machine.
|
||||
func (o Offer) MachineReach() bool { return o.Reach == ReachMachine }
|
||||
|
||||
// OfferCredential names which of the provider's own secrets a provision's consumers receive.
|
||||
type OfferCredential struct {
|
||||
Own string `json:"own"`
|
||||
@@ -196,27 +205,29 @@ func (o *Offer) UnmarshalJSON(raw []byte) error {
|
||||
Name string `json:"name"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Credential *OfferCredential `json:"credential,omitempty"`
|
||||
Reach string `json:"reach,omitempty"`
|
||||
}
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&full); err != nil {
|
||||
return fmt.Errorf("a provided name is either a string or {name, scope, credential}: %w", err)
|
||||
return fmt.Errorf("a provided name is either a string or {name, scope, credential, reach}: %w", err)
|
||||
}
|
||||
o.Name, o.Scope, o.Credential = full.Name, full.Scope, full.Credential
|
||||
o.Name, o.Scope, o.Credential, o.Reach = full.Name, full.Scope, full.Credential, full.Reach
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON writes back the short form when there is nothing else to say, so a manifest that
|
||||
// went through the mesh comes out looking like the one that went in.
|
||||
func (o Offer) MarshalJSON() ([]byte, error) {
|
||||
if o.Scope == "" && o.Credential == nil {
|
||||
if o.Scope == "" && o.Credential == nil && o.Reach == "" {
|
||||
return json.Marshal(o.Name)
|
||||
}
|
||||
return json.Marshal(struct {
|
||||
Name string `json:"name"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
Credential *OfferCredential `json:"credential,omitempty"`
|
||||
}{o.Name, o.Scope, o.Credential})
|
||||
Reach string `json:"reach,omitempty"`
|
||||
}{o.Name, o.Scope, o.Credential, o.Reach})
|
||||
}
|
||||
|
||||
// Manifest is everything a module says about itself.
|
||||
@@ -1317,6 +1328,19 @@ func ParseManifest(raw []byte) (Manifest, error) {
|
||||
"%s provides %q at scope %q; a provision is %q or %q",
|
||||
m.Module, p, s, ScopeNode, ScopeMesh))
|
||||
}
|
||||
switch {
|
||||
case offer.Reach == "":
|
||||
case offer.Reach != ReachMachine:
|
||||
// The one reach a provision has (novox/hq ADR 0208): a provision reached over the private
|
||||
// network is mesh scope, and the world reaches nothing but a name.
|
||||
problems = append(problems, fmt.Sprintf(
|
||||
"%s provides %q with reach %q; a provision's reach is %q or nothing",
|
||||
m.Module, p, offer.Reach, ReachMachine))
|
||||
case offer.At() != ScopeNode:
|
||||
problems = append(problems, fmt.Sprintf(
|
||||
"%s provides %q at scope %q with the machine's reach; a provision usable only on its own "+
|
||||
"machine is node-scoped (novox/hq ADR 0208)", m.Module, p, offer.At()))
|
||||
}
|
||||
if p == m.Module {
|
||||
// Harmless and worth saying: a module always provides its own name, so writing it
|
||||
// suggests the author expected it not to.
|
||||
|
||||
Reference in New Issue
Block a user