Resolution: an optional consumer of an unanswered requirement is left absent and listed (A-452, ADR 0330 §3, §7)
Builds: design 47 G A-452
This commit is contained in:
@@ -605,15 +605,16 @@ func resolve(catalogue map[string]mcat.Manifest, assigned []string, node mcat.No
|
||||
resolution := mcat.Resolution{Node: node.Name, At: node.At, PublicDomain: node.PublicDomain,
|
||||
Account: node.Account, AccountHome: node.AccountHome, AgentAccount: node.AgentAccount,
|
||||
AgentAccountHome: node.AgentAccountHome, Capabilities: node.Capabilities,
|
||||
Because: because, Needs: needs, Unhostable: unhostable, Kept: kept,
|
||||
Absent: absentOf(absent, order, catalogue)}
|
||||
Because: because, Needs: needs, Unhostable: unhostable, Kept: kept}
|
||||
for _, n := range providersFirst(order, catalogue) {
|
||||
resolution.Modules = append(resolution.Modules, catalogue[n])
|
||||
}
|
||||
|
||||
problems = append(problems, checkCapabilities(resolution.Modules, node)...)
|
||||
claims, held := holdClaims(resolution.Modules, node, elsewhere, world.Holdings)
|
||||
held, unheld := holdUnanswered(resolution.Modules, unansweredOrder, unanswered, because, held)
|
||||
held, unheld := holdUnanswered(resolution.Modules, unansweredOrder, unanswered, because, held, absent)
|
||||
// Listed after the holding: an optional consumer of a requirement nothing answers is left absent there (ADR 0330 §3, §7).
|
||||
resolution.Absent = absentOf(absent, order, catalogue)
|
||||
problems = append(problems, unheld...)
|
||||
problems = append(problems, checkResources(resolution.Modules)...)
|
||||
resolution.Claims = claims
|
||||
@@ -708,7 +709,7 @@ func unansweredWords(want, consumer, remedy string) string {
|
||||
// provision (A-452): it stays in the set, so what it provides still counts for the others. A requirement none of the set's modules
|
||||
// wants (an assigned name the catalogue does not know) has no consumer to hold and comes back as a problem of the node; so does a
|
||||
// set whose every module is held, since then nothing could be composed.
|
||||
func holdUnanswered(modules []mcat.Manifest, unanswered []string, remedies map[string]string, because map[string]string, held map[string]string) (map[string]string, []string) {
|
||||
func holdUnanswered(modules []mcat.Manifest, unanswered []string, remedies map[string]string, because map[string]string, held map[string]string, absent map[string]bool) (map[string]string, []string) {
|
||||
var problems []string
|
||||
for _, want := range unanswered {
|
||||
found := false
|
||||
@@ -725,7 +726,8 @@ func holdUnanswered(modules []mcat.Manifest, unanswered []string, remedies map[s
|
||||
}
|
||||
found = true
|
||||
if m.IsOptional(want) {
|
||||
// Optional for this module: not held (ADR 0330 §3).
|
||||
// Optional for this module: not held, left absent and listed (ADR 0330 §3, §7).
|
||||
absent[want] = true
|
||||
continue
|
||||
}
|
||||
if held == nil {
|
||||
|
||||
Reference in New Issue
Block a user