The checker read any touched contracts module's definitions, skipped the check that a definition names its own directory's seat, and copied the indexer's tree reading. sdk/seatdefs now holds the reading and the rule of which contracts module may define a seat; the indexer's keeping, its revision seats and the checker's head seats all use it. Two heads defining one seat fail the judging unless one hands it over to its domain's module. Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
32 lines
1.2 KiB
Go
32 lines
1.2 KiB
Go
package index
|
|
|
|
// Where a seat of the mesh's own contracts may be defined (novox/hq ADR 0636 §5, ADR 0634 §7): the rule is the domain
|
|
// SDK's (mesh-delivery sdk/seatdefs), shared with the checker; here only how the indexer's kept entries meet it. A second
|
|
// definer is refused with a finding naming both, unless it is a handover to the seat's domain's module.
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"git.novox.be/novox/mesh-delivery/sdk/seatdefs"
|
|
"git.novox.be/novox/mesh-sdk/go/seatdef"
|
|
)
|
|
|
|
// domainOf is the domain a kept definition names ("" when it is none or does not decode).
|
|
func domainOf(raw json.RawMessage) string {
|
|
var d struct {
|
|
Domain string `json:"domain"`
|
|
}
|
|
_ = json.Unmarshal(raw, &d)
|
|
return d.Domain
|
|
}
|
|
|
|
// handsOver says a kept trunk entry is handed over to a definer (seatdefs.HandsOver).
|
|
func handsOver(cur SeatDefinitionEntry, module string, d seatdef.Definition) bool {
|
|
return seatdefs.HandsOver(cur.Module, module, d)
|
|
}
|
|
|
|
// handoverPending says a trunk entry its holder no longer defines waits for its domain's module (seatdefs.HandoverPending).
|
|
func handoverPending(cur SeatDefinitionEntry) bool {
|
|
return seatdefs.HandoverPending(cur.Module, domainOf(cur.Definition))
|
|
}
|