D5 (sdk, indexer): the answer store is the steps state's own steps-objects; a state template takes objects-max-mib
Builds: design 47 G A-313, A-314 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -52,6 +52,8 @@ var busTemplates = map[string]busTemplate{
|
||||
catalogue.OptionPerMachine: {kind: optionFlag},
|
||||
// A-277: a state's cap is an option of its template, read as the old state section reads it.
|
||||
catalogue.OptionCapMiB: {kind: optionInt, least: catalogue.ObjectsLeastMiB, most: catalogue.ObjectsMostMiB},
|
||||
// A-314: the cap of the state's own objects store `<state>-objects`, an integer above zero.
|
||||
catalogue.OptionObjectsCapMiB: {kind: optionInt, least: catalogue.ObjectsLeastMiB, most: catalogue.ObjectsMostMiB},
|
||||
},
|
||||
},
|
||||
catalogue.TemplateEvents: {
|
||||
|
||||
@@ -27,6 +27,8 @@ func TestTheJudgeReadsMilestoneGsWords(t *testing.T) {
|
||||
{name: "an old state section entry with max-mib in its bounds (§469, §695)", raw: `{"module":"a","version":"1.0","state":[{"name":"s","max-mib":128}]}`},
|
||||
{name: "an old state section entry with max-mib at zero (§469)", raw: `{"module":"a","version":"1.0","state":[{"name":"s","max-mib":0}]}`, want: "max-mib"},
|
||||
{name: "an old state section entry with max-mib past the bound (§469)", raw: `{"module":"a","version":"1.0","state":[{"name":"s","max-mib":9000}]}`, want: "max-mib"},
|
||||
{name: "a state's objects store cap in its template's options (A-314)", raw: `{"module":"a","version":"1.0","requires":[{"name":"steps","storage":"key-value","template":"state","options":{"objects-max-mib":256}}]}`},
|
||||
{name: "a state's objects store cap of zero (A-314)", raw: `{"module":"a","version":"1.0","requires":[{"name":"steps","storage":"key-value","template":"state","options":{"objects-max-mib":0}}]}`, want: "objects-max-mib"},
|
||||
{name: "another part's old findings and stream (§529, §577)", raw: `{"module":"a","version":"1.0","state":["findings"],` +
|
||||
`"streams":[{"name":"a-findings","events":["finding-written"],"retention":"history"}],"consumes":["mesh-conditions.findings-asked"]}`, want: "old sections"},
|
||||
{name: "another part's findings in its requires (§529)", raw: `{"module":"a","version":"1.0","consumes":["mesh-conditions.findings-asked"],"requires":[` +
|
||||
|
||||
@@ -4,11 +4,13 @@ import (
|
||||
"fmt"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/buscalls"
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
)
|
||||
|
||||
// OutputsStore is the local name of the object store a build seat's holder keeps a run's answer in when it is over what
|
||||
// step-ended carries inline (design 47 G A-254), as the holder's manifest `requires` asks for it with the template objects.
|
||||
const OutputsStore = "outputs"
|
||||
// step-ended carries inline (design 47 G A-254): the steps state's own objects store, `steps-objects`, which the holder's manifest
|
||||
// `requires` asks for with its steps state (design 47 G A-313).
|
||||
var OutputsStore = catalogue.StateObjectsName("steps")
|
||||
|
||||
// OutputObjects is the object store of OutputsStore as a holder uses it (mesh-sdk busstate.ObjectsOf(OutputsStore)).
|
||||
type OutputObjects interface {
|
||||
|
||||
@@ -2,6 +2,7 @@ package steprun
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/buscalls"
|
||||
@@ -33,8 +34,8 @@ func TestOutputsKeptAreRead(t *testing.T) {
|
||||
if _, err := ReadOutputFrom(st)("output.none"); err == nil {
|
||||
t.Fatal("an absent answer was read")
|
||||
}
|
||||
if KeepOutputIn(nil)("o", nil) == nil {
|
||||
t.Fatal("no store kept an answer")
|
||||
if err := KeepOutputIn(nil)("o", nil); err == nil || !strings.Contains(err.Error(), "steps-objects") {
|
||||
t.Fatalf("no store kept an answer, or did not name the steps state's objects store: %v", err)
|
||||
}
|
||||
if _, err := ReadOutputFrom(nil)("o"); err == nil {
|
||||
t.Fatal("no store read an answer")
|
||||
|
||||
Reference in New Issue
Block a user