Files
mesh-delivery/modules/mesh-delivery-view/internal/view/names.go
T
jschoubben 64ae24aef7 mesh-delivery: remove the indexer's state config-candidates and its readers (issue 1982; ADR 0681 §2)
The mesh knows no pull request (design 47 G, G-1 §38-39), so the indexer keeps no pull request's config declarations.
Removed: the code that writes the state (control_records.go: the candidate writes after a merge and for a pull
message), its bucket, view family (views.config-candidates) and read tool (indexer_read_config_candidates) in the
indexer's module.json, the view's tool indexer_config_candidates and its read of the indexer's tool, the state and its
fixtures in the seat mesh-catalog's definition (generated Go and TypeScript regenerated by seatgen). indexer_config_readers
no longer names an open pull request as a reader of a key. The state `predefined` stays.

Builds: ADR 0681 §2 (the indexer keeps no config candidate: state, read tool and view, the seat contract's layout; `predefined` stays), §1 (indexer_config_readers names no pull request).

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 22:47:44 +01:00

97 lines
4.3 KiB
Go

package view
import (
"fmt"
mma "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/trunk"
"git.novox.be/novox/mesh-sdk/go/keys"
)
// The holders, states and buckets the view names, taken from its own manifest (module.json: its `reads`, `invokes` and
// `consumes`); a unit row checks them against it (TestTheNamesAreTheManifests). No contract names a holder (novox/hq
// ADR 0625 §4, ADR 0634 §1). The indexer's module and its reads are the catalog client's.
const (
IndexerModule = "mesh-delivery-indexer"
// ProvisionsRead is the seat mesh-provisioner's state provisions as the manifest's `reads` names it (the seat form, resolved at
// the seat's holder, A-318).
ProvisionsSeat = "mesh-provisioner"
ProvisionsState = "provisions"
ProvisionsRead = "seat:" + ProvisionsSeat + "." + ProvisionsState
WatchmanModule = "mesh-delivery-watchman"
GateModule = "mesh-delivery-gate"
TellerModule = "mesh-delivery-teller"
EngineModule = "node-engine"
// The indexer's states the view reads.
CandidatesBucket = IndexerModule + "_candidates"
TakenBucket = IndexerModule + "_taken"
PackagesState = "packages"
PackagesBucket = IndexerModule + "_" + PackagesState
// IndexerPredefinedState is the indexer's state of the foundation's predefined list; PredefinedListKey its one key.
IndexerPredefinedState = "predefined"
PredefinedListKey = "list"
// The seats mesh-module-assigner's and mesh-wants' views the process follows, its pictures named in the seat form
// `<seat>_<state>` (design 47 G §717, A-303): no module is named. Where a name must be the holder's real bucket (the
// watchman's stuck key) the process reads it from the holder it follows (views.ProcessReader.HolderBucket).
AssignmentsState = "assignments"
AssignmentsBucket = mma.Seat + "_" + AssignmentsState
WantsBucket = meshwants.Seat + "_" + meshwants.StateWants
AsksBucket = meshwants.Seat + "_" + meshwants.StateAsks
// SourceBucket names, in the model's entries, each watched branch's source as the seat mesh-delivery's verb source answers
// it, keyed by the escaped branch (design 47 G §507, A-173): never a bucket the view reads. The teller's state answers as
// the view follows it by its views family (design 47 G §431, A-175): its picture `<owner>_<state>`.
SourceBucket = GateModule + "_source"
AnswersState = "answers"
AnswersBucket = TellerModule + "_" + AnswersState
// The watchman's and the node-engine's states.
PresenceBucket = WatchmanModule + "_presence"
StuckBucket = WatchmanModule + "_stuck"
HaveBucket = EngineModule + "_have"
// StepsState is the state of steps each build module keeps (reads: mesh-build-<language>.steps), whose pauses are buildstep's.
StepsState = "steps"
// The revisions each of those states keeps per key.
AnswersHistory = 5
AssignerAsksHistory = 5
// SignersRead is the seat mesh-vault's state of signing keys as a manifest's `reads` names it (the seat form, resolved at the seat's
// holder, A-210), SignersKeyKey its one key.
VaultSeat = "mesh-vault"
SignersState = "signers"
SignersRead = "seat:" + VaultSeat + "." + SignersState
SignersKeyKey = "key"
)
// CandidatesKey is the key, in the indexer's candidates, of a group: the group name as a key part. ParseCandidatesKey is its inverse.
func CandidatesKey(group string) (string, error) {
if group == "" {
return "", fmt.Errorf("view: the group name is empty")
}
return keys.EscapeName(group), nil
}
// ParseCandidatesKey is the inverse of CandidatesKey.
func ParseCandidatesKey(key string) (string, error) {
group, err := keys.UnescapeName(key)
if err != nil || group == "" {
return "", fmt.Errorf("view: %q is not a candidates key: %v", key, err)
}
return group, nil
}
// PackagesKey is the key, in the indexer's packages, of a mesh Go module (its module path): the path as a key part. It refuses
// a path that is no mesh Go module's.
func PackagesKey(module string) (string, error) {
if _, _, ok := trunk.PackageRepository(module); !ok {
return "", fmt.Errorf("view: %q is no mesh Go module's path", module)
}
return meshcatalog.PackagesByModuleKey(keys.EscapeName(module)), nil
}