Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4919a4e076 | ||
|
|
69056948bf | ||
|
|
9cdac09ad9 | ||
|
|
86d37a14e7 | ||
|
|
d13f74df40 | ||
|
|
dfe490d9e2 | ||
|
|
4f317201c9 | ||
|
|
25f6154564 | ||
|
|
b8ba9dd966 | ||
|
|
002a0e1a12 | ||
|
|
9bb85a37f2 | ||
|
|
774fcdfa93 | ||
|
|
470687ea4c |
@@ -41,3 +41,4 @@ checks/placement/placement
|
||||
# Built by their modules' build step (issue 1577), never committed.
|
||||
modules/forticlient/cmd/forticlient-tools/forticlient-tools
|
||||
modules/networkmanager/uplink-tools
|
||||
checks/words/words
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Package nobinaries refuses a compiled program under modules/ (issue 1577): it is build output, made by the module's build step,
|
||||
// Package nobinaries refuses a compiled program anywhere in the repository (issue 1577; first a checks/ binary slipped past a modules/-only rule): it is build output, made by the module's build step,
|
||||
// and `go build` in a module's folder writes one beside go.mod where `git add -A` takes it.
|
||||
package nobinaries
|
||||
|
||||
@@ -27,10 +27,10 @@ func Kind(head []byte) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Files are the files of the catalogue's root that the change holds under modules/: the tracked ones when the root is a git
|
||||
// checkout (an ignored binary a local build left is not the change's), else every file there.
|
||||
// Files are the files of the catalogue's root that the change holds, anywhere: the tracked ones when the root is a git
|
||||
// checkout (an ignored binary a local build left is not the change's), else every file there but .git's.
|
||||
func Files(root string) ([]string, error) {
|
||||
cmd := exec.Command("git", "-C", root, "ls-files", "-z", "--", "modules")
|
||||
cmd := exec.Command("git", "-C", root, "ls-files", "-z")
|
||||
if out, err := cmd.Output(); err == nil && len(out) > 0 {
|
||||
var files []string
|
||||
for _, f := range strings.Split(strings.TrimRight(string(out), "\x00"), "\x00") {
|
||||
@@ -41,10 +41,16 @@ func Files(root string) ([]string, error) {
|
||||
return files, nil
|
||||
}
|
||||
var files []string
|
||||
err := filepath.WalkDir(filepath.Join(root, "modules"), func(p string, d os.DirEntry, err error) error {
|
||||
if err != nil || d.IsDir() || !d.Type().IsRegular() {
|
||||
err := filepath.WalkDir(root, func(p string, d os.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if d.IsDir() && d.Name() == ".git" {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
if d.IsDir() || !d.Type().IsRegular() {
|
||||
return nil
|
||||
}
|
||||
rel, _ := filepath.Rel(root, p)
|
||||
files = append(files, rel)
|
||||
return nil
|
||||
|
||||
@@ -2,6 +2,7 @@ package nobinaries
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
@@ -16,6 +17,7 @@ func TestFindNamesEachCompiledProgramAndNothingElse(t *testing.T) {
|
||||
"modules/e/short": []byte("\x7f"),
|
||||
"modules/f/empty": {},
|
||||
"modules/g/Foo.class": {0xca, 0xfe, 0xba, 0xbe, 0, 0, 0, 52}, // Java, not Mach-O
|
||||
"checks/words/words": []byte("\x7fELF\x02\x01\x01\x00rest"), // outside modules/ too
|
||||
}
|
||||
var names []string
|
||||
for f, b := range files {
|
||||
@@ -32,8 +34,8 @@ func TestFindNamesEachCompiledProgramAndNothingElse(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(got) != 3 {
|
||||
t.Fatalf("found %v; wanted modules/a/a, modules/b/cmd/b/b.exe and modules/c/c only", got)
|
||||
if len(got) != 4 {
|
||||
t.Fatalf("found %v; wanted modules/a/a, modules/b/cmd/b/b.exe and modules/c/c and checks/words/words only", got)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,3 +54,36 @@ func TestTheCatalogueHoldsNoCompiledProgram(t *testing.T) {
|
||||
t.Errorf("%s: a compiled program is build output: remove it and add it to .gitignore (issue 1577)", f)
|
||||
}
|
||||
}
|
||||
|
||||
// A compiled program outside modules/ is refused too (a binary under checks/ slipped past the modules/-only rule): Files holds
|
||||
// every tracked file of a git checkout and every file of a plain folder, and Find names the binary in both.
|
||||
func TestAProgramUnderChecksIsRefused(t *testing.T) {
|
||||
for _, git := range []bool{true, false} {
|
||||
root := t.TempDir()
|
||||
p := filepath.Join(root, "checks", "words", "words")
|
||||
if err := os.MkdirAll(filepath.Dir(p), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(p, []byte("\x7fELF\x02\x01\x01\x00rest"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if git {
|
||||
for _, args := range [][]string{{"init", "-q"}, {"add", "-A"}} {
|
||||
if out, err := exec.Command("git", append([]string{"-C", root}, args...)...).CombinedOutput(); err != nil {
|
||||
t.Fatalf("git %v: %v: %s", args, err, out)
|
||||
}
|
||||
}
|
||||
}
|
||||
files, err := Files(root)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
found, err := Find(root, files)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(found) != 1 {
|
||||
t.Errorf("git=%v: found %v; wanted checks/words/words (ELF)", git, found)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1 @@
|
||||
# What these tests read outside their package, as paths from the repository's root (a glob, or a directory read whole;
|
||||
# ? before a path whose absence is read). mesh-build-go hashes them into the package's digest, so its verdict is kept
|
||||
# until one of them changes (issue 1936). An empty list, or a line matching nothing, keeps nothing.
|
||||
# every file under modules/ (git ls-files and a walk).
|
||||
modules
|
||||
# every tracked file of the repository (git ls-files, no path limit): the whole tree, so this package's verdict is never kept.
|
||||
|
||||
@@ -206,6 +206,9 @@ func excerpt(s string, from, to int) string {
|
||||
return strings.Join(strings.Fields(s[a:b]), " ")
|
||||
}
|
||||
|
||||
// modulePath matches a string that is only a module or import path ("git.example.org/org/repo/go/pkg").
|
||||
var modulePath = regexp.MustCompile(`^[a-z0-9.-]+\.[a-z]+/[A-Za-z0-9_./-]+$`)
|
||||
|
||||
// goStrings returns a Go file's string literals, adjacent ones joined across `+` as the program joins them.
|
||||
func goStrings(path, rel string) ([]text, error) {
|
||||
src, err := os.ReadFile(path)
|
||||
@@ -231,6 +234,11 @@ func goStrings(path, rel string) ([]text, error) {
|
||||
if err != nil {
|
||||
v = lit
|
||||
}
|
||||
if modulePath.MatchString(v) {
|
||||
// An import path or another module path names code, not words an agent reads.
|
||||
cur, joining = nil, false
|
||||
continue
|
||||
}
|
||||
if cur != nil && joining {
|
||||
cur.s += v
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
// manifest's.
|
||||
const NamesFileEnv = "MESH_ARTIFACT_STORE_NAMES_FILE"
|
||||
|
||||
// CatalogueModules and CatalogueModule are the catalogue's tools these definitions are read through.
|
||||
// CatalogueModules and CatalogueModule are the catalog's tools these definitions are read through.
|
||||
const (
|
||||
CatalogueModules = "mesh-catalog.catalog_modules"
|
||||
CatalogueModule = "mesh-catalog.catalog_module"
|
||||
@@ -143,21 +143,21 @@ func PinsIn(manifest json.RawMessage, names StoreNames) []pinned {
|
||||
return out
|
||||
}
|
||||
|
||||
// Definitions is what the catalogue's definitions pin in the store, and what of them could not be read.
|
||||
// Definitions is what the catalog's definitions pin in the store, and what of them could not be read.
|
||||
type Definitions struct {
|
||||
// Pins are by Key(repository, digest).
|
||||
Pins map[string][]Pin
|
||||
// Read is how many definitions were read; Unread says, per module, why its definition was not.
|
||||
Read int
|
||||
Unread map[string]string
|
||||
// NotAsked says why the catalogue could not be asked at all, when it could not.
|
||||
// NotAsked says why the catalog could not be asked at all, when it could not.
|
||||
NotAsked string
|
||||
// NamesNotRead says why the store's older names could not be read, when they could not.
|
||||
NamesNotRead string
|
||||
Names StoreNames
|
||||
}
|
||||
|
||||
// Catalogue reads the definitions through the catalogue's tools, and keeps each definition it read by its
|
||||
// Catalogue reads the definitions through the catalog's tools, and keeps each definition it read by its
|
||||
// module and commit, which never change together.
|
||||
type Catalogue struct {
|
||||
Ask Asking
|
||||
@@ -171,21 +171,21 @@ type catalogueEntry struct {
|
||||
Commit string `json:"commit"`
|
||||
}
|
||||
|
||||
// Read asks the catalogue for every module and reads each definition, bounded by DefinitionsTimeout.
|
||||
// Read asks the catalog for every module and reads each definition, bounded by DefinitionsTimeout.
|
||||
func (c *Catalogue) Read(ctx context.Context, names StoreNames) *Definitions {
|
||||
defs := &Definitions{Pins: map[string][]Pin{}, Unread: map[string]string{}, Names: names}
|
||||
if c == nil || c.Ask == nil {
|
||||
defs.NotAsked = "this bundle has no way to ask the catalogue"
|
||||
defs.NotAsked = "this bundle has no way to ask the catalog"
|
||||
return defs
|
||||
}
|
||||
raw, err := c.Ask(CatalogueModules, map[string]any{})
|
||||
if err != nil {
|
||||
defs.NotAsked = "the catalogue's modules could not be asked: " + err.Error()
|
||||
defs.NotAsked = "the catalog's modules could not be asked: " + err.Error()
|
||||
return defs
|
||||
}
|
||||
answer, output, ok := answerOf(raw)
|
||||
if !ok {
|
||||
defs.NotAsked = "the catalogue refused its modules: " + lastLine(output)
|
||||
defs.NotAsked = "the catalog refused its modules: " + lastLine(output)
|
||||
return defs
|
||||
}
|
||||
var list struct {
|
||||
@@ -193,7 +193,7 @@ func (c *Catalogue) Read(ctx context.Context, names StoreNames) *Definitions {
|
||||
Error string `json:"error"`
|
||||
}
|
||||
if err := json.Unmarshal(answer, &list); err != nil || list.Error != "" || list.Modules == nil {
|
||||
defs.NotAsked = "the catalogue's modules answer is not readable: " + firstOf(list.Error, errText(err), lastLine(output))
|
||||
defs.NotAsked = "the catalog's modules answer is not readable: " + firstOf(list.Error, errText(err), lastLine(output))
|
||||
return defs
|
||||
}
|
||||
c.mu.Lock()
|
||||
|
||||
@@ -54,7 +54,7 @@ func Tools(s *Store, c Controller, cat *Catalogue) []stdio.Tool {
|
||||
Name: "artifact_store_references",
|
||||
Description: "What the controller's records say of each manifest the artifact store holds: kept (a definition " +
|
||||
"names it, or one of the five most recent builds of a module the mesh holds), named by a definition (no " +
|
||||
"record names it, and a definition in the catalogue pins it by digest, under the store's current name or " +
|
||||
"record names it, and a definition in the catalog pins it by digest, under the store's current name or " +
|
||||
"an older one: the module is said), the holder of a kept archive, " +
|
||||
"eligible (the mesh made it and keeps it for no reason), the holder of an eligible archive, let go yet present, " +
|
||||
"a named document the controller keeps under a tag, or unrecorded — no record names it. A platform manifest " +
|
||||
|
||||
@@ -4,9 +4,9 @@ package main
|
||||
// the file under the agent's managed directory did not change by a byte when the module moved to Go;
|
||||
// a test holds it to that renderer's own output (testdata/rendered-by-typescript.json).
|
||||
func instructionsText(node, role string) string {
|
||||
return "# This machine is a node of a Novox mesh\n\nWritten by the mesh's `claude-code` module. Edit the module's settings or the catalogue, never this file:\nit is rewritten whenever the module renders.\n\n## Who this node is\n\n- **Node:** `" +
|
||||
return "# This machine is a node of a Novox mesh\n\nWritten by the mesh's `claude-code` module. Edit the module's settings or the catalog, never this file:\nit is rewritten whenever the module renders.\n\n## Who this node is\n\n- **Node:** `" +
|
||||
node +
|
||||
"`\n- **Role:** " +
|
||||
role +
|
||||
"\n- The other nodes, their roles and what runs where: ask the controller (`mesh-controller.nodes`,\n `mesh-controller.node`). Nothing here lists them, because a copy drifts.\n\n## How a session on this mesh works\n\nThe console is the only way to the mesh: the MCP server named `mesh`. It offers five tools, and\neverything else is an address you find and call through them:\n\n- `mesh_search` — words in, matching addresses out. `mesh_describe` — one address's arguments.\n- `mesh_call` — call an address. A seat the mesh holds once is `<seat>.<verb>` (the mesh's own verbs\n are `mesh-controller.<verb>`: `status`, `plan`, `node`, `assign`, `push`, `settings`);\n a module on a machine is `<node>/<module>.<tool>`.\n- `mesh_overview` and `mesh_machine` — the mesh's seats and machines, and what one machine runs.\n\n- **Symptom first.** For an error, a failing service or anything unexpected, search the record with the\n literal text before forming a hypothesis: the records module's `records_search`, then\n `records_read`.\n- **Ask the mesh before changing it**, and change it through the controller's verbs or the catalogue.\n- **A licence** through the `anthropic-licence-manager` seat's verbs. Never edit the agent's credentials\n file by hand, never print or ask for a token.\n\n## Hard rules\n\n- A file the mesh manages is changed through the verb or the catalogue that owns it, never on disk. If\n unsure, `mesh-controller.plan` for the node says what the mesh writes there.\n- Never write to a store's database by hand; schema changes are numbered migrations.\n- Never push to a main branch: a branch, a pull request, and a human approval for every merge.\n- The mesh creates no symlinks, and nobody else does either.\n- A package is declared in a module, never installed by hand.\n\n## Conventions\n\n- Commit messages are concise, in the imperative, about why.\n- Test before pushing: nodes update unattended.\n- The playbooks in the record say how research, decisions, designs, issues and hand-offs are done.\n"
|
||||
"\n- The other nodes, their roles and what runs where: ask the controller (`mesh-controller.nodes`,\n `mesh-controller.node`). Nothing here lists them, because a copy drifts.\n\n## How a session on this mesh works\n\nThe console is the only way to the mesh: the MCP server named `mesh`. It offers five tools, and\neverything else is an address you find and call through them:\n\n- `mesh_search` — words in, matching addresses out. `mesh_describe` — one address's arguments.\n- `mesh_call` — call an address. A seat the mesh holds once is `<seat>.<verb>` (the mesh's own verbs\n are `mesh-controller.<verb>`: `status`, `plan`, `node`, `assign`, `push`, `settings`);\n a module on a machine is `<node>/<module>.<tool>`.\n- `mesh_overview` and `mesh_machine` — the mesh's seats and machines, and what one machine runs.\n\n- **Symptom first.** For an error, a failing service or anything unexpected, search the record with the\n literal text before forming a hypothesis: the records module's `records_search`, then\n `records_read`.\n- **Ask the mesh before changing it**, and change it through the controller's verbs or the catalog.\n- **A licence** through the `anthropic-licence-manager` seat's verbs. Never edit the agent's credentials\n file by hand, never print or ask for a token.\n\n## Hard rules\n\n- A file the mesh manages is changed through the verb or the catalog that owns it, never on disk. If\n unsure, `mesh-controller.plan` for the node says what the mesh writes there.\n- Never write to a store's database by hand; schema changes are numbered migrations.\n- Never push to a main branch: a branch, a pull request, and a human approval for every merge.\n- The mesh creates no symlinks, and nobody else does either.\n- A package is declared in a module, never installed by hand.\n\n## Conventions\n\n- Commit messages are concise, in the imperative, about why.\n- Test before pushing: nodes update unattended.\n- The playbooks in the record say how research, decisions, designs, issues and hand-offs are done.\n"
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
"withKey": {
|
||||
"managed-mcp.json": "{\n \"mcpServers\": {\n \"anton\": {\n \"type\": \"stdio\",\n \"command\": \"node\",\n \"args\": [\n \"/a/b.js\"\n ],\n \"env\": {}\n },\n \"docs\": {\n \"type\": \"stdio\",\n \"command\": \"docs-mcp\",\n \"args\": [\n \"--x\"\n ]\n },\n \"mesh\": {\n \"type\": \"http\",\n \"url\": \"http://127.0.0.1:4270/mcp\"\n },\n \"search\": {\n \"type\": \"http\",\n \"url\": \"https://s.example/mcp\"\n }\n }\n}\n",
|
||||
"managed-settings.json": "{\n \"attribution\": {\n \"commit\": \"\",\n \"pr\": \"\"\n },\n \"allowAllClaudeAiMcps\": true,\n \"apiKeyHelper\": \"/state/api-key-helper\"\n}\n",
|
||||
"CLAUDE.md": "# This machine is a node of a Novox mesh\n\nWritten by the mesh's `claude-code` module. Edit the module's settings or the catalogue, never this file:\nit is rewritten whenever the module renders.\n\n## Who this node is\n\n- **Node:** `workstation`\n- **Role:** the laptop\n- The other nodes, their roles and what runs where: ask the controller (`mesh-controller.nodes`,\n `mesh-controller.node`). Nothing here lists them, because a copy drifts.\n\n## How a session on this mesh works\n\nThe console is the only way to the mesh: the MCP server named `mesh`. It offers five tools, and\neverything else is an address you find and call through them:\n\n- `mesh_search` — words in, matching addresses out. `mesh_describe` — one address's arguments.\n- `mesh_call` — call an address. A seat the mesh holds once is `<seat>.<verb>` (the mesh's own verbs\n are `mesh-controller.<verb>`: `status`, `plan`, `node`, `assign`, `push`, `settings`);\n a module on a machine is `<node>/<module>.<tool>`.\n- `mesh_overview` and `mesh_machine` — the mesh's seats and machines, and what one machine runs.\n\n- **Symptom first.** For an error, a failing service or anything unexpected, search the record with the\n literal text before forming a hypothesis: the records module's `records_search`, then\n `records_read`.\n- **Ask the mesh before changing it**, and change it through the controller's verbs or the catalogue.\n- **A licence** through the `anthropic-licence-manager` seat's verbs. Never edit the agent's credentials\n file by hand, never print or ask for a token.\n\n## Hard rules\n\n- A file the mesh manages is changed through the verb or the catalogue that owns it, never on disk. If\n unsure, `mesh-controller.plan` for the node says what the mesh writes there.\n- Never write to a store's database by hand; schema changes are numbered migrations.\n- Never push to a main branch: a branch, a pull request, and a human approval for every merge.\n- The mesh creates no symlinks, and nobody else does either.\n- A package is declared in a module, never installed by hand.\n\n## Conventions\n\n- Commit messages are concise, in the imperative, about why.\n- Test before pushing: nodes update unattended.\n- The playbooks in the record say how research, decisions, designs, issues and hand-offs are done.\n"
|
||||
"CLAUDE.md": "# This machine is a node of a Novox mesh\n\nWritten by the mesh's `claude-code` module. Edit the module's settings or the catalog, never this file:\nit is rewritten whenever the module renders.\n\n## Who this node is\n\n- **Node:** `workstation`\n- **Role:** the laptop\n- The other nodes, their roles and what runs where: ask the controller (`mesh-controller.nodes`,\n `mesh-controller.node`). Nothing here lists them, because a copy drifts.\n\n## How a session on this mesh works\n\nThe console is the only way to the mesh: the MCP server named `mesh`. It offers five tools, and\neverything else is an address you find and call through them:\n\n- `mesh_search` — words in, matching addresses out. `mesh_describe` — one address's arguments.\n- `mesh_call` — call an address. A seat the mesh holds once is `<seat>.<verb>` (the mesh's own verbs\n are `mesh-controller.<verb>`: `status`, `plan`, `node`, `assign`, `push`, `settings`);\n a module on a machine is `<node>/<module>.<tool>`.\n- `mesh_overview` and `mesh_machine` — the mesh's seats and machines, and what one machine runs.\n\n- **Symptom first.** For an error, a failing service or anything unexpected, search the record with the\n literal text before forming a hypothesis: the records module's `records_search`, then\n `records_read`.\n- **Ask the mesh before changing it**, and change it through the controller's verbs or the catalog.\n- **A licence** through the `anthropic-licence-manager` seat's verbs. Never edit the agent's credentials\n file by hand, never print or ask for a token.\n\n## Hard rules\n\n- A file the mesh manages is changed through the verb or the catalog that owns it, never on disk. If\n unsure, `mesh-controller.plan` for the node says what the mesh writes there.\n- Never write to a store's database by hand; schema changes are numbered migrations.\n- Never push to a main branch: a branch, a pull request, and a human approval for every merge.\n- The mesh creates no symlinks, and nobody else does either.\n- A package is declared in a module, never installed by hand.\n\n## Conventions\n\n- Commit messages are concise, in the imperative, about why.\n- Test before pushing: nodes update unattended.\n- The playbooks in the record say how research, decisions, designs, issues and hand-offs are done.\n"
|
||||
},
|
||||
"plain": {
|
||||
"managed-mcp.json": "{\n \"mcpServers\": {\n \"mesh\": {\n \"type\": \"http\",\n \"url\": \"http://127.0.0.1:4270/mcp\"\n }\n }\n}\n",
|
||||
"managed-settings.json": "{\n \"attribution\": {\n \"commit\": \"\",\n \"pr\": \"\"\n },\n \"allowAllClaudeAiMcps\": true\n}\n",
|
||||
"CLAUDE.md": "# This machine is a node of a Novox mesh\n\nWritten by the mesh's `claude-code` module. Edit the module's settings or the catalogue, never this file:\nit is rewritten whenever the module renders.\n\n## Who this node is\n\n- **Node:** `workstation`\n- **Role:** not stated — set it in this module's settings for the node\n- The other nodes, their roles and what runs where: ask the controller (`mesh-controller.nodes`,\n `mesh-controller.node`). Nothing here lists them, because a copy drifts.\n\n## How a session on this mesh works\n\nThe console is the only way to the mesh: the MCP server named `mesh`. It offers five tools, and\neverything else is an address you find and call through them:\n\n- `mesh_search` — words in, matching addresses out. `mesh_describe` — one address's arguments.\n- `mesh_call` — call an address. A seat the mesh holds once is `<seat>.<verb>` (the mesh's own verbs\n are `mesh-controller.<verb>`: `status`, `plan`, `node`, `assign`, `push`, `settings`);\n a module on a machine is `<node>/<module>.<tool>`.\n- `mesh_overview` and `mesh_machine` — the mesh's seats and machines, and what one machine runs.\n\n- **Symptom first.** For an error, a failing service or anything unexpected, search the record with the\n literal text before forming a hypothesis: the records module's `records_search`, then\n `records_read`.\n- **Ask the mesh before changing it**, and change it through the controller's verbs or the catalogue.\n- **A licence** through the `anthropic-licence-manager` seat's verbs. Never edit the agent's credentials\n file by hand, never print or ask for a token.\n\n## Hard rules\n\n- A file the mesh manages is changed through the verb or the catalogue that owns it, never on disk. If\n unsure, `mesh-controller.plan` for the node says what the mesh writes there.\n- Never write to a store's database by hand; schema changes are numbered migrations.\n- Never push to a main branch: a branch, a pull request, and a human approval for every merge.\n- The mesh creates no symlinks, and nobody else does either.\n- A package is declared in a module, never installed by hand.\n\n## Conventions\n\n- Commit messages are concise, in the imperative, about why.\n- Test before pushing: nodes update unattended.\n- The playbooks in the record say how research, decisions, designs, issues and hand-offs are done.\n"
|
||||
"CLAUDE.md": "# This machine is a node of a Novox mesh\n\nWritten by the mesh's `claude-code` module. Edit the module's settings or the catalog, never this file:\nit is rewritten whenever the module renders.\n\n## Who this node is\n\n- **Node:** `workstation`\n- **Role:** not stated — set it in this module's settings for the node\n- The other nodes, their roles and what runs where: ask the controller (`mesh-controller.nodes`,\n `mesh-controller.node`). Nothing here lists them, because a copy drifts.\n\n## How a session on this mesh works\n\nThe console is the only way to the mesh: the MCP server named `mesh`. It offers five tools, and\neverything else is an address you find and call through them:\n\n- `mesh_search` — words in, matching addresses out. `mesh_describe` — one address's arguments.\n- `mesh_call` — call an address. A seat the mesh holds once is `<seat>.<verb>` (the mesh's own verbs\n are `mesh-controller.<verb>`: `status`, `plan`, `node`, `assign`, `push`, `settings`);\n a module on a machine is `<node>/<module>.<tool>`.\n- `mesh_overview` and `mesh_machine` — the mesh's seats and machines, and what one machine runs.\n\n- **Symptom first.** For an error, a failing service or anything unexpected, search the record with the\n literal text before forming a hypothesis: the records module's `records_search`, then\n `records_read`.\n- **Ask the mesh before changing it**, and change it through the controller's verbs or the catalog.\n- **A licence** through the `anthropic-licence-manager` seat's verbs. Never edit the agent's credentials\n file by hand, never print or ask for a token.\n\n## Hard rules\n\n- A file the mesh manages is changed through the verb or the catalog that owns it, never on disk. If\n unsure, `mesh-controller.plan` for the node says what the mesh writes there.\n- Never write to a store's database by hand; schema changes are numbered migrations.\n- Never push to a main branch: a branch, a pull request, and a human approval for every merge.\n- The mesh creates no symlinks, and nobody else does either.\n- A package is declared in a module, never installed by hand.\n\n## Conventions\n\n- Commit messages are concise, in the imperative, about why.\n- Test before pushing: nodes update unattended.\n- The playbooks in the record say how research, decisions, designs, issues and hand-offs are done.\n"
|
||||
}
|
||||
}
|
||||
+66
-65
@@ -53,8 +53,9 @@ import { announce, keepWatermark, readWatermark } from "./announce.js";
|
||||
import { mergeTool } from "./merge.js";
|
||||
import { GiteaAdmin, GiteaClient, movedSince } from "./client.js";
|
||||
import { keepMainRules, mainRulesStep } from "./mainrules.js";
|
||||
import { CHECK_CONTEXT, CHECK_STATUS, REPO_CHECK_CONTEXT, commentFor, composedGate, groupGateStatus, headKey, headsToAnnounce, maintained,
|
||||
requiredOf, statusesFor, writesGate, type Announced, type Checked, repoCheckFacts, reposToLook } from "./pulls.js";
|
||||
import { CHECK_CONTEXT, CHECK_STATUS, REPO_CHECK_CONTEXT, commentFor, composedGate, groupGateStatus, headKey, maintained,
|
||||
requiredOf, statusesFor, writesGate, type Announced, type Checked, repoCheckFacts } from "./pulls.js";
|
||||
import { actOn, announceNewHeads, startPass } from "./watch.js";
|
||||
import { GateWriter } from "./gate.js";
|
||||
import { HOOK_PATH, HOOK_PORT, Pace, claimHead, ensureSystemHook, eventsTool, keptSecret, receiver, type ForgeEvent } from "./webhook.js";
|
||||
import { keepSiblings, noteComposed, noteVerdict, readSiblings, siblingsFile, siblingsOf, weighSiblings } from "./siblings.js";
|
||||
@@ -138,12 +139,7 @@ async function pollMerged(client: GiteaClient): Promise<void> {
|
||||
// Closed unmerged (novox/hq ADR 0239): announced once, since the watching began, so its delivery stops.
|
||||
const closedKey = `closed:${repo.full_name}#${pull.number}`;
|
||||
if (!pull.merged && pull.state === "closed" && !announced.has(closedKey)) {
|
||||
if (primedMerges && !!pull.updated_at && !!since && pull.updated_at > since) {
|
||||
await announce("pull.closed", { owner: repo.owner, repo: repo.name, number: pull.number, title: pull.title,
|
||||
head: pull.head, head_sha: pull.head_sha, base: pull.base, html_url: pull.html_url });
|
||||
console.log(`[gitea] announced ${repo.full_name}#${pull.number} closed unmerged`);
|
||||
await siblingMoves(client, repo.full_name, pull.number);
|
||||
}
|
||||
if (primedMerges && !!pull.updated_at && !!since && pull.updated_at > since) await announceClosed(client, repo, pull);
|
||||
announced.add(closedKey);
|
||||
continue;
|
||||
}
|
||||
@@ -168,6 +164,23 @@ async function pollMerged(client: GiteaClient): Promise<void> {
|
||||
type RepoOf = { owner: string; name: string; full_name: string; clone_url?: string };
|
||||
type PullOf = Awaited<ReturnType<GiteaClient["listPullRequests"]>>[number];
|
||||
|
||||
/** A pull request closed without a merge, announced once (ADR 0239): by its event, or by the start's pass. */
|
||||
async function announceClosed(client: GiteaClient, repo: RepoOf, pull: PullOf): Promise<boolean> {
|
||||
const closedKey = `closed:${repo.full_name}#${pull.number}`;
|
||||
if (pull.merged || pull.state !== "closed" || announced.has(closedKey)) return false;
|
||||
announced.add(closedKey);
|
||||
try {
|
||||
await announce("pull.closed", { owner: repo.owner, repo: repo.name, number: pull.number, title: pull.title,
|
||||
head: pull.head, head_sha: pull.head_sha, base: pull.base, html_url: pull.html_url });
|
||||
} catch (err) {
|
||||
announced.delete(closedKey);
|
||||
throw err;
|
||||
}
|
||||
console.log(`[gitea] announced ${repo.full_name}#${pull.number} closed unmerged`);
|
||||
await siblingMoves(client, repo.full_name, pull.number);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** **A merge, announced once, whichever path saw it first** (novox/hq issue 729): the poll or the forge's event. */
|
||||
async function announceMerge(client: GiteaClient, repo: RepoOf, pull: PullOf): Promise<boolean> {
|
||||
if (!pull.merged || !pull.merge_commit_sha || announced.has(pull.merge_commit_sha)) return false;
|
||||
@@ -281,43 +294,18 @@ async function alreadyChecked(client: GiteaClient, repo: RepoOf, pull: OpenOf):
|
||||
}
|
||||
|
||||
let lastPullLook = "";
|
||||
// **A sweep now and then looks at every repository** (novox/hq issue 347), whatever moved: the floor is a
|
||||
// heuristic, and a heuristic that misses is caught by the next sweep rather than never.
|
||||
const SWEEP_MS = 10 * 60_000;
|
||||
let lastSweep = 0;
|
||||
async function pollPulls(client: GiteaClient): Promise<void> {
|
||||
/** The pass over every open pull request: run at the start and when the receiver listens, never on a timer (issue 1422). */
|
||||
async function passPulls(client: GiteaClient): Promise<void> {
|
||||
const began = new Date().toISOString();
|
||||
const floor = lastPullLook ? new Date(Date.parse(lastPullLook) - MARGIN_MS).toISOString() : "";
|
||||
const dayAgo = new Date(Date.now() - 24 * 3600_000).toISOString();
|
||||
// A pull request opened, reopened or retargeted moves its own update time and not its repository's: the
|
||||
// pull requests updated since the floor are found by their own (issue 347). A search that fails is a sweep.
|
||||
let sweep = Date.now() - lastSweep >= SWEEP_MS;
|
||||
let updated: { owner: string; name: string; updated_at?: string }[] = [];
|
||||
if (floor && !sweep) {
|
||||
try {
|
||||
updated = await client.searchOpenPulls(floor);
|
||||
} catch (err) {
|
||||
console.error(`[gitea] the pull requests updated lately could not be searched, so every repository is looked at — ${err instanceof Error ? err.message : err}`);
|
||||
sweep = true;
|
||||
}
|
||||
}
|
||||
if (sweep) lastSweep = Date.now();
|
||||
for (const repo of reposToLook(await client.listAllRepos(), floor, updated, sweep)) {
|
||||
// Every open pull request updated since the floor, paged (novox/hq issue 579): the newest 20 alone left a head
|
||||
// beyond them unannounced. A sweep and the first pass read every page.
|
||||
const open = await client.listOpenPullsSince(repo.owner, repo.name, sweep ? "" : floor);
|
||||
for (const pull of headsToAnnounce(repo.full_name, open, heads)) {
|
||||
const key = headKey(repo.full_name, pull.number, pull.base);
|
||||
const fresh = primedPulls || (!!pull.updated_at && pull.updated_at > dayAgo);
|
||||
// The first look after a start remembers nothing: a head the forge already shows a merge check of was announced.
|
||||
if (fresh && !primedPulls && await alreadyChecked(client, repo, pull)) {
|
||||
heads[key] = String(pull.head_sha);
|
||||
continue;
|
||||
}
|
||||
if (fresh) {
|
||||
if (await announceHead(client, repo, pull)) pace.miss(`${key} at ${String(pull.head_sha).slice(0, 8)}`);
|
||||
} else heads[key] = String(pull.head_sha);
|
||||
}
|
||||
for (const repo of await client.listAllRepos()) {
|
||||
// Every open pull request, paged (novox/hq issue 579).
|
||||
const open = await client.listOpenPullsSince(repo.owner, repo.name, "");
|
||||
await announceNewHeads(repo.full_name, open, heads, primedPulls, dayAgo, {
|
||||
alreadyChecked: (pull) => alreadyChecked(client, repo, pull),
|
||||
announceHead: (pull) => announceHead(client, repo, pull),
|
||||
missed: (what) => pace.miss(what),
|
||||
});
|
||||
if (await trunksMoved(client, repo.owner, repo.name)) changedTrunks = true;
|
||||
}
|
||||
if (changedTrunks) keepTrunks();
|
||||
@@ -497,6 +485,9 @@ const checks = new CheckStatuses({
|
||||
/** How fast the polls look: 30 s until the forge's events are heard, five minutes while they are; and what
|
||||
* gitea_events says of them (webhook.ts). */
|
||||
const pace = new Pace();
|
||||
/** Asks the pass over every repository again, shortly and once (set where the pass is made): an event that could not be
|
||||
* acted on is not lost until the next start. */
|
||||
let catchUp: () => void = () => {};
|
||||
if (!gitea) pace.unheard("the forge is not watched: no way to a token", false);
|
||||
|
||||
// The states this module keeps and which others may read, said on the bus before it serves (novox/hq ADR 0495 clause 2).
|
||||
@@ -522,22 +513,15 @@ registerModuleTools("gitea", () => [eventsTool(pace), ...readAllTools(readAll),
|
||||
gates,
|
||||
}), mergeTool(gitea, { gates })] : [])]);
|
||||
|
||||
/** What the forge's event asks of the announcer at once (issue 729): a new head is announced, and a merge. */
|
||||
async function actOn(client: GiteaClient, event: ForgeEvent): Promise<void> {
|
||||
const b = event.body as { owner?: string; repo?: string; number?: number };
|
||||
if (!b.owner || !b.repo || !b.number) return;
|
||||
if (event.name === "forge.pull-request.closed") {
|
||||
// Closed unmerged is a sibling's move; a merge is weighed with its announcement below (ADR 0382 §5).
|
||||
if (!(event.body as { merged?: boolean }).merged) await siblingMoves(client, `${b.owner}/${b.repo}`, b.number);
|
||||
return;
|
||||
}
|
||||
const head = ["forge.pull-request.opened", "forge.pull-request.synchronized", "forge.pull-request.reopened"].includes(event.name);
|
||||
const merged = event.name === "forge.pull-request.merged";
|
||||
if (!head && !merged) return;
|
||||
const [repo, pull] = await Promise.all([client.getRepo(b.owner, b.repo), client.getPullRequest(b.owner, b.repo, b.number)]);
|
||||
if (head && pull.state === "open") await announceHead(client, repo, pull);
|
||||
if (merged) await announceMerge(client, repo, pull);
|
||||
}
|
||||
/** What the forge's event asks of the announcer at once (issue 729, 1422): see watch.ts. */
|
||||
const actOnEvent = (client: GiteaClient, event: ForgeEvent): Promise<void> => actOn<RepoOf, PullOf>(event, {
|
||||
getRepo: (o, r) => client.getRepo(o, r),
|
||||
getPull: (o, r, n) => client.getPullRequest(o, r, n) as Promise<PullOf & { state?: string; merged?: boolean }>,
|
||||
announceHead: (repo, pull) => announceHead(client, repo, pull as OpenOf),
|
||||
announceMerge: (repo, pull) => announceMerge(client, repo, pull),
|
||||
announceClosed: (repo, pull) => announceClosed(client, repo, pull),
|
||||
siblingMoves: (full, n) => siblingMoves(client, full, n),
|
||||
});
|
||||
|
||||
/**
|
||||
* **The receiver, and the forge's one system webhook pointing at it** (issue 729). The secret is minted and kept beside
|
||||
@@ -563,7 +547,12 @@ async function listenForForge(client: GiteaClient): Promise<boolean> {
|
||||
// A repository made, or one not yet seen readable, is granted read before anything acts on it (readall.ts).
|
||||
await Promise.resolve().then(() => readAll().onEvent(event)).catch((err) =>
|
||||
console.error(`[gitea] whether the mesh's accounts read the repository of ${event.name} could not be settled — ${err instanceof Error ? err.message : err}`));
|
||||
await actOn(client, event);
|
||||
try {
|
||||
await actOnEvent(client, event);
|
||||
} catch (err) {
|
||||
catchUp();
|
||||
throw err;
|
||||
}
|
||||
} });
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
server.once("error", reject);
|
||||
@@ -612,9 +601,9 @@ if (gitea) {
|
||||
// polls slow to every five minutes and announce only what no event said (Pace); otherwise they keep 30 s.
|
||||
// **Not awaited** (novox/hq issue 1726): the receiver's set-up asks the forge's admin API, and the runtime kills a bundle
|
||||
// whose import has not ended in its 10 s handshake and never starts it again; a forge slow to answer while every bundle
|
||||
// of the node starts left gitea_commit_status, gitea_merge_pull_request and gitea_events served nowhere. Until it is
|
||||
// listening, Pace keeps the polls at 30 s, so nothing is missed meanwhile; listenForForge says its own failure.
|
||||
void listenForForge(client);
|
||||
// of the node starts left gitea_commit_status, gitea_merge_pull_request and gitea_events served nowhere. The pass below
|
||||
// runs again once it is listening, so nothing said before is missed; listenForForge says its own failure.
|
||||
const listenOk = listenForForge(client);
|
||||
// The start's one pass over every repository (readall.ts), not awaited for the same reason. A forge not answering yet
|
||||
// is asked again, a minute apart, until one pass has run; after that only the forge's events grant.
|
||||
// An account of the list the forge does not hold yet (the forge-account provider makes nox-builder and nox-agent when
|
||||
@@ -646,8 +635,20 @@ if (gitea) {
|
||||
// Only while the setting keep-main-rules is true (mainrules.ts); false, the default, leaves every repository's rule as set.
|
||||
tick(mainRulesStep(keepMainRules(), () => GiteaAdmin.fromEnv().ensureMainMerges("novox"), (line) => console.log(line)), 600_000);
|
||||
tick(() => pollRepos(client), 60_000);
|
||||
tick(() => pollMerged(client), () => pace.every());
|
||||
tick(() => pollPulls(client), () => pace.every());
|
||||
// **No timer asks the forge for pull requests or merges** (issue 1422): the forge's events announce them. One pass over
|
||||
// every repository runs at the start and again once the receiver listens, so what happened while the module was away or
|
||||
// not yet listening is announced; passes run one at a time, a failed one is asked again a minute later.
|
||||
let passes: Promise<void> = Promise.resolve();
|
||||
const pass = (): Promise<void> => (passes = passes.catch(() => {}).then(() =>
|
||||
startPass(async () => { await pollMerged(client); await passPulls(client); }, { retryMs: 60_000 })));
|
||||
void pass();
|
||||
let catchUpAsked = false;
|
||||
catchUp = () => {
|
||||
if (catchUpAsked) return;
|
||||
catchUpAsked = true;
|
||||
setTimeout(() => { catchUpAsked = false; void pass(); }, 30_000);
|
||||
};
|
||||
void listenOk.then((ok) => (ok ? pass() : undefined));
|
||||
// Bound again until they hold, and not awaited (bind.ts, issue 1793): the runtime kills a bundle that has not answered its
|
||||
// handshake in 10 s, so the import must end while a refused bind is still asked again.
|
||||
bindInBackground([
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { mock, test } from "node:test";
|
||||
import type { GiteaPull } from "../client.ts";
|
||||
|
||||
// **No poll of the forge** (issue 1422, notes 10 and 11): the forge's events announce heads and merges; a pass runs once at
|
||||
// the start and when the receiver listens.
|
||||
|
||||
const edited = (base: string) => ({ name: "forge.pull-request.edited", body: { owner: "novox", repo: "hq", number: 7, base, merged: false } });
|
||||
|
||||
function deps() {
|
||||
const calls: string[] = [];
|
||||
return { calls, d: {
|
||||
getRepo: async () => ({ r: 1 }),
|
||||
getPull: async () => ({ state: "open", base: "trunk" }) as any,
|
||||
announceHead: async () => { calls.push("head"); },
|
||||
announceMerge: async () => { calls.push("merge"); },
|
||||
announceClosed: async () => { calls.push("closed"); },
|
||||
siblingMoves: async () => { calls.push("siblings"); },
|
||||
} };
|
||||
}
|
||||
|
||||
test("an edited event announces the head into the base it now has, without a poll", async () => {
|
||||
const { actOn } = await import("../watch.ts");
|
||||
const { calls, d } = deps();
|
||||
await actOn(edited("trunk"), d);
|
||||
assert.deepEqual(calls, ["head"]);
|
||||
});
|
||||
|
||||
test("a close without a merge is announced by its event, a merged close is left to the merge event", async () => {
|
||||
const { actOn } = await import("../watch.ts");
|
||||
const { calls, d } = deps();
|
||||
await actOn({ name: "forge.pull-request.closed", body: { owner: "novox", repo: "hq", number: 7, merged: false } }, d);
|
||||
assert.deepEqual(calls, ["closed", "siblings"]);
|
||||
calls.length = 0;
|
||||
await actOn({ name: "forge.pull-request.closed", body: { owner: "novox", repo: "hq", number: 7, merged: true } }, d);
|
||||
assert.deepEqual(calls, []);
|
||||
});
|
||||
|
||||
test("no timer polls after the start: one pass ends and nothing is scheduled; a failed one is asked again", async () => {
|
||||
const { startPass } = await import("../watch.ts");
|
||||
mock.timers.enable({ apis: ["setTimeout", "setInterval"] });
|
||||
try {
|
||||
let runs = 0;
|
||||
await startPass(async () => { runs++; }, { retryMs: 60_000, log: () => {} });
|
||||
mock.timers.tick(24 * 3600_000);
|
||||
assert.equal(runs, 1, "a day later the forge was not asked again");
|
||||
let tries = 0;
|
||||
const retried = startPass(async () => { if (++tries < 2) throw new Error("forge down"); }, { retryMs: 60_000, log: () => {} });
|
||||
await Promise.resolve(); await Promise.resolve();
|
||||
mock.timers.tick(60_000);
|
||||
await retried;
|
||||
assert.equal(tries, 2);
|
||||
} finally {
|
||||
mock.timers.reset();
|
||||
}
|
||||
});
|
||||
|
||||
test("a start pass announces a head nobody announced, and only remembers one the forge shows a check of", async () => {
|
||||
const { announceNewHeads } = await import("../watch.ts");
|
||||
const pull = (n: number, sha: string): GiteaPull => ({ number: n, state: "open", head_sha: sha, base: "main",
|
||||
updated_at: new Date().toISOString() } as unknown as GiteaPull);
|
||||
const announced: number[] = [], said: string[] = [];
|
||||
const heads: Record<string, string> = {};
|
||||
await announceNewHeads("novox/hq", [pull(1, "a".repeat(40)), pull(2, "b".repeat(40))], heads, false,
|
||||
new Date(Date.now() - 24 * 3600_000).toISOString(), {
|
||||
alreadyChecked: async (p) => p.number === 2,
|
||||
announceHead: async (p) => { announced.push(p.number); return true; },
|
||||
missed: (w) => said.push(w),
|
||||
});
|
||||
assert.deepEqual(announced, [1]);
|
||||
assert.equal(heads["novox/hq#2@main"], "b".repeat(40), "the checked head is remembered, not announced");
|
||||
assert.equal(said.length, 1);
|
||||
});
|
||||
@@ -251,7 +251,8 @@ test("a forge that never delivers is said loudly once, and unhealthy, when the p
|
||||
assert.equal(r.healthy, true);
|
||||
assert.equal(r.verified.count, 1);
|
||||
assert.equal(r.verified.last.event, "push");
|
||||
assert.equal(r.polls.every_seconds, 300);
|
||||
assert.equal(r.polls.every_seconds, null);
|
||||
assert.equal(r.polls.hearing, true);
|
||||
assert.match(said.join("\n"), /heard again/);
|
||||
});
|
||||
|
||||
@@ -314,24 +315,19 @@ test("without a receiver by configuration the polls alone watch, healthy; a rece
|
||||
assert.match(r.why, /403/);
|
||||
});
|
||||
|
||||
test("the polls look every 30 s until events are heard, every five minutes while they are, and 30 s again on a miss", async () => {
|
||||
test("nothing is paced: the report says no timer asks the forge, and a miss is still counted and said", async () => {
|
||||
const { Pace } = await import("../webhook.ts");
|
||||
let now = 1_000_000;
|
||||
const said: string[] = [];
|
||||
const pace = new Pace(() => now, (l) => said.push(l));
|
||||
assert.equal(pace.every(), 30_000, "no delivery yet");
|
||||
pace.heard();
|
||||
assert.equal(pace.every(), 300_000, "a delivery heard");
|
||||
now += 11 * 60_000;
|
||||
assert.equal(pace.every(), 30_000, "ten minutes without a delivery");
|
||||
assert.equal((pace as any).every, undefined, "no pace to ask");
|
||||
assert.equal((pace.report() as any).polls.every_seconds, null);
|
||||
pace.heard();
|
||||
assert.equal((pace.report() as any).polls.hearing, true);
|
||||
now += 1000;
|
||||
pace.miss("novox/hq#7 at aaaaaaaa");
|
||||
assert.equal(pace.every(), 30_000, "the poll found what no event said");
|
||||
assert.equal((pace.report() as any).polls.hearing, false, "the pass found what no event said");
|
||||
assert.match(said.join("\n"), /MISSED novox\/hq#7/);
|
||||
now += 1000;
|
||||
pace.heard();
|
||||
assert.equal(pace.every(), 300_000, "the next delivery");
|
||||
});
|
||||
|
||||
// Issue 1079: a pull request's edit event carries its description, so mesh-delivery reads a Reviewed-by line written after
|
||||
|
||||
@@ -637,7 +637,7 @@ function allGiteaTools(gitea: GiteaClient, admin?: () => GiteaAdmin): ToolDefini
|
||||
},
|
||||
{
|
||||
name: "gitea_commit_trees",
|
||||
description: "A commit's trees from the forge's one recursive listing: the root tree, and the tree of every directory that holds a module.json (the root as an empty name), each by its git hash. What the forge bridge puts in a merge's message (novox/hq ADR 0437 §5). With paths, {directory: [path relative to it]}, the answer also carries paths, {directory: {path: git object id}} of each named file or directory at the commit (novox/hq ADR 0499 §3); a path the commit lacks fails naming the directory and the path. The commit is a full 40-hex sha. With listed, [directory], the answer also carries listed, {directory: {name: git blob id}} of the files directly under each (the catalogue's placement files, novox/hq ADR 0549 §2). A listing the forge cut is refused, never answered in part. Reads only.",
|
||||
description: "A commit's trees from the forge's one recursive listing: the root tree, and the tree of every directory that holds a module.json (the root as an empty name), each by its git hash. What the forge bridge puts in a merge's message (novox/hq ADR 0437 §5). With paths, {directory: [path relative to it]}, the answer also carries paths, {directory: {path: git object id}} of each named file or directory at the commit (novox/hq ADR 0499 §3); a path the commit lacks fails naming the directory and the path. The commit is a full 40-hex sha. With listed, [directory], the answer also carries listed, {directory: {name: git blob id}} of the files directly under each (the catalog's placement files, novox/hq ADR 0549 §2). A listing the forge cut is refused, never answered in part. Reads only.",
|
||||
input: {
|
||||
owner: { type: "string", description: "the repository owner" },
|
||||
repo: { type: "string", description: "the repository name" },
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
// What the forge's events ask of the announcer, and the one pass at a start (issue 1422, notes 10 and 11). Nothing polls the
|
||||
// forge: a head or merge is announced when its event is heard, and a pass over every repository runs once when the module
|
||||
// starts and again when the receiver is listening, so what happened while it was down is announced too.
|
||||
//
|
||||
// Apart from index.ts, which has side effects at import, so these are tested with the announcers injected.
|
||||
|
||||
import type { GiteaPull, GiteaRepo } from "./client.js";
|
||||
import type { Announced } from "./pulls.js";
|
||||
import { headKey, headsToAnnounce } from "./pulls.js";
|
||||
import type { ForgeEvent } from "./webhook.js";
|
||||
|
||||
export interface ActDeps<R, P> {
|
||||
getRepo(owner: string, repo: string): Promise<R>;
|
||||
getPull(owner: string, repo: string, number: number): Promise<P & { state?: string; merged?: boolean }>;
|
||||
announceHead(repo: R, pull: P): Promise<unknown>;
|
||||
announceMerge(repo: R, pull: P): Promise<unknown>;
|
||||
announceClosed(repo: R, pull: P): Promise<unknown>;
|
||||
siblingMoves(full: string, number: number): Promise<unknown>;
|
||||
}
|
||||
|
||||
const HEAD_EVENTS = ["forge.pull-request.opened", "forge.pull-request.synchronized", "forge.pull-request.reopened"];
|
||||
|
||||
/**
|
||||
* What the forge's event asks of the announcer at once: a new head is announced, a merge, a close without a merge, and a
|
||||
* pull request retargeted (an edit: the head is announced into the base it now has — the base is in the head's key, so an
|
||||
* edit that changed nothing about the base announces nothing).
|
||||
*/
|
||||
export async function actOn<R, P>(event: ForgeEvent, d: ActDeps<R, P>): Promise<void> {
|
||||
const b = event.body as { owner?: string; repo?: string; number?: number; merged?: boolean };
|
||||
if (!b.owner || !b.repo || !b.number) return;
|
||||
const edited = event.name === "forge.pull-request.edited";
|
||||
const closed = event.name === "forge.pull-request.closed";
|
||||
const head = HEAD_EVENTS.includes(event.name) || edited;
|
||||
const merged = event.name === "forge.pull-request.merged";
|
||||
if (!head && !merged && !closed) return;
|
||||
if (closed && b.merged) return; // a merge is weighed with its own event (ADR 0382 §5)
|
||||
const [repo, pull] = await Promise.all([d.getRepo(b.owner, b.repo), d.getPull(b.owner, b.repo, b.number)]);
|
||||
if (closed) {
|
||||
await d.announceClosed(repo, pull);
|
||||
await d.siblingMoves(`${b.owner}/${b.repo}`, b.number);
|
||||
return;
|
||||
}
|
||||
if (head && pull.state === "open") await d.announceHead(repo, pull);
|
||||
if (merged) await d.announceMerge(repo, pull);
|
||||
}
|
||||
|
||||
/**
|
||||
* The one pass at a start, and its retry: run now; if it fails, say so and run again after `retryMs`, until one pass has
|
||||
* ended. A retry of a failed pass, never a poll: after a pass has ended nothing is scheduled.
|
||||
*/
|
||||
export function startPass(run: () => Promise<void>, opts: { retryMs: number; log?: (l: string) => void }): Promise<void> {
|
||||
const log = opts.log ?? ((l) => console.error(`[gitea] ${l}`));
|
||||
return run().catch((err) => {
|
||||
log(`the pass over every repository failed, asked again in ${opts.retryMs / 1000} s — ${err instanceof Error ? err.message : err}`);
|
||||
return new Promise<void>((resolve) => setTimeout(() => resolve(startPass(run, opts)), opts.retryMs));
|
||||
});
|
||||
}
|
||||
|
||||
export interface HeadDeps {
|
||||
/** Whether the forge shows a merge check of the head: only an announced head has one. */
|
||||
alreadyChecked(pull: GiteaPull): Promise<boolean>;
|
||||
/** Announce it; true when it was this call that announced it (not an event before it). */
|
||||
announceHead(pull: GiteaPull): Promise<boolean>;
|
||||
/** Told of a head this pass announced that no event had. */
|
||||
missed(what: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The heads of one repository's open pull requests a pass announces. A head is announced when it is new and fresh (moved in
|
||||
* the last day); at the first pass after a start (`primed` false) one the forge shows a merge check of was announced
|
||||
* already, and is only remembered.
|
||||
*/
|
||||
export async function announceNewHeads(full: string, open: GiteaPull[], heads: Announced, primed: boolean, dayAgo: string, d: HeadDeps): Promise<void> {
|
||||
for (const pull of headsToAnnounce(full, open, heads)) {
|
||||
const key = headKey(full, pull.number, pull.base);
|
||||
const fresh = primed || (!!pull.updated_at && pull.updated_at > dayAgo);
|
||||
if (fresh && !primed && await d.alreadyChecked(pull)) {
|
||||
heads[key] = String(pull.head_sha);
|
||||
continue;
|
||||
}
|
||||
if (fresh) {
|
||||
if (await d.announceHead(pull)) d.missed(`${key} at ${String(pull.head_sha).slice(0, 8)}`);
|
||||
} else heads[key] = String(pull.head_sha);
|
||||
}
|
||||
}
|
||||
|
||||
export type { GiteaRepo };
|
||||
+19
-22
@@ -3,7 +3,7 @@
|
||||
// with a secret it mints and keeps beside its token; the receiver refuses whatever is unsigned or does not verify, and
|
||||
// publishes each event, trimmed, on the module's events as forge.<kind>.<action> (forge.pull-request.opened, forge.push, …),
|
||||
// on the shared EVENTS path its other events take; its own stream (ADR 0363) is a follow-up once issue 725 ships.
|
||||
// The polls stay as the safety net, slowed; the announced-heads and announced-merges records keep anything from
|
||||
// No poll is the safety net (issue 1422); the announced-heads and announced-merges records keep anything from
|
||||
// being announced twice, whichever path saw it first.
|
||||
//
|
||||
// The secret is never logged: lines say it was minted or reused and where it is kept, never what it is.
|
||||
@@ -144,7 +144,7 @@ export interface ReceiverOptions {
|
||||
publish: (event: ForgeEvent) => Promise<void>;
|
||||
/** Acts on it at once, beside publishing it (the announcer). */
|
||||
act?: (event: ForgeEvent) => Promise<void>;
|
||||
/** Told of every verified delivery — its kind (X-Gitea-Event) and its delivery id — so the polls know events are
|
||||
/** Told of every verified delivery — its kind (X-Gitea-Event) and its delivery id — so the module knows events are
|
||||
* heard, and the module can say when it last heard one. */
|
||||
heard?: (kind: string, delivery: string) => void;
|
||||
/** Told of every refused delivery, with the reason and where it came from. */
|
||||
@@ -242,7 +242,7 @@ export function receiver(opts: ReceiverOptions): Server & { idle(): Promise<void
|
||||
await opts.publish(event);
|
||||
if (opts.act) await opts.act(event);
|
||||
} catch (err) {
|
||||
log(`a forge event ${event.name} could not be published or acted on; the polls catch it — ${err instanceof Error ? err.message : err}`);
|
||||
log(`a forge event ${event.name} could not be published or acted on; the pass over every repository is asked again shortly — ${err instanceof Error ? err.message : err}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -276,14 +276,13 @@ export interface HookState {
|
||||
export const SILENT_AFTER = 10 * 60_000;
|
||||
|
||||
/**
|
||||
* **How fast the polls look, and whether the forge's events are heard** (issue 729): every five minutes only while the
|
||||
* forge's events are heard — a verified delivery within the last ten minutes, and none missed since. Until the first
|
||||
* delivery, after ten minutes without one, or once the poll found something no event said, every thirty seconds.
|
||||
* **Whether the forge's events are heard** (issues 729, 1422). Nothing polls the forge, so there is no pace: a delivery
|
||||
* heard within the last ten minutes, and none missed since, is `hearing`.
|
||||
*
|
||||
* It also keeps what `gitea_events` says: where the receiver listens, the hook as ensured, the verified and refused
|
||||
* deliveries, and the polls' finds no event said. **A forge whose events stop is said** (issue 729): once the receiver
|
||||
* deliveries, and the finds of the pass over every repository (at the start and when the receiver listens) that no event said. **A forge whose events stop is said** (issue 729): once the receiver
|
||||
* listens and the hook is ensured, when nothing verified for ten minutes — since the start, or since the last delivery —
|
||||
* and the poll has found at least two heads or merges no event said in that quiet (one could be the poll beating an
|
||||
* and a pass has found at least two heads or merges no event said in that quiet (one could be a pass beating an
|
||||
* event by a second), it is logged loudly once per silent spell, and the module's events are said unhealthy until a
|
||||
* delivery verifies. Deliveries refused since the last verified one are said unhealthy too.
|
||||
*/
|
||||
@@ -318,7 +317,7 @@ export class Pace {
|
||||
this.notHeard = null;
|
||||
}
|
||||
/** No events are listened for, and why: by configuration (`fails` false), or because the receiver could not listen
|
||||
* or the hook could not be ensured (`fails` true, said unhealthy). The polls alone watch. */
|
||||
* or the hook could not be ensured (`fails` true, said unhealthy). Only the pass at the start watches. */
|
||||
unheard(why: string, fails = true): void {
|
||||
this.notHeard = why;
|
||||
this.notHeardFails = fails;
|
||||
@@ -337,10 +336,10 @@ export class Pace {
|
||||
this.refusedSpell++;
|
||||
this.lastRefused = { at: this.now(), reason, from };
|
||||
}
|
||||
/** The poll found a head or merge no forge event announced. */
|
||||
/** The pass over every repository found a head or merge no forge event announced. */
|
||||
miss(what: string): void {
|
||||
const t = this.now();
|
||||
if (this.hearing()) this.log(`THE FORGE'S EVENTS MISSED ${what}: the poll found it, so the polls look every 30 s again until the next event`);
|
||||
if (this.hearing()) this.log(`THE FORGE'S EVENTS MISSED ${what}: the pass over every repository found it`);
|
||||
this.missed = t;
|
||||
this.missCount++;
|
||||
this.lastMiss = { at: t, what };
|
||||
@@ -355,8 +354,8 @@ export class Pace {
|
||||
this.log(`THE FORGE'S EVENTS ARE NOT HEARD: ${this.last ? `no delivery verified since the last at ` +
|
||||
`${new Date(this.last).toISOString()}` : "no delivery ever verified since the start"}, ${minutes} min, from the ` +
|
||||
`system webhook at ${this.hook?.url}${refusedSince ? `; ${refusedSince} refused since, the last because ` +
|
||||
`${this.lastRefused?.reason}` : ""}; the poll found ${what} — the polls alone watch the forge, every 30 s ` +
|
||||
`(novox/hq issue 729)`);
|
||||
`${this.lastRefused?.reason}` : ""}; the pass found ${what}; nothing else watches the forge ` +
|
||||
`(novox/hq issue 729, 1422)`);
|
||||
}
|
||||
}
|
||||
/** Whether a delivery was refused after the last verified one (or with none verified). */
|
||||
@@ -367,9 +366,6 @@ export class Pace {
|
||||
const t = this.now();
|
||||
return this.last > 0 && t - this.last < 10 * 60_000 && this.last > this.missed;
|
||||
}
|
||||
every(): number {
|
||||
return this.hearing() ? 5 * 60_000 : 30_000;
|
||||
}
|
||||
private expecting(): boolean {
|
||||
return this.where !== null && this.hook !== null;
|
||||
}
|
||||
@@ -383,14 +379,14 @@ export class Pace {
|
||||
if (this.silentSince) {
|
||||
state = "unhealthy";
|
||||
why = `${this.last ? `no delivery verified since the last at ${iso(this.last)}` : `the forge has never delivered an ` +
|
||||
`event since the start at ${iso(this.started)}`}, while the poll found ${this.missCount} head(s) or merge(s) no ` +
|
||||
`event since the start at ${iso(this.started)}`}, while the pass found ${this.missCount} head(s) or merge(s) no ` +
|
||||
`event said, the last ${this.lastMiss?.what} at ${iso(this.lastMiss?.at ?? t)}`;
|
||||
} else if (refusedSince) {
|
||||
state = "unhealthy";
|
||||
why = `${refusedSince} deliveries refused ${this.last ? `since the last verified one at ${iso(this.last)}` :
|
||||
"and none verified"}, the last at ${iso(this.lastRefused?.at ?? t)} because ${this.lastRefused?.reason}`;
|
||||
} else if (!this.expecting()) {
|
||||
why = this.notHeard ? `no events are listened for, so the polls alone watch the forge: ${this.notHeard}` :
|
||||
why = this.notHeard ? `no events are listened for, so only the pass at the start watches the forge: ${this.notHeard}` :
|
||||
"the receiver is not listening yet";
|
||||
if (this.notHeard && this.notHeardFails) state = "unhealthy";
|
||||
} else if (this.hearing()) {
|
||||
@@ -398,7 +394,7 @@ export class Pace {
|
||||
} else if (this.last === 0) {
|
||||
why = `no delivery heard yet; the forge is said silent if the poll finds what no event said ${SILENT_AFTER / 60_000} min after the start`;
|
||||
} else {
|
||||
why = `the last delivery was at ${iso(this.last)}; the polls look every 30 s until the next`;
|
||||
why = `the last delivery was at ${iso(this.last)}; nothing polls the forge, so what happens meanwhile is announced at the next start or when the receiver listens again`;
|
||||
}
|
||||
return {
|
||||
healthy: state !== "unhealthy", state, why,
|
||||
@@ -407,7 +403,8 @@ export class Pace {
|
||||
hook: this.hook,
|
||||
verified: { count: this.verifiedCount, last: this.lastVerified && { ...this.lastVerified, at: iso(this.lastVerified.at) } },
|
||||
refused: { count: this.refusedCount, since_verified: refusedSince, last: this.lastRefused && { ...this.lastRefused, at: iso(this.lastRefused.at) } },
|
||||
polls: { every_seconds: this.every() / 1000, hearing: this.hearing(), found_unsaid: this.missCount,
|
||||
polls: { every_seconds: null, note: "no timer asks the forge; one pass at the start and when the receiver listens (issue 1422)",
|
||||
hearing: this.hearing(), found_unsaid: this.missCount,
|
||||
last_found: this.lastMiss && { ...this.lastMiss, at: iso(this.lastMiss.at) } },
|
||||
silent: this.silentSince ? { since: iso(this.silentSince) } : null,
|
||||
};
|
||||
@@ -502,8 +499,8 @@ export function eventsTool(pace: Pace): { name: string; description: string; inp
|
||||
name: "gitea_events",
|
||||
description: "Whether the forge's events reach the mesh (novox/hq issue 729): where the receiver listens, the " +
|
||||
"system webhook as ensured at the start (its id, url, events, kind, and what it replaced), how many deliveries " +
|
||||
"verified and the last one's time and event, how many were refused and the last reason, how often the polls look " +
|
||||
"and whether events are heard, and how many heads or merges the poll found that no event said. Unhealthy when the " +
|
||||
"verified and the last one's time and event, how many were refused and the last reason, whether " +
|
||||
"events are heard (nothing polls; one pass runs at the start), and how many heads or merges that pass found that no event said. Unhealthy when the " +
|
||||
"forge has delivered nothing that verified for ten minutes (since the start or since the last delivery) while the " +
|
||||
"poll found what no event said, when deliveries were refused since the last verified one, or when the receiver " +
|
||||
"could not listen or the webhook could not be made.",
|
||||
|
||||
@@ -53,6 +53,22 @@ built for the fallback kernel too) after its boot-entries service, so the entry
|
||||
| file | `/etc/pacman.d/hooks/90-mesh-kernel-boot-entries.hook` | runs the script after a kernel image is installed, upgraded or removed |
|
||||
| packages | `linux-lts`, `linux-lts-headers` | declared after the service and the hook |
|
||||
|
||||
## Kernel modules at boot, and the running kernel's modules kept
|
||||
|
||||
A machine that runs for weeks meets a kernel upgrade that removes `/usr/lib/modules/<the running kernel>`: from then on
|
||||
no module that was not loaded yet can be loaded until the next boot. On 2026-10-28 a build node, up 24 days on
|
||||
`linux-lts` 6.18.54 with only 6.18.58's modules on disk, had `/dev/net/tun` and no tun driver, and every image build
|
||||
there failed in buildah's network setup ("Failed to open() /dev/net/tun: No such device").
|
||||
|
||||
| | what | notes |
|
||||
|---|---|---|
|
||||
| file | `/etc/modules-load.d/mesh-kernel.conf` | the kernel modules loaded at every boot by systemd-modules-load: `tun` (pasta, which buildah uses for a RUN line's network, and every user-space tunnel open `/dev/net/tun`). Read at boot only: nothing is loaded by an apply |
|
||||
| package | `kernel-modules-hook` | keeps the running kernel's modules across an upgrade (saved before the transaction, put back after), so a module first needed later still loads |
|
||||
| service | `linux-modules-cleanup.service` | the package's oneshot, enabled at boot and stopped otherwise: it moves the modules of a kernel that is neither running nor owned by a package to `/usr/lib/modules/.old`, which the package's tmpfiles rule empties after four weeks. An apply never starts it |
|
||||
|
||||
A machine whose running kernel's modules are already gone loads nothing new until it is started again; the image build
|
||||
module says so in its health and takes no image build there meanwhile.
|
||||
|
||||
## Tools
|
||||
|
||||
| tool | | answers |
|
||||
@@ -63,7 +79,7 @@ built for the fallback kernel too) after its boot-entries service, so the entry
|
||||
## Tests
|
||||
|
||||
`go test ./...`: the tool over a stand-in tree holding the control node's own files of 2026-10-14; the
|
||||
manifest's shape (the default, the order, the unit and its sandbox, reload, restart and health); the boot-entries script run with `sh` over stand-in roots (a systemd-boot entries directory, a GRUB menu, a hook that copies kernels to one fixed name): the entry from the booted command line, a menu generated again only when the kernels changed, no loader, no room, the taken-over hook; `kernel_boot` over the same roots; and the huge-pages script as the mesh
|
||||
manifest's shape (the default, the order, the unit and its sandbox, reload, restart and health); the kernel modules loaded at boot (`tun`) and the package and boot service that keep the running kernel's modules; the boot-entries script run with `sh` over stand-in roots (a systemd-boot entries directory, a GRUB menu, a hook that copies kernels to one fixed name): the entry from the booted command line, a menu generated again only when the kernels changed, no loader, no room, the taken-over hook; `kernel_boot` over the same roots; and the huge-pages script as the mesh
|
||||
writes it, run with `sh` against a stand-in directory: it sets and reads back, keeps what it found once,
|
||||
rotates the journal once and not for `always` nor while the machine starts, goes straight to a new value on a
|
||||
reload without rewriting what it found, gives back what it found and then keeps nothing, refuses a value the kernel
|
||||
|
||||
@@ -24,7 +24,7 @@ func TestTheDefaultIsMadviseAndTheUnitFollowsTheSetting(t *testing.T) {
|
||||
for _, r := range m.Resources {
|
||||
ids = append(ids, r["id"].(string))
|
||||
}
|
||||
if strings.Join(ids, " ") != "state huge-pages unit apply boot-entries boot-unit boot-hook boot-apply linux-lts linux-lts-headers" {
|
||||
if strings.Join(ids, " ") != "state huge-pages unit apply boot-entries boot-unit boot-hook boot-apply linux-lts linux-lts-headers modules-load modules-keep modules-cleanup" {
|
||||
t.Fatalf("order: %v", ids)
|
||||
}
|
||||
script := m.resource(t, "huge-pages")
|
||||
@@ -57,6 +57,31 @@ func TestTheDefaultIsMadviseAndTheUnitFollowsTheSetting(t *testing.T) {
|
||||
if h := apply["health"].(map[string]any); h["kind"] != "unit" {
|
||||
t.Fatalf("health: %v", h)
|
||||
}
|
||||
// A build node, 2026-10-28: up 24 days on linux-lts 6.18.54 after an upgrade to 6.18.58 removed the running kernel's modules,
|
||||
// so tun could not be loaded when a build first asked for it. tun is loaded at every boot, before an upgrade can take
|
||||
// its file away, and the running kernel's modules are kept across an upgrade (kernel-modules-hook) and cleaned up at
|
||||
// the next boot.
|
||||
load := m.resource(t, "modules-load")
|
||||
if load["path"] != "/etc/modules-load.d/mesh-kernel.conf" || load["mode"] != "0644" {
|
||||
t.Fatalf("modules-load: %v", load)
|
||||
}
|
||||
var names []string
|
||||
for _, l := range strings.Split(load.text(t), "\n") {
|
||||
if l = strings.TrimSpace(l); l != "" && !strings.HasPrefix(l, "#") {
|
||||
names = append(names, l)
|
||||
}
|
||||
}
|
||||
if strings.Join(names, " ") != "tun" {
|
||||
t.Fatalf("the modules loaded at boot: %v", names)
|
||||
}
|
||||
if keep := m.resource(t, "modules-keep"); keep["type"] != "package" || keep["package"] != "kernel-modules-hook" {
|
||||
t.Fatalf("modules-keep: %v", keep)
|
||||
}
|
||||
// A oneshot at boot: enabled, and stopped once it ran, never started by an apply (it moves the modules of kernels no
|
||||
// package owns away).
|
||||
if c := m.resource(t, "modules-cleanup"); c["unit"] != "linux-modules-cleanup.service" || c["state"] != "stopped" || c["boot"] != "enabled" {
|
||||
t.Fatalf("modules-cleanup: %v", c)
|
||||
}
|
||||
}
|
||||
|
||||
// bed is the script as the mesh writes it for one value of the setting, a stand-in transparent_hugepage
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Written by the mesh's kernel module (systemd-modules-load reads it at boot).
|
||||
# tun: buildah's network for a RUN line (pasta) and every other user-space tunnel open /dev/net/tun.
|
||||
# Loaded at boot, so an upgrade that removes the running kernel's modules cannot keep it out later.
|
||||
tun
|
||||
@@ -100,6 +100,25 @@
|
||||
"id": "linux-lts-headers",
|
||||
"type": "package",
|
||||
"package": "linux-lts-headers"
|
||||
},
|
||||
{
|
||||
"id": "modules-load",
|
||||
"type": "file",
|
||||
"path": "/etc/modules-load.d/mesh-kernel.conf",
|
||||
"mode": "0644",
|
||||
"template": "files/modules-load.conf"
|
||||
},
|
||||
{
|
||||
"id": "modules-keep",
|
||||
"type": "package",
|
||||
"package": "kernel-modules-hook"
|
||||
},
|
||||
{
|
||||
"id": "modules-cleanup",
|
||||
"type": "service",
|
||||
"unit": "linux-modules-cleanup.service",
|
||||
"state": "stopped",
|
||||
"boot": "enabled"
|
||||
}
|
||||
],
|
||||
"build": {
|
||||
|
||||
@@ -16,7 +16,12 @@ credential and an environment built from scratch.
|
||||
|
||||
The account's subordinate user and group ranges are not declared anywhere: the node-engine makes every `user` account
|
||||
with `useradd`, which allocates them. The module's health reads `/etc/subuid` and `/etc/subgid` and is unhealthy
|
||||
without a range for the account, without buildah, or when a user namespace cannot be made.
|
||||
without a range for the account, without buildah, when a user namespace cannot be made, or when `/dev/net/tun`
|
||||
cannot be opened (buildah makes a RUN line's network with pasta, which needs the tun driver; on 2026-10-28 a build node had the
|
||||
device node and no driver, so every image build there failed with "Failed to open() /dev/net/tun: No such device"). The
|
||||
kernel module loads `tun` at boot. Whatever the health refuses, the node is **not eligible**: the seat's puller judges
|
||||
by a capacity of 0 with that reason (`capacity.<node>`, which `build_usage` shows), so the asks go to a node that can
|
||||
build them; a look that passes again wakes the puller.
|
||||
|
||||
The Dockerfile's steps may use the network (ADR 0487 §6); nothing a step can read holds a key.
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ func (m *Module) Puller(steps []StepTool, source buildstep.AskSource) *buildstep
|
||||
load = func(key string) ([]byte, error) { return m.ReadPauses.Get(key) }
|
||||
}
|
||||
return &buildstep.Puller{Source: source, Language: delivery.AskImage, Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load,
|
||||
Capacity: capacity, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Logf: m.Say,
|
||||
Capacity: capacity, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Eligible: m.Eligible, Logf: m.Say,
|
||||
Run: func(ctx context.Context, a delivery.StepAsk) (any, error) {
|
||||
if err := m.Check(ctx); err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -71,4 +71,17 @@ func TestAPulledImageAskCopiesThenBuilds(t *testing.T) {
|
||||
t.Errorf("%s.%s is not served", Seat, verb)
|
||||
}
|
||||
}
|
||||
// A node without /dev/net/tun (a build node, 2026-10-28) takes no ask: its capacity is 0 and says why, so the ask goes to a node
|
||||
// that can build it instead of failing in buildah's network setup; once it is there again, the capacity is back.
|
||||
tun := m.Tun
|
||||
m.Tun = t.TempDir() + "/none"
|
||||
_ = m.Check(context.Background())
|
||||
if c := p.CapacityDetail(); c.Effective != 0 || !strings.Contains(c.Why, "not eligible: "+m.Tun+" cannot be opened") {
|
||||
t.Errorf("without /dev/net/tun the capacity = %+v", c)
|
||||
}
|
||||
m.Tun = tun
|
||||
_ = m.Check(context.Background())
|
||||
if c := p.CapacityDetail(); c.Effective != 1 || c.Ineligible != "" {
|
||||
t.Errorf("with /dev/net/tun again the capacity = %+v", c)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,6 +190,7 @@ func moduleWith(t *testing.T, f *fake, states *keptStates) *Module {
|
||||
SubUIDFile: write("subuid", "someone:100000:65536\nmesh-build-image:624288:65536\n"),
|
||||
SubGIDFile: write("subgid", "mesh-build-image:624288:65536\n"),
|
||||
RegistryFile: write("registry", f.address()+"\n"),
|
||||
Tun: write("tun", ""),
|
||||
RegistryWait: 2 * time.Second,
|
||||
RegistryPause: 5 * time.Millisecond,
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ type Module struct {
|
||||
Work, Store string
|
||||
// SubUIDFile and SubGIDFile are the subordinate id files; /etc/subuid and /etc/subgid when empty.
|
||||
SubUIDFile, SubGIDFile string
|
||||
// Tun is the tun device buildah's network for a RUN line (pasta) opens; TunDevice when empty.
|
||||
Tun string
|
||||
// RegistryFile holds the registry's address, host:port, which the manifest binds from the artifact-store provision.
|
||||
RegistryFile string
|
||||
// RemoteBase is where repositories are fetched from, "ssh://mesh-forge/" when empty; FetchOptions are the options of
|
||||
@@ -62,6 +64,10 @@ type Module struct {
|
||||
|
||||
spacesOnce sync.Once
|
||||
workspaces *buildstep.Workspaces
|
||||
|
||||
// lastMu guards last: the refusal of the last look ("" when it could build), which Eligible answers.
|
||||
lastMu sync.Mutex
|
||||
last string
|
||||
}
|
||||
|
||||
// Look is what the module found out about its machine.
|
||||
@@ -90,15 +96,44 @@ func (m *Module) look(ctx context.Context) (Look, error) {
|
||||
if err := m.userNamespace(ctx); err != nil {
|
||||
return l, &buildstep.Refusal{Text: err.Error(), Have: l.Buildah}
|
||||
}
|
||||
if err := m.tunDevice(); err != nil {
|
||||
return l, &buildstep.Refusal{Text: err.Error(), Have: l.Buildah}
|
||||
}
|
||||
return l, nil
|
||||
}
|
||||
|
||||
// Check is the guard: nil when the machine can build, else the refusal.
|
||||
// Check is the guard: nil when the machine can build, else the refusal. Every look is kept for Eligible, and a change
|
||||
// wakes the puller, so a node that can build again takes asks at once.
|
||||
func (m *Module) Check(ctx context.Context) error {
|
||||
_, err := m.look(ctx)
|
||||
m.keep(err)
|
||||
return err
|
||||
}
|
||||
|
||||
// keep records a look's outcome for Eligible and wakes the puller when it changed.
|
||||
func (m *Module) keep(err error) {
|
||||
why := ""
|
||||
if err != nil {
|
||||
why = err.Error()
|
||||
}
|
||||
m.lastMu.Lock()
|
||||
changed := m.last != why
|
||||
m.last = why
|
||||
m.lastMu.Unlock()
|
||||
if changed && m.Held != nil {
|
||||
m.Held.Wake()
|
||||
}
|
||||
}
|
||||
|
||||
// Eligible is the puller's eligibility (buildstep.Puller.Eligible): the refusal of the module's last look, "" when it
|
||||
// could build. While the machine cannot build, the node's capacity is 0 and says why, so its asks go to a node that can
|
||||
// build them instead of failing here (a build node without /dev/net/tun, 2026-10-28).
|
||||
func (m *Module) Eligible() string {
|
||||
m.lastMu.Lock()
|
||||
defer m.lastMu.Unlock()
|
||||
return m.last
|
||||
}
|
||||
|
||||
// Start looks once, as the module starts, and then every CheckRound until ctx ends; it also removes old workspaces.
|
||||
func (m *Module) Start(ctx context.Context) {
|
||||
for {
|
||||
@@ -119,13 +154,14 @@ func (m *Module) Start(ctx context.Context) {
|
||||
// healthy it names the buildah installed and the account's ranges (ADR 0487 §2: the ranges are proven here, not declared).
|
||||
func (m *Module) Health(ctx context.Context) health.Answer {
|
||||
l, err := m.look(ctx)
|
||||
m.keep(err)
|
||||
if err != nil {
|
||||
return health.Unhealthy(err.Error())
|
||||
}
|
||||
if err := m.room(); err != nil {
|
||||
return health.Unhealthy(err.Error())
|
||||
}
|
||||
return health.Healthy(fmt.Sprintf("buildah %s installed; %s holds %d subordinate uids and %d gids; a user namespace can be made", l.Buildah, l.Account, l.UIDs, l.GIDs))
|
||||
return health.Healthy(fmt.Sprintf("buildah %s installed; %s holds %d subordinate uids and %d gids; a user namespace can be made; %s opens", l.Buildah, l.Account, l.UIDs, l.GIDs, m.tunPath()))
|
||||
}
|
||||
|
||||
// Status is what the module reports of itself.
|
||||
|
||||
@@ -43,20 +43,33 @@ func TestHealthIsUnhealthyWithoutBuildah(t *testing.T) {
|
||||
}
|
||||
|
||||
// The ranges are read from the two files, one each: without one in /etc/subuid or in /etc/subgid the account has no ids to
|
||||
// map, and the health says which file.
|
||||
func TestHealthIsUnhealthyWithoutARangeInEitherFile(t *testing.T) {
|
||||
for file, set := range map[string]func(*Module, string){
|
||||
"subuid": func(m *Module, p string) { m.SubUIDFile = p },
|
||||
"subgid": func(m *Module, p string) { m.SubGIDFile = p },
|
||||
// map, and the health says which file. And without /dev/net/tun (a build node on 2026-10-28: its running kernel's modules were
|
||||
// gone, so tun could not be loaded) buildah's network for a RUN line cannot be made: the health says the node is not
|
||||
// eligible, and the puller judges by 0 so its asks go to a node that can build them.
|
||||
func TestHealthIsUnhealthyWithoutWhatABuildNeeds(t *testing.T) {
|
||||
for _, c := range []struct {
|
||||
name string
|
||||
set func(*Module, string)
|
||||
says []string
|
||||
}{
|
||||
{"subuid", func(m *Module, p string) { m.SubUIDFile = p }, []string{"/subuid", "mesh-build-image"}},
|
||||
{"subgid", func(m *Module, p string) { m.SubGIDFile = p }, []string{"/subgid", "mesh-build-image"}},
|
||||
{"tun", func(m *Module, p string) { m.Tun = p + "/dev/net/tun" }, []string{"not eligible: ", "/dev/net/tun cannot be opened", "tun"}},
|
||||
} {
|
||||
f := newFake(t)
|
||||
m := moduleWith(t, f, newStates())
|
||||
p := t.TempDir() + "/" + file
|
||||
p := t.TempDir() + "/" + c.name
|
||||
os.WriteFile(p, []byte("someone-else:100000:65536\n"), 0o644)
|
||||
set(m, p)
|
||||
c.set(m, p)
|
||||
a := m.Health(context.Background())
|
||||
if a.Healthy || !strings.Contains(a.Why, p) || !strings.Contains(a.Why, "mesh-build-image") {
|
||||
t.Errorf("%s: health = %+v, want unhealthy naming %s and the account", file, a, p)
|
||||
for _, want := range c.says {
|
||||
if a.Healthy || !strings.Contains(a.Why, want) {
|
||||
t.Errorf("%s: health = %+v, want unhealthy saying %q", c.name, a, want)
|
||||
}
|
||||
}
|
||||
// Whatever the look refuses, the node is not eligible, with the same words.
|
||||
if got := m.Eligible(); got != a.Why {
|
||||
t.Errorf("%s: eligible says %q, the health %q", c.name, got, a.Why)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@ package main
|
||||
|
||||
// What the module proves about its own machine before it builds (novox/hq ADR 0487 §2, issue 1703a): buildah runs,
|
||||
// the account holds subordinate user and group ranges (the node-engine's useradd allocates them for every `user`
|
||||
// account, so nothing declares them; this reads them), and a user namespace can be made.
|
||||
// account, so nothing declares them; this reads them), a user namespace can be made, and the tun device opens (buildah
|
||||
// makes a RUN line's network with pasta, which needs it; a build node on 2026-10-28 had the device node and no tun driver).
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -18,6 +20,9 @@ import (
|
||||
// ProbeTimeout bounds each probe: they read the machine and fetch nothing.
|
||||
const ProbeTimeout = 20 * time.Second
|
||||
|
||||
// TunDevice is the tun device pasta opens for a RUN line's network.
|
||||
const TunDevice = "/dev/net/tun"
|
||||
|
||||
// Default subordinate id files.
|
||||
const (
|
||||
SubUIDFile = "/etc/subuid"
|
||||
@@ -133,3 +138,23 @@ func (m *Module) ensureRuntimeDir() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Module) tunPath() string {
|
||||
if m.Tun != "" {
|
||||
return m.Tun
|
||||
}
|
||||
return TunDevice
|
||||
}
|
||||
|
||||
// tunDevice opens the tun device as the account does for a build, and says the node is not eligible when it cannot: a
|
||||
// device node without its driver answers "no such device" (the tun kernel module is not loaded and cannot be, as when the
|
||||
// running kernel's modules were removed by an upgrade), and every RUN line would fail in buildah's network setup.
|
||||
func (m *Module) tunDevice() error {
|
||||
f, err := os.OpenFile(m.tunPath(), os.O_RDWR, 0)
|
||||
if err != nil {
|
||||
return fmt.Errorf("not eligible: %s cannot be opened (%v), so buildah cannot make a RUN line's network (pasta): "+
|
||||
"the tun kernel module is not loaded here (the kernel module loads it at boot; a machine whose running kernel's "+
|
||||
"modules are gone needs a reboot)", m.tunPath(), errors.Unwrap(err))
|
||||
}
|
||||
return f.Close()
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ module meshbuildimage
|
||||
go 1.26.0
|
||||
|
||||
require (
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261027002948-db1007ffdda1
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261028115016-1618837ea9fe
|
||||
github.com/nats-io/nats-server/v2 v2.11.17
|
||||
github.com/nats-io/nats.go v1.54.0
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261027002948-db1007ffdda1 h1:9qyUcrvlklxDRBUCBqGH1L3oximOk554IfaPrTMgaTA=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261027002948-db1007ffdda1/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261028115016-1618837ea9fe h1:QDWi8k7zxaRPnJ+V/izoy6A19hZt1LTLl3uksZSlqOg=
|
||||
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261028115016-1618837ea9fe/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op h1:Z/MZK75wC/NSrkgqeNIa7jexam9uWzhLmFTSCPI/kn0=
|
||||
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
|
||||
github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo=
|
||||
|
||||
@@ -66,7 +66,7 @@ CREATE TABLE IF NOT EXISTS module_version (
|
||||
PRIMARY KEY (module, commit_sha)
|
||||
);
|
||||
|
||||
-- What the catalogue considers this module to be now. Separate from module_version because a
|
||||
-- What the catalog considers this module to be now. Separate from module_version because a
|
||||
-- module has many versions and exactly one current one, and "current" is a decision rather than
|
||||
-- a consequence of being newest.
|
||||
CREATE TABLE IF NOT EXISTS module_current (
|
||||
@@ -144,7 +144,7 @@ export class Graph {
|
||||
const url = env["DATABASE_URL"] ?? readMaybe(env["DATABASE_URL_FILE"]);
|
||||
if (!url) {
|
||||
throw new Error(
|
||||
"no DATABASE_URL: the catalogue holds the module graph and cannot hold it in memory, " +
|
||||
"no DATABASE_URL: the catalog holds the module graph and cannot hold it in memory, " +
|
||||
"because a graph that disappears on restart is not a record of anything",
|
||||
);
|
||||
}
|
||||
@@ -246,7 +246,7 @@ export class Graph {
|
||||
}
|
||||
}
|
||||
|
||||
/** Every module the catalogue holds, with the commit it considers current. */
|
||||
/** Every module the catalog holds, with the commit it considers current. */
|
||||
async modules(): Promise<{ module: string; commit: string; repository: string; path: string }[]> {
|
||||
const { rows } = await this.pool.query(
|
||||
`SELECT c.module, c.commit_sha, v.repository, v.path
|
||||
|
||||
@@ -12,7 +12,7 @@ export function getCatalogueTools(graph: Graph): ToolDefinition[] {
|
||||
{
|
||||
name: "catalog_modules",
|
||||
description:
|
||||
"Every module this mesh holds, with the commit the catalogue considers current and where it came from.",
|
||||
"Every module this mesh holds, with the commit the catalog considers current and where it came from.",
|
||||
input: {},
|
||||
run: async () => ({ modules: await graph.modules() }),
|
||||
},
|
||||
@@ -28,7 +28,7 @@ export function getCatalogueTools(graph: Graph): ToolDefinition[] {
|
||||
const module = String(args.module ?? "");
|
||||
if (!module) return { error: "name a module" };
|
||||
const found = await graph.show(module, args.commit ? String(args.commit) : undefined);
|
||||
return found ? { module: found } : { error: `the catalogue holds no ${module}` };
|
||||
return found ? { module: found } : { error: `the catalog holds no ${module}` };
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -184,7 +184,7 @@ func (call Call) level() (Level, error) {
|
||||
case call.Module != "":
|
||||
return Level{}, fmt.Errorf("a module's own value is set for one node, and no node is named: there is no "+
|
||||
"module value for the whole mesh (novox/hq ADR 0348 §3); name the node, or set mesh config for the "+
|
||||
"predefined key %s's value falls back to, or change its default in the catalogue", call.Module)
|
||||
"predefined key %s's value falls back to, or change its default in the catalog", call.Module)
|
||||
case call.Node != "":
|
||||
return Level{Kind: LevelNode, Node: call.Node}, nil
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ func (c *Config) sources() (Sources, error) {
|
||||
}); err != nil {
|
||||
return s, fmt.Errorf("the assignments cannot be read: %w", err)
|
||||
}
|
||||
// And every module the catalogue's placement names on a node (ADR 0549 §3): until ADR 0547's third milestone both
|
||||
// And every module the catalog's placement names on a node (ADR 0549 §3): until ADR 0547's third milestone both
|
||||
// sources stand (ADR 0549 §5), so a pair either names is resolved, and none loses its values while the two differ.
|
||||
// Placement that cannot be read yet (the indexer's state not on the bus) leaves the assignments alone, said.
|
||||
standing := map[string]bool{}
|
||||
@@ -57,7 +57,7 @@ func (c *Config) sources() (Sources, error) {
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
problems = append(problems, fmt.Sprintf("the catalogue's placement cannot be read, so the assignments alone are resolved: %v", err))
|
||||
problems = append(problems, fmt.Sprintf("the catalog's placement cannot be read, so the assignments alone are resolved: %v", err))
|
||||
}
|
||||
if err := c.each(DeclaredConfigRead, func(key string, raw []byte) error {
|
||||
m, err := ParseModuleDeclarations(raw)
|
||||
|
||||
@@ -33,6 +33,7 @@ what it refuses.
|
||||
| `reserve` | `kind` (`decision` or `research`), optionally `for` (one line: what the record is about) | the next number of that kind, spent forever; answers `kind` and `number` (and `prefix`, the number as the record's name starts with it); see below |
|
||||
| `fix-times` | optionally `days` (1 to 90, default 7) | each class's fix budget, the median and worst fix time of the issues whose last fix was delivered in the window, within and over, and every issue over its budget with its longest phase; see *A fix's time* |
|
||||
| `learn-fixes` | `number` | asks again for the fixes of one issue the tracker keeps no record of (a pull request merged before it heard deliveries): the delivery, then the forge, say whether each is merged (and the commit it landed as) or closed without merging; answers what each is kept as and the delivery line |
|
||||
| `changes` | `since` (a window such as `60m`, at most `24h`), `number` (optional) | each issue's moves over the window, read from the tracker's own log `changes`: opened, moved, resolved or wontfix, the status it moved from and to, who moved it (and the worker, for diagnosing or fixing) and when, oldest first, at most 500; the window's first entry is found by its time, so a day's window reads only that day of the log. knowledge-base.progress with `since` asks it for each move's "from" |
|
||||
|
||||
**The cycle's rules, at the write** (hq playbook 03, which `00-META/checks/cycle.py` enforced on the
|
||||
folders until the import, and hq ADR 0284): a status is one of `open`,
|
||||
|
||||
@@ -23,7 +23,7 @@ const Seat = "issue-tracker"
|
||||
|
||||
// Verbs are the seat's verbs, as the manifest declares and claims them.
|
||||
var Verbs = []string{"open", "get", "list", "move", "note", "link", "milestones", "milestone-set", "milestone-move", "import",
|
||||
"groom", "set", "tracking", "reserve", "fix-times", "learn-fixes"}
|
||||
"groom", "set", "tracking", "reserve", "fix-times", "learn-fixes", "changes"}
|
||||
|
||||
func logf(format string, a ...any) { fmt.Fprintf(os.Stderr, format+"\n", a...) }
|
||||
|
||||
@@ -943,5 +943,6 @@ func Tools(t *Tracker) []stdio.Tool {
|
||||
}
|
||||
return t.LearnFixes(n)
|
||||
}},
|
||||
changesTool(t),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,13 @@ func TestAnIssueRaceIntoTwoMilestonesOverTheBusEndsInOne(t *testing.T) {
|
||||
if len(hist.History) != 1 {
|
||||
t.Fatalf("history %d values", len(hist.History))
|
||||
}
|
||||
// The moves history over the real log: the open, from nothing to open, read by the other instance.
|
||||
var ch ChangesRead
|
||||
_ = json.Unmarshal(must(two.call("changes", map[string]any{"since": "60m"})), &ch)
|
||||
if len(ch.Changes) != 1 || ch.Changes[0].Number != 365 || ch.Changes[0].Kind != OpOpened || ch.Changes[0].To != StatusOpen ||
|
||||
ch.Changes[0].Title != "a milestone's issue" {
|
||||
t.Fatalf("changes %+v", ch)
|
||||
}
|
||||
evMu.Lock()
|
||||
defer evMu.Unlock()
|
||||
var kinds []string
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
package main
|
||||
|
||||
// changes: each issue's moves over a window, read from the tracker's own record, its log `changes` (novox/hq ADR 0300),
|
||||
// which holds every operation with who made it and when. The bucket `issues` keeps only what they add up to, so this
|
||||
// is the one place an issue's earlier status is known: knowledge-base.progress with since asks it for the "from" of
|
||||
// each move (the operator, 2026-10-28: the progress made in the last 60 minutes).
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
)
|
||||
|
||||
// MostChangesWindow is the longest window changes reads.
|
||||
const MostChangesWindow = 24 * time.Hour
|
||||
|
||||
// MostChanges is the most changes one answer holds, the newest kept.
|
||||
const MostChanges = 500
|
||||
|
||||
// changesSlack is how far before the window the log is read from: an entry's time is the bus's, an operation's the
|
||||
// tracker's, and the two may differ by a little.
|
||||
const changesSlack = time.Minute
|
||||
|
||||
// Change is one issue's status changing: opened, moved, resolved or wontfix, from what to what, by whom and when.
|
||||
type Change struct {
|
||||
Number uint64 `json:"number"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Kind string `json:"kind"`
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
By string `json:"by"`
|
||||
// Worker is who works on it, for a move to diagnosing or fixing: whom by names (the caller is By).
|
||||
Worker string `json:"worker,omitempty"`
|
||||
At time.Time `json:"at"`
|
||||
}
|
||||
|
||||
// ChangesRead is the answer of changes.
|
||||
type ChangesRead struct {
|
||||
Since time.Time `json:"since"`
|
||||
Changes []Change `json:"changes"`
|
||||
// Entries is how many entries of the log were read for it.
|
||||
Entries int `json:"entries-read"`
|
||||
Said string `json:"said"`
|
||||
}
|
||||
|
||||
// Changes reads the moves of the last window, of every issue or of one.
|
||||
func (t *Tracker) Changes(window time.Duration, number uint64) (*ChangesRead, error) {
|
||||
if window <= 0 || window > MostChangesWindow {
|
||||
return nil, fmt.Errorf("since is a window more than nothing and at most 24h, not %s", window)
|
||||
}
|
||||
if t.Log == nil {
|
||||
return nil, errNoLog
|
||||
}
|
||||
from := t.now().Add(-window)
|
||||
out := &ChangesRead{Since: from, Changes: []Change{}}
|
||||
var numbers []uint64
|
||||
if number != 0 {
|
||||
numbers = []uint64{number}
|
||||
} else {
|
||||
var err error
|
||||
if numbers, err = t.movedSince(from, out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
for _, n := range numbers {
|
||||
entries, err := t.readKey(n, 1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(entries) == 0 {
|
||||
if number != 0 {
|
||||
return nil, fmt.Errorf("%d is not an issue the tracker holds", n)
|
||||
}
|
||||
continue
|
||||
}
|
||||
out.Entries += len(entries)
|
||||
var cur *Issue
|
||||
for _, e := range entries {
|
||||
var op Operation
|
||||
if err := json.Unmarshal(e.Value, &op); err != nil {
|
||||
return nil, fmt.Errorf("the entry at %d is no operation this module reads: %v", e.Sequence, err)
|
||||
}
|
||||
next, err := fold(cur, &op, e.Sequence)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("issue %d cannot be folded from its log: %v", n, err)
|
||||
}
|
||||
was := ""
|
||||
if cur != nil {
|
||||
was = cur.Status
|
||||
}
|
||||
cur = next
|
||||
if op.Op == OpCarried || op.At.Before(from) || (was == next.Status && was != "") {
|
||||
continue
|
||||
}
|
||||
kind := EventMoved
|
||||
switch {
|
||||
case was == "" && (op.Op == OpOpened || op.Op == OpImported):
|
||||
kind = op.Op
|
||||
case next.Status == StatusResolved || next.Status == StatusWontfix:
|
||||
kind = next.Status
|
||||
}
|
||||
c := Change{Number: n, Kind: kind, From: was, To: next.Status, By: op.By, At: op.At}
|
||||
if next.Worker != nil && (next.Status == StatusDiagnosing || next.Status == StatusFixing) {
|
||||
c.Worker = next.Worker.By
|
||||
}
|
||||
out.Changes = append(out.Changes, c)
|
||||
}
|
||||
for i := range out.Changes {
|
||||
if out.Changes[i].Number == n && cur != nil {
|
||||
out.Changes[i].Title = cur.Title
|
||||
}
|
||||
}
|
||||
}
|
||||
sort.SliceStable(out.Changes, func(i, j int) bool {
|
||||
if !out.Changes[i].At.Equal(out.Changes[j].At) {
|
||||
return out.Changes[i].At.Before(out.Changes[j].At)
|
||||
}
|
||||
return out.Changes[i].Number < out.Changes[j].Number
|
||||
})
|
||||
cut := ""
|
||||
if len(out.Changes) > MostChanges {
|
||||
cut = fmt.Sprintf("; the oldest %d are left out", len(out.Changes)-MostChanges)
|
||||
out.Changes = out.Changes[len(out.Changes)-MostChanges:]
|
||||
}
|
||||
out.Said = fmt.Sprintf("%d changes of status since %s, from the tracker's log (%d entries read)%s.",
|
||||
len(out.Changes), from.Format(time.RFC3339), out.Entries, cut)
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// movedSince is every issue an operation of which was written from the window on, found in the whole log by its
|
||||
// entries' times: the first entry of the window is searched for, then the log is read on from it.
|
||||
func (t *Tracker) movedSince(from time.Time, out *ChangesRead) ([]uint64, error) {
|
||||
first, err := t.Log.Read(1, "", 1)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("the log could not be read: %v", err)
|
||||
}
|
||||
if len(first.Entries) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
lo, hi := first.Entries[0].Sequence, first.Last
|
||||
start := from.Add(-changesSlack)
|
||||
// The first sequence whose entry is at or after start: the entries are in the order they were written.
|
||||
for lo < hi {
|
||||
mid := lo + (hi-lo)/2
|
||||
p, err := t.Log.Read(mid, "", 1)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("the log could not be read at %d: %v", mid, err)
|
||||
}
|
||||
out.Entries++
|
||||
if len(p.Entries) == 0 || !p.Entries[0].At.Before(start) {
|
||||
hi = mid
|
||||
} else {
|
||||
lo = p.Entries[0].Sequence + 1
|
||||
}
|
||||
}
|
||||
seen := map[uint64]bool{}
|
||||
var numbers []uint64
|
||||
for seq := lo; seq != 0; {
|
||||
p, err := t.Log.Read(seq, "", logPage)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("the log could not be read from %d: %v", seq, err)
|
||||
}
|
||||
out.Entries += len(p.Entries)
|
||||
for _, e := range p.Entries {
|
||||
n, ok := numberOfKey(e.Key)
|
||||
if !ok || seen[n] || e.At.Before(start) || !movesStatus(e) {
|
||||
continue
|
||||
}
|
||||
seen[n] = true
|
||||
numbers = append(numbers, n)
|
||||
}
|
||||
seq = p.Next
|
||||
}
|
||||
return numbers, nil
|
||||
}
|
||||
|
||||
// movesStatus says whether a log entry may change an issue's status: one that holds the issue whole, or sets it.
|
||||
func movesStatus(e stdio.LogEntry) bool {
|
||||
var op Operation
|
||||
if json.Unmarshal(e.Value, &op) != nil {
|
||||
return true
|
||||
}
|
||||
_, sets := op.Set["status"]
|
||||
return sets || (op.Issue != nil && op.Op != OpCarried)
|
||||
}
|
||||
|
||||
// changesTool is the verb, its arguments read as the other verbs read them.
|
||||
func changesTool(t *Tracker) stdio.Tool {
|
||||
return stdio.Tool{Name: Seat + ".changes",
|
||||
Description: "Each issue's moves over a window, from the tracker's own log of every change: the issue moves history " +
|
||||
"of the last minutes or hours (since, such as 60m, at most 24h), every issue's or one's (number), each change " +
|
||||
"opened, moved, resolved or wontfix with the status it moved from and to, who moved it and when, oldest first. " +
|
||||
"What the issues are now is list and get; this is what they were before. Refused: a window of nothing or over " +
|
||||
"24h, a number that is not an issue.",
|
||||
Input: schema([]string{"since"}, map[string]any{
|
||||
"since": text("the window, back from now: 60m, 5m, 2h, at most 24h"),
|
||||
"number": number("only this issue"),
|
||||
}),
|
||||
Run: func(m map[string]any) (any, error) {
|
||||
a, err := readArgs("changes", m, "since", "number")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s, err := a.str("since")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
d, err := time.ParseDuration(strings.TrimSpace(s))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("since is a window such as 60m, 5m or 2h, not %q", s)
|
||||
}
|
||||
n, err := a.number("number", false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return t.Changes(d, n)
|
||||
}}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// changes reads the tracker's own log over a window (the lead, 2026-10-28, for knowledge-base.progress since): each
|
||||
// move from what to what, by whom and when, and each open, as the tracker's verbs wrote them into its log here.
|
||||
func TestChangesSaysEachMoveFromWhatToWhatOverAWindow(t *testing.T) {
|
||||
h := newHarness(t)
|
||||
clock := time.Date(2026, 10, 28, 9, 0, 0, 0, time.UTC)
|
||||
h.Tracker.Now = func() time.Time { return clock }
|
||||
at := func(hh, mm int) { clock = time.Date(2026, 10, 28, hh, mm, 0, 0, time.UTC); h.log.clock = clock }
|
||||
at(9, 0)
|
||||
a := h.open(t, "an issue fixed in the window", "hq")
|
||||
at(9, 10)
|
||||
b := h.open(t, "an issue given up in the window")
|
||||
at(10, 0)
|
||||
if _, err := h.Move(MoveAsk{Number: a, Status: StatusDiagnosing, By: "a@g14"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
at(10, 30)
|
||||
if _, err := h.Move(MoveAsk{Number: a, Status: StatusFixing, By: "a@g14"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
at(10, 40)
|
||||
if _, err := h.Note(a, "a note moves nothing"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
at(11, 0)
|
||||
if _, err := h.Move(MoveAsk{Number: a, Status: StatusResolved, FixedBy: []string{"hq#1"}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
at(11, 5)
|
||||
if _, err := h.Move(MoveAsk{Number: b, Status: StatusWontfix, Reason: "the module is retired"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
at(11, 30)
|
||||
say := func(r *ChangesRead) string {
|
||||
var lines []string
|
||||
for _, c := range r.Changes {
|
||||
lines = append(lines, strings.Join([]string{c.At.Format("15:04"), c.Kind, itoa(int(c.Number)), c.From + ">" + c.To, c.By + "/" + c.Worker}, " "))
|
||||
}
|
||||
return strings.Join(lines, "\n")
|
||||
}
|
||||
got, err := h.call(t, "changes", map[string]any{"since": "60m"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r := got.(*ChangesRead)
|
||||
if want := "10:30 moved 365 diagnosing>fixing " + Unproven + "/a@g14\n11:00 resolved 365 fixing>resolved " + Unproven + "/\n11:05 wontfix 366 open>wontfix " + Unproven + "/"; say(r) != want {
|
||||
t.Errorf("the last hour:\n%s\nwant\n%s", say(r), want)
|
||||
}
|
||||
if !r.Since.Equal(time.Date(2026, 10, 28, 10, 30, 0, 0, time.UTC)) || r.Changes[0].Title != "an issue fixed in the window" || !strings.Contains(r.Said, "3 changes") {
|
||||
t.Errorf("since %v, title %q, said %q", r.Since, r.Changes[0].Title, r.Said)
|
||||
}
|
||||
got, err = h.call(t, "changes", map[string]any{"since": "3h", "number": b})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if want := "09:10 opened 366 >open " + Unproven + "/\n11:05 wontfix 366 open>wontfix " + Unproven + "/"; say(got.(*ChangesRead)) != want {
|
||||
t.Errorf("one issue:\n%s", say(got.(*ChangesRead)))
|
||||
}
|
||||
raw, _ := json.Marshal(got)
|
||||
if !strings.Contains(string(raw), `"from":"open","to":"wontfix"`) {
|
||||
t.Errorf("as JSON: %s", raw)
|
||||
}
|
||||
for _, bad := range []map[string]any{{"since": "25h"}, {"since": "0m"}, {}, {"since": "60m", "number": 9999}} {
|
||||
if _, err := h.call(t, "changes", bad); err == nil {
|
||||
t.Errorf("%v was answered", bad)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -559,7 +559,7 @@ func cycleRules(is *Issue, from, to string) error {
|
||||
}
|
||||
if IsCore(is.LocatedIn) && is.Replay == "" && is.ReplayNone == "" {
|
||||
return fmt.Errorf("issue %d is a core issue (it is located in the controller, the node-engine, the tool "+
|
||||
"runner, the SDK, the delivery parts, or the catalogue's bus, forge or build modules): it resolves with replay, the replay's id "+
|
||||
"runner, the SDK, the delivery parts, or the catalog's bus, forge or build modules): it resolves with replay, the replay's id "+
|
||||
"in mesh-lab's replays register, or replay-none, why no replay is possible (ADR 0237)", is.Number)
|
||||
}
|
||||
case StatusWontfix:
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
"tracking",
|
||||
"reserve",
|
||||
"fix-times",
|
||||
"learn-fixes"
|
||||
"learn-fixes",
|
||||
"changes"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -46,7 +47,8 @@
|
||||
"tracking",
|
||||
"reserve",
|
||||
"fix-times",
|
||||
"learn-fixes"
|
||||
"learn-fixes",
|
||||
"changes"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -27,7 +27,7 @@ operator, it is accepted only on the operator's Approve, given on a channel that
|
||||
| `import` | `dry-run`, `commit` | hq's decision records and research efforts at the commit the records module stands at, each whole at its own number |
|
||||
| `return` | `number`, `reason` | drafted clauses sent back to be drafted again; refused for a record whose clauses another record changed or links by number |
|
||||
| `withdraw` | `number`, `kind`, `why` | a reserved or proposed record withdrawn, as a new version naming why; its number stays spent. A pending review is cleared and a waiting operator's ask is ended. Refused for a record already accepted, superseded or withdrawn |
|
||||
| `progress` | `of` (`mesh`, `design <n>`, `milestone <design>/<id>`, `issue <n>`, `decision <n>` or `ADR <n>`, `research <n>`), `detail` (`minimal` or `detailed`), `bound` | how far it has come (hq issue 1947): each child done ✓, moving ▶, waiting ⏸ or stuck ✗ with when it last moved, worked out from the issue tracker's rows and mesh-delivery's deliveries and groups, never written (ADR 0424 §1). `minimal` is one line per milestone, for a report every five minutes (two or three bus calls); `detailed` the report's tree with each issue's pull requests, the groups holding them and what it depends on. A design's title and state are read through the records module, cached by hq's commit; its milestones and their issues are the issue tracker's milestone records (`issue-tracker.milestones`, issue 1781), asked once per answer; a design with none is refused, naming the seed (`issue-tracker.import` with `milestones`) |
|
||||
| `progress` | `of` (`mesh`, `design <n>`, `milestone <design>/<id>`, `issue <n>`, `decision <n>` or `ADR <n>`, `research <n>`), `detail` (`minimal` or `detailed`), `bound`, `since` (a window such as `60m`, at most `24h`) | how far it has come (hq issue 1947): each child done ✓, moving ▶, waiting ⏸ or stuck ✗ with when it last moved, worked out from the issue tracker's rows and mesh-delivery's deliveries and groups, never written (ADR 0424 §1). `minimal` is one line per milestone, for a report every five minutes (two or three bus calls); `detailed` the report's tree with each issue's pull requests, the groups holding them and what it depends on. A design's title and state are read through the records module, cached by hq's commit; its milestones and their issues are the issue tracker's milestone records (`issue-tracker.milestones`, issue 1781), asked once per answer; a design with none is refused, naming the seed (`issue-tracker.import` with `milestones`). With `since`, only what changed in the window under `of`, headed "N changes in the last 60 min": milestones moved (from what to what, from `issue-tracker.milestones` `one`), issues opened or moved from what to what (from `issue-tracker.changes`, the tracker's log), noted or linked (from `issue-tracker.get`), pull requests opened, checked, merged, held or closed (from `mesh-delivery.show`'s transitions and check). It keeps no state; its warnings say when the tracker cannot answer `changes` (a move is then said by the status it reached, not from what) and that mesh-delivery keeps no time a merge reached its machines |
|
||||
|
||||
`ask`, `get`, `holds` and `history` stay within `bound` bytes (4096 unless asked for, at most 65536) and say what they cut
|
||||
and how to read the rest. The module's own tool `knowledge_health` answers its health (below).
|
||||
|
||||
@@ -34,6 +34,8 @@ type Milestone struct {
|
||||
// Status is open or closed, with its Reason; a closed milestone holding no issue is done.
|
||||
Status string
|
||||
Reason string
|
||||
// Moved is who last moved it and when, as the tracker says it; nil before its first move.
|
||||
Moved *stamp
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@@ -1130,14 +1130,19 @@ func Tools(k *KB, caller func(map[string]any) string) []stdio.Tool {
|
||||
"milestone, cheap enough for a report every five minutes; detailed gives the report's tree: each " +
|
||||
"milestone not done with its issues, their pull requests, the groups holding them and what each waits " +
|
||||
"for, for about every thirty. A design's milestones and their issues are the issue tracker's milestone " +
|
||||
"records (its milestones); a design with none is refused, naming the seed. Within a bound it states, 4 KiB unless asked for more, saying what it cut.",
|
||||
"records (its milestones); a design with none is refused, naming the seed. Within a bound it states, 4 KiB unless asked for more, saying what it cut. " +
|
||||
"With since, a window such as 60m or 5m (at most 24h), it says only the progress made since then, such as in the last hour: " +
|
||||
"the milestones and issues that moved (from what to what where the tracker keeps it), were opened, noted or resolved, " +
|
||||
"the pull requests opened, checked, merged or held and the deliveries that reached their machines, and what became stuck, " +
|
||||
"headed by how many changes in the last N minutes.",
|
||||
Input: schema([]string{"of"}, map[string]any{
|
||||
"of": text("what: mesh, design 47, milestone 47/R6, issue 1945, decision 493 (or ADR 0493) or research 72"),
|
||||
"detail": map[string]any{"type": "string", "enum": []string{DetailMinimal, DetailDetailed},
|
||||
"description": "minimal (the default): one line per child; detailed: the tree with issues, pull requests and groups"},
|
||||
"bound": boundArg()}),
|
||||
"bound": boundArg(),
|
||||
"since": text("a window such as 60m, 5m or 2h, at most 24h: only what changed in it, from the tracker's and mesh-delivery's history")}),
|
||||
Run: func(m map[string]any) (any, error) {
|
||||
a, err := readArgs("progress", m, "of", "detail", "bound")
|
||||
a, err := readArgs("progress", m, "of", "detail", "bound", "since")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1151,6 +1156,9 @@ func Tools(k *KB, caller func(map[string]any) string) []stdio.Tool {
|
||||
if p.Bound, err = a.num("bound", false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if p.Since, err = a.str("since"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return k.Progress(p)
|
||||
}},
|
||||
}
|
||||
|
||||
@@ -80,11 +80,11 @@ func TestItDeclaresAndHoldsTheKnowledgeBaseSeatOnceForTheMesh(t *testing.T) {
|
||||
}
|
||||
if !reflect.DeepEqual(m.Invokes, []string{"seat:issue-tracker.reserve", "claude-code.claude_code_judge", "claude-code.claude_code_judged", "records.records_status",
|
||||
"records.records_list", "records.records_read", "seat:operator-channel.notify", "seat:issue-tracker.list", "seat:issue-tracker.get",
|
||||
"seat:issue-tracker.milestones", "seat:mesh-delivery.deliveries", "seat:mesh-delivery.show", "seat:mesh-delivery.groups"}) {
|
||||
"seat:issue-tracker.milestones", "seat:issue-tracker.changes", "seat:mesh-delivery.deliveries", "seat:mesh-delivery.show", "seat:mesh-delivery.groups"}) {
|
||||
t.Fatalf("invokes %v", m.Invokes)
|
||||
}
|
||||
src := ""
|
||||
for _, f := range []string{"main.go", "hq.go", "progress.go", "milestones.go"} {
|
||||
for _, f := range []string{"main.go", "hq.go", "progress.go", "progress_since.go", "milestones.go"} {
|
||||
src += readFile(t, f)
|
||||
}
|
||||
for _, inv := range m.Invokes {
|
||||
|
||||
@@ -7,6 +7,7 @@ package main
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
// MilestonesVerb is the tracker's verb that answers the milestones.
|
||||
@@ -20,6 +21,13 @@ type trackerMilestone struct {
|
||||
Status string `json:"status"`
|
||||
Reason string `json:"reason"`
|
||||
Issues []int `json:"issues"`
|
||||
Moved *stamp `json:"moved"`
|
||||
}
|
||||
|
||||
// stamp is who did something and when, as the tracker says it.
|
||||
type stamp struct {
|
||||
By string `json:"by"`
|
||||
At time.Time `json:"at"`
|
||||
}
|
||||
|
||||
// withMilestones is each design with its milestones as the tracker holds them, in their table's order; design 0 asks
|
||||
@@ -41,7 +49,7 @@ func (k *KB) withMilestones(ds []*Design, design int) ([]*Design, error) {
|
||||
}
|
||||
by := map[int][]Milestone{}
|
||||
for _, m := range l.Milestones {
|
||||
by[m.Design] = append(by[m.Design], Milestone{ID: m.ID, Outcome: m.Outcome, Issues: m.Issues, Status: m.Status, Reason: m.Reason})
|
||||
by[m.Design] = append(by[m.Design], Milestone{ID: m.ID, Outcome: m.Outcome, Issues: m.Issues, Status: m.Status, Reason: m.Reason, Moved: m.Moved})
|
||||
}
|
||||
out := make([]*Design, 0, len(ds))
|
||||
for _, d := range ds {
|
||||
|
||||
@@ -56,6 +56,8 @@ type ProgressAsk struct {
|
||||
Of string
|
||||
Detail string
|
||||
Bound int
|
||||
// Since is a window, such as 60m: the answer is then only what changed in it (progress_since.go).
|
||||
Since string
|
||||
}
|
||||
|
||||
// Item is one thing whose progress is said: a design, a milestone, an issue, a pull request.
|
||||
@@ -81,6 +83,11 @@ type Progress struct {
|
||||
Source string `json:"source"`
|
||||
ReadAt time.Time `json:"read-at"`
|
||||
Cut string `json:"cut,omitempty"`
|
||||
// Since and Changes are said for an answer about a window: how long it is and how many changes it holds.
|
||||
Since string `json:"since,omitempty"`
|
||||
Changes int `json:"changes,omitempty"`
|
||||
// scope is what the answer is about, kept for a window's answer; nil without since.
|
||||
scope *sinceScope
|
||||
}
|
||||
|
||||
// trackerRow is a row of `issue-tracker.list`.
|
||||
@@ -137,9 +144,15 @@ func (k *KB) Progress(a ProgressAsk) (*Progress, error) {
|
||||
if k.Seats == nil {
|
||||
return nil, errors.New("the knowledge base reaches no other seat here")
|
||||
}
|
||||
window, err := parseSince(a.Since)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
of := strings.Join(strings.Fields(a.Of), " ")
|
||||
p := &Progress{Of: of, Detail: detail, ReadAt: k.now()}
|
||||
var err error
|
||||
if window > 0 {
|
||||
p.scope = &sinceScope{rows: map[int]trackerRow{}}
|
||||
}
|
||||
switch {
|
||||
case strings.EqualFold(of, "mesh"):
|
||||
err = k.progressMesh(p)
|
||||
@@ -168,6 +181,9 @@ func (k *KB) Progress(a ProgressAsk) (*Progress, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if window > 0 {
|
||||
k.progressSince(p, window)
|
||||
}
|
||||
// A cut takes the warnings from the last: the calls that failed are said before the answers that did not parse.
|
||||
callsFirst(p.Warnings)
|
||||
fitProgress(p, boundOf(a.Bound))
|
||||
@@ -340,8 +356,9 @@ func (k *KB) progressDesign(p *Progress, number int, milestone string) error {
|
||||
}
|
||||
items, warn := milestoneItems(ms, rows, missing)
|
||||
p.Warnings = append(p.Warnings, warn...)
|
||||
p.scope.hold(rows, ms)
|
||||
var extra *extras
|
||||
if p.Detail == DetailDetailed {
|
||||
if p.Detail == DetailDetailed && p.scope == nil {
|
||||
if extra, err = k.readExtras(items); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -394,6 +411,10 @@ func (k *KB) progressMesh(p *Progress) error {
|
||||
for _, n := range missingList {
|
||||
missing[n] = true
|
||||
}
|
||||
p.scope.hold(rows, with...)
|
||||
if p.scope != nil {
|
||||
p.scope.every = true
|
||||
}
|
||||
top := Item{ID: "mesh", Title: "the designs being built"}
|
||||
var kids []Item
|
||||
for _, d := range with {
|
||||
@@ -441,6 +462,11 @@ func (k *KB) progressIssue(p *Progress, n int) error {
|
||||
}
|
||||
it.ID = fmt.Sprintf("issue %d", n)
|
||||
p.Source = "the issue tracker and mesh-delivery"
|
||||
if p.scope != nil {
|
||||
p.scope.hold(rows)
|
||||
p.State, p.Items = it.State, []Item{it}
|
||||
return nil
|
||||
}
|
||||
extra, err := k.readExtras([]Item{{Children: []Item{{ID: strconv.Itoa(n), State: StateMoving}}}})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -513,6 +539,9 @@ func (k *KB) progressRecord(p *Progress, kind string, n int) error {
|
||||
p.Warnings = append(p.Warnings, fmt.Sprintf("%d issues are linked to %s; the first %d are counted", l.Matched, name, len(l.Rows)))
|
||||
}
|
||||
for _, r := range l.Rows {
|
||||
if p.scope != nil {
|
||||
p.scope.rows[r.Number] = r
|
||||
}
|
||||
if it, counts := issueItem(r); counts {
|
||||
kids = append(kids, it)
|
||||
}
|
||||
|
||||
@@ -58,12 +58,24 @@ func TestProgressOverTheBus(t *testing.T) {
|
||||
t.Errorf("detailed: no %q in\n%s", want, p.Tree)
|
||||
}
|
||||
}
|
||||
// A window over the bus: since is taken and the answer says how many changes it holds (none moved in the captured rows).
|
||||
raw, err = b.call(Seat+".progress", map[string]any{"of": "milestone 47/R6", "since": "60m"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_ = json.Unmarshal(raw, &p)
|
||||
if !strings.HasPrefix(p.Tree, "0 changes in the last 60 min under milestone 47/R6 (since ") || p.Since != "1h0m0s" {
|
||||
t.Errorf("since over the bus:\n%s", p.Tree)
|
||||
}
|
||||
if _, err := b.call(Seat+".progress", map[string]any{"of": "design 47", "since": "2d"}); err == nil {
|
||||
t.Error("a window of two days was taken")
|
||||
}
|
||||
if _, err := b.call(Seat+".progress", map[string]any{"of": "design 47", "by": "someone@else"}); err == nil {
|
||||
t.Error("an argument naming the caller was taken")
|
||||
}
|
||||
seats.mu.Lock()
|
||||
defer seats.mu.Unlock()
|
||||
if seats.asked["seat:issue-tracker.list"] != 2 || seats.asked["seat:mesh-delivery.groups"] != 1 || seats.asked[MilestonesVerb] != 2 {
|
||||
if seats.asked["seat:issue-tracker.list"] != 3 || seats.asked["seat:mesh-delivery.groups"] != 1 || seats.asked[MilestonesVerb] != 3 {
|
||||
t.Fatalf("asked %v", seats.asked)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,498 @@
|
||||
package main
|
||||
|
||||
// progress with since: only what changed in a window under of (the operator, 2026-10-28: "can the progress tool also
|
||||
// report the progress made since the last call, or maybe better, the last 60 minutes"). A window, not a caller's last
|
||||
// call: the knowledge base keeps no state of its own, so it reads what the other seats keep, each a request and reply
|
||||
// over the bus:
|
||||
//
|
||||
// - the issue tracker's moves over the window, from its own log (`issue-tracker.changes`): each issue opened or
|
||||
// moved, from what to what, by whom and when;
|
||||
// - the issue tracker's milestones with their last move, and a moved one's history (`issue-tracker.milestones`
|
||||
// with one): what it was before, what it is now, who moved it and when;
|
||||
// - each issue that moved in the window whole (`issue-tracker.get`): when it was opened, its notes and links with who
|
||||
// and when, its worker since when, and when it was closed;
|
||||
// - mesh-delivery's deliveries and each one's transitions and its check (`mesh-delivery.deliveries`, `.show`).
|
||||
//
|
||||
// When the tracker cannot say its moves (a tracker without `changes`), a move is said by the status it reached, with its
|
||||
// worker's since or its closed time, not from what it moved, and the answer says so. mesh-delivery keeps no time a
|
||||
// merge reached its machines, so "on the machines" is as it reads now, said too.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// MostSince is the longest window since asks: the deliveries mesh-delivery lists end a day back.
|
||||
const MostSince = 24 * time.Hour
|
||||
|
||||
// parseSince reads a window such as 60m, 5m or 2h; empty is none.
|
||||
func parseSince(s string) (time.Duration, error) {
|
||||
s = strings.TrimSpace(s)
|
||||
if s == "" {
|
||||
return 0, nil
|
||||
}
|
||||
d, err := time.ParseDuration(s)
|
||||
if err != nil || d <= 0 || d > MostSince {
|
||||
return 0, fmt.Errorf("since is a window such as 60m, 5m or 2h, more than nothing and at most %s, not %q", "24h", s)
|
||||
}
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// sinceScope is what an answer about a window is about: the issues under of, as the tracker answered their rows, and
|
||||
// the milestones; every says that of is the mesh, so every delivery counts.
|
||||
type sinceScope struct {
|
||||
rows map[int]trackerRow
|
||||
milestones []sinceMilestone
|
||||
every bool
|
||||
}
|
||||
|
||||
type sinceMilestone struct {
|
||||
design int
|
||||
m Milestone
|
||||
}
|
||||
|
||||
// hold keeps the rows and the designs' milestones for a window's answer; on a nil scope it does nothing.
|
||||
func (s *sinceScope) hold(rows map[int]trackerRow, ds ...*Design) {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
for n, r := range rows {
|
||||
s.rows[n] = r
|
||||
}
|
||||
for _, d := range ds {
|
||||
for _, m := range d.Milestones {
|
||||
s.milestones = append(s.milestones, sinceMilestone{design: d.Number, m: m})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// change is one thing that changed in the window, with its changes, newest last.
|
||||
type change struct {
|
||||
line string
|
||||
last time.Time
|
||||
events []event
|
||||
}
|
||||
|
||||
type event struct {
|
||||
at time.Time
|
||||
line string
|
||||
// brief is the event in the change's one line, when it differs from line.
|
||||
brief string
|
||||
}
|
||||
|
||||
// window is the time between from and to.
|
||||
type window struct{ from, to time.Time }
|
||||
|
||||
func (w window) holds(t time.Time) bool { return !t.IsZero() && !t.Before(w.from) && !t.After(w.to) }
|
||||
|
||||
// progressSince replaces the answer's tree with what changed in the window under p.scope.
|
||||
func (k *KB) progressSince(p *Progress, d time.Duration) {
|
||||
w := window{from: p.ReadAt.Add(-d), to: p.ReadAt}
|
||||
p.Since, p.Items = d.String(), nil
|
||||
var milestones, issues, pulls []change
|
||||
milestones = k.milestoneChanges(p, w)
|
||||
issues = k.issueChanges(p, w)
|
||||
pulls = k.pullChanges(p, w)
|
||||
for _, cs := range [][]change{milestones, issues, pulls} {
|
||||
sort.SliceStable(cs, func(i, j int) bool { return cs[i].last.After(cs[j].last) })
|
||||
}
|
||||
all := append(append(milestones, issues...), pulls...)
|
||||
for _, c := range all {
|
||||
p.Changes += len(c.events)
|
||||
}
|
||||
var b strings.Builder
|
||||
noun := "changes"
|
||||
if p.Changes == 1 {
|
||||
noun = "change"
|
||||
}
|
||||
fmt.Fprintf(&b, "%d %s in the last %d min under %s (since %s)\n", p.Changes, noun, int(d.Minutes()), p.Of, when(&w.from))
|
||||
for i, c := range all {
|
||||
branch, under := "├── ", "│ "
|
||||
if i == len(all)-1 {
|
||||
branch, under = "└── ", " "
|
||||
}
|
||||
b.WriteString(branch + c.line + "\n")
|
||||
if p.Detail != DetailDetailed {
|
||||
continue
|
||||
}
|
||||
for j, e := range c.events {
|
||||
br := "├── "
|
||||
if j == len(c.events)-1 {
|
||||
br = "└── "
|
||||
}
|
||||
b.WriteString(under + br + e.line + "\n")
|
||||
}
|
||||
}
|
||||
p.Tree = strings.TrimRight(b.String(), "\n")
|
||||
p.Source += "; the window from the tracker's milestones and their history, its issues' notes, links, workers and " +
|
||||
"closes, and mesh-delivery's transitions and checks"
|
||||
}
|
||||
|
||||
// milestoneChanges is each milestone moved in the window, from its history: what it was and what it is.
|
||||
func (k *KB) milestoneChanges(p *Progress, w window) []change {
|
||||
var out []change
|
||||
asked := 0
|
||||
for _, sm := range p.scope.milestones {
|
||||
m := sm.m
|
||||
if m.Moved == nil || !w.holds(m.Moved.At) {
|
||||
continue
|
||||
}
|
||||
ref := fmt.Sprintf("%d/%s", sm.design, m.ID)
|
||||
now := m.Status
|
||||
if m.Reason != "" {
|
||||
now += ": " + m.Reason
|
||||
}
|
||||
was := "a state its history does not say"
|
||||
if asked < MostGets {
|
||||
asked++
|
||||
if prev, err := k.milestoneBefore(ref); err != nil {
|
||||
p.Warnings = append(p.Warnings, fmt.Sprintf("issue-tracker.milestones one %s: %v; said without what it was", ref, err))
|
||||
} else if prev != "" {
|
||||
was = prev
|
||||
}
|
||||
}
|
||||
mark := marks[StateMoving]
|
||||
if m.Status == "closed" {
|
||||
mark = marks[StateDone]
|
||||
}
|
||||
line := fmt.Sprintf("%s milestone %s %s → %s · by %s %s", mark, ref, was, now, m.Moved.By, when(&m.Moved.At))
|
||||
out = append(out, change{line: line, last: m.Moved.At, events: []event{{at: m.Moved.At, line: fmt.Sprintf("moved %s by %s", when(&m.Moved.At), m.Moved.By)}}})
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// milestoneBefore is a milestone's status before its last move, from the tracker's history of it.
|
||||
func (k *KB) milestoneBefore(ref string) (string, error) {
|
||||
raw, err := k.Seats(MilestonesVerb, map[string]any{"one": ref})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
var r struct {
|
||||
History []struct {
|
||||
Status string `json:"status"`
|
||||
} `json:"history"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &r); err != nil {
|
||||
return "", fmt.Errorf("answered something else: %v", err)
|
||||
}
|
||||
if len(r.History) < 2 {
|
||||
return "", nil
|
||||
}
|
||||
return r.History[len(r.History)-2].Status, nil
|
||||
}
|
||||
|
||||
// issueGotWhole is the part of `issue-tracker.get` a window reads.
|
||||
type issueGotWhole struct {
|
||||
Status string `json:"status"`
|
||||
Opened time.Time `json:"opened"`
|
||||
OpenedBy string `json:"opened-by"`
|
||||
Closed *time.Time `json:"closed"`
|
||||
FixedBy []string `json:"fixed-by"`
|
||||
Worker *struct {
|
||||
By string `json:"by"`
|
||||
Since time.Time `json:"since"`
|
||||
} `json:"worker"`
|
||||
Notes []struct {
|
||||
At time.Time `json:"at"`
|
||||
By string `json:"by"`
|
||||
Text string `json:"text"`
|
||||
} `json:"notes"`
|
||||
Links []struct {
|
||||
At time.Time `json:"at"`
|
||||
By string `json:"by"`
|
||||
Kind string `json:"kind"`
|
||||
Target string `json:"target"`
|
||||
} `json:"links"`
|
||||
}
|
||||
|
||||
// issueChanges is each issue under of that moved in the window, read whole: opened, moved, noted, linked, closed.
|
||||
func (k *KB) issueChanges(p *Progress, w window) []change {
|
||||
var moved []trackerRow
|
||||
for _, r := range p.scope.rows {
|
||||
if r.Moved != nil && w.holds(*r.Moved) {
|
||||
moved = append(moved, r)
|
||||
}
|
||||
}
|
||||
sort.Slice(moved, func(i, j int) bool { return moved[i].Moved.After(*moved[j].Moved) })
|
||||
var moves map[int][]trackerMove
|
||||
var merr error
|
||||
if len(moved) > 0 {
|
||||
if moves, merr = k.trackerMoves(w); merr != nil {
|
||||
p.Warnings = append(p.Warnings, fmt.Sprintf("issue-tracker.changes: %v; a move is said by the status it reached, "+
|
||||
"its worker's since and its closed time, not from what it moved", merr))
|
||||
}
|
||||
}
|
||||
var out []change
|
||||
for i, r := range moved {
|
||||
it, _ := issueItem(r)
|
||||
if it.State == "" {
|
||||
it.State = StateDone
|
||||
}
|
||||
head := fmt.Sprintf("%s %d %s — ", marks[it.State], r.Number, clip(r.Title, 80))
|
||||
fallback := func(why string) {
|
||||
p.Warnings = append(p.Warnings, why)
|
||||
line := fmt.Sprintf("moved %s, now %s", when(r.Moved), r.Status)
|
||||
if r.Worker != "" {
|
||||
line += " (" + r.Worker + ")"
|
||||
}
|
||||
out = append(out, change{line: head + line, last: *r.Moved, events: []event{{at: *r.Moved, line: line}}})
|
||||
}
|
||||
if i >= MostGets {
|
||||
fallback(fmt.Sprintf("more than %d issues moved; the rest are said by their rows' moved time", MostGets))
|
||||
continue
|
||||
}
|
||||
raw, err := k.Seats("seat:issue-tracker.get", map[string]any{"number": r.Number})
|
||||
if err != nil {
|
||||
fallback(fmt.Sprintf("issue-tracker.get %d: %v; said by its row's moved time", r.Number, err))
|
||||
continue
|
||||
}
|
||||
var g issueGotWhole
|
||||
if err := json.Unmarshal(raw, &g); err != nil {
|
||||
fallback(fmt.Sprintf("issue-tracker.get %d answered something else: %v; said by its row's moved time", r.Number, err))
|
||||
continue
|
||||
}
|
||||
var evs []event
|
||||
var says []string
|
||||
if merr == nil {
|
||||
for _, m := range moves[r.Number] {
|
||||
if m.Kind == "opened" || m.Kind == "imported" {
|
||||
evs = append(evs, event{at: m.At, line: fmt.Sprintf("%s %s by %s", m.Kind, when(&m.At), m.By)})
|
||||
says = append(says, m.Kind+" by "+m.By+" "+when(&m.At))
|
||||
continue
|
||||
}
|
||||
who, line := m.By, fmt.Sprintf("%s → %s %s by %s", m.From, m.To, when(&m.At), m.By)
|
||||
if m.Worker != "" {
|
||||
who, line = m.Worker, line+", worker "+m.Worker
|
||||
}
|
||||
short := fmt.Sprintf("%s → %s by %s %s", m.From, m.To, who, when(&m.At))
|
||||
if (m.To == "resolved" || m.To == "wontfix") && len(g.FixedBy) > 0 {
|
||||
short += ", fixed by " + strings.Join(g.FixedBy, ", ")
|
||||
}
|
||||
evs = append(evs, event{at: m.At, line: line})
|
||||
says = append(says, short)
|
||||
}
|
||||
}
|
||||
if merr != nil && w.holds(g.Opened) {
|
||||
evs = append(evs, event{at: g.Opened, line: fmt.Sprintf("opened %s by %s", when(&g.Opened), g.OpenedBy)})
|
||||
says = append(says, "opened by "+g.OpenedBy+" "+when(&g.Opened))
|
||||
}
|
||||
if merr != nil && g.Worker != nil && w.holds(g.Worker.Since) && (g.Status == "diagnosing" || g.Status == "fixing") {
|
||||
s := fmt.Sprintf("→ %s by %s %s", g.Status, g.Worker.By, when(&g.Worker.Since))
|
||||
evs = append(evs, event{at: g.Worker.Since, line: s})
|
||||
says = append(says, s)
|
||||
}
|
||||
if merr != nil && g.Closed != nil && w.holds(*g.Closed) {
|
||||
s := fmt.Sprintf("→ %s %s", g.Status, when(g.Closed))
|
||||
if len(g.FixedBy) > 0 {
|
||||
s += ", fixed by " + strings.Join(g.FixedBy, ", ")
|
||||
}
|
||||
evs = append(evs, event{at: *g.Closed, line: s})
|
||||
says = append(says, s)
|
||||
}
|
||||
notes := 0
|
||||
var last string
|
||||
for _, n := range g.Notes {
|
||||
if w.holds(n.At) {
|
||||
notes++
|
||||
last = fmt.Sprintf("the last %s by %s", when(&n.At), n.By)
|
||||
evs = append(evs, event{at: n.At, line: fmt.Sprintf("noted %s by %s: %s", when(&n.At), n.By, clip(n.Text, 80))})
|
||||
}
|
||||
}
|
||||
if notes == 1 {
|
||||
says = append(says, "1 note, "+last)
|
||||
} else if notes > 1 {
|
||||
says = append(says, fmt.Sprintf("%d notes, %s", notes, last))
|
||||
}
|
||||
links := 0
|
||||
for _, l := range g.Links {
|
||||
if w.holds(l.At) {
|
||||
links++
|
||||
evs = append(evs, event{at: l.At, line: fmt.Sprintf("linked %s %s by %s %s", l.Kind, l.Target, l.By, when(&l.At))})
|
||||
}
|
||||
}
|
||||
if links > 0 {
|
||||
says = append(says, fmt.Sprintf("%d links", links))
|
||||
}
|
||||
if len(evs) == 0 {
|
||||
// It moved by what the tracker records of nobody: its fix's delivery said a new state.
|
||||
s := fmt.Sprintf("moved %s, now %s", when(r.Moved), it.Why)
|
||||
evs, says = []event{{at: *r.Moved, line: s}}, []string{s}
|
||||
}
|
||||
if it.State == StateStuck {
|
||||
says = append(says, "stuck: "+it.Why)
|
||||
}
|
||||
sort.SliceStable(evs, func(i, j int) bool { return evs[i].at.Before(evs[j].at) })
|
||||
out = append(out, change{line: head + strings.Join(says, "; "), last: *r.Moved, events: evs})
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// deliveryWhole is the part of `mesh-delivery.show` a window reads.
|
||||
type deliveryWhole struct {
|
||||
Delivery struct {
|
||||
Repository string `json:"repository"`
|
||||
Number int `json:"number"`
|
||||
Issues []int `json:"issues"`
|
||||
State string `json:"state"`
|
||||
Check *struct {
|
||||
At time.Time `json:"at"`
|
||||
Gate string `json:"gate"`
|
||||
Summary string `json:"summary"`
|
||||
} `json:"check"`
|
||||
Transitions []struct {
|
||||
At time.Time `json:"at"`
|
||||
Event string `json:"event"`
|
||||
To string `json:"to"`
|
||||
Why string `json:"why"`
|
||||
} `json:"transitions"`
|
||||
} `json:"delivery"`
|
||||
Machines string `json:"machines"`
|
||||
Waits string `json:"waits"`
|
||||
}
|
||||
|
||||
// pullChanges is each pull request naming an issue under of (every one, for the mesh) that was opened, checked,
|
||||
// merged, held or closed in the window.
|
||||
func (k *KB) pullChanges(p *Progress, w window) []change {
|
||||
raw, err := k.Seats("seat:mesh-delivery.deliveries", map[string]any{})
|
||||
if err != nil {
|
||||
p.Warnings = append(p.Warnings, fmt.Sprintf("mesh-delivery does not answer, so no pull request is said: %v", err))
|
||||
return nil
|
||||
}
|
||||
var dl struct {
|
||||
Deliveries []deliveryRow `json:"deliveries"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &dl); err != nil {
|
||||
p.Warnings = append(p.Warnings, fmt.Sprintf("mesh-delivery.deliveries answered something else, so no pull request is said: %v", err))
|
||||
return nil
|
||||
}
|
||||
var out []change
|
||||
shown, reached := 0, false
|
||||
for _, d := range dl.Deliveries {
|
||||
// A delivery's since is its last transition; one not final may still have been checked since.
|
||||
if final(d.State) && !w.holds(d.Since) {
|
||||
continue
|
||||
}
|
||||
if shown == MostShows {
|
||||
p.Warnings = append(p.Warnings, fmt.Sprintf("more than %d deliveries moved; the rest are not read", MostShows))
|
||||
break
|
||||
}
|
||||
shown++
|
||||
raw, err := k.Seats("seat:mesh-delivery.show", map[string]any{"id": d.ID})
|
||||
if err != nil {
|
||||
p.Warnings = append(p.Warnings, fmt.Sprintf("mesh-delivery.show %s: %v", d.ID, err))
|
||||
continue
|
||||
}
|
||||
var s deliveryWhole
|
||||
if err := json.Unmarshal(raw, &s); err != nil {
|
||||
p.Warnings = append(p.Warnings, fmt.Sprintf("mesh-delivery.show %s answered something else: %v", d.ID, err))
|
||||
continue
|
||||
}
|
||||
under := p.scope.every
|
||||
var names []string
|
||||
for _, n := range s.Delivery.Issues {
|
||||
names = append(names, strconv.Itoa(n))
|
||||
if _, ok := p.scope.rows[n]; ok {
|
||||
under = true
|
||||
}
|
||||
}
|
||||
if !under {
|
||||
continue
|
||||
}
|
||||
var evs []event
|
||||
for _, t := range s.Delivery.Transitions {
|
||||
if !w.holds(t.At) {
|
||||
continue
|
||||
}
|
||||
switch {
|
||||
case t.Event == "announced":
|
||||
evs = append(evs, event{at: t.At, line: "opened " + when(&t.At)})
|
||||
case t.To == "merged" || t.To == "closed" || strings.HasPrefix(t.To, "held") || t.To == "delivered":
|
||||
evs = append(evs, event{t.At, fmt.Sprintf("%s %s: %s", t.To, when(&t.At), clip(t.Why, 80)), t.To + " " + when(&t.At)})
|
||||
}
|
||||
}
|
||||
if c := s.Delivery.Check; c != nil && w.holds(c.At) {
|
||||
evs = append(evs, event{c.At, fmt.Sprintf("check %s %s: %s", c.Gate, when(&c.At), clip(c.Summary, 80)), fmt.Sprintf("check %s %s", c.Gate, when(&c.At))})
|
||||
}
|
||||
if len(evs) == 0 {
|
||||
continue
|
||||
}
|
||||
sort.SliceStable(evs, func(i, j int) bool { return evs[i].at.Before(evs[j].at) })
|
||||
var says []string
|
||||
for _, e := range evs {
|
||||
if e.brief != "" {
|
||||
says = append(says, e.brief)
|
||||
} else {
|
||||
says = append(says, e.line)
|
||||
}
|
||||
}
|
||||
state := s.Delivery.State
|
||||
mark := marks[StateMoving]
|
||||
switch {
|
||||
case state == "merged" || state == "delivered":
|
||||
mark = marks[StateDone]
|
||||
case strings.HasPrefix(state, "held"):
|
||||
mark = marks[StateStuck]
|
||||
case state == "closed":
|
||||
mark = marks[StateWaiting]
|
||||
}
|
||||
repo := s.Delivery.Repository
|
||||
if i := strings.LastIndex(repo, "/"); i >= 0 {
|
||||
repo = repo[i+1:]
|
||||
}
|
||||
line := fmt.Sprintf("%s %s#%d (%s) %s", mark, repo, s.Delivery.Number, strings.Join(names, ", "), strings.Join(says, " · "))
|
||||
switch {
|
||||
case state == "merged" && s.Machines != "":
|
||||
line += ", " + s.Machines
|
||||
reached = true
|
||||
case !final(state):
|
||||
line += ", now " + state
|
||||
if s.Waits != "" {
|
||||
line += ", waits for " + s.Waits
|
||||
}
|
||||
}
|
||||
out = append(out, change{line: line, last: evs[len(evs)-1].at, events: evs})
|
||||
}
|
||||
if reached {
|
||||
p.Warnings = append(p.Warnings, "mesh-delivery keeps no time a merge reached its machines: \"on the machines\" is as it reads now")
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// trackerMove is one change of `issue-tracker.changes`: an issue opened or moved, from what to what, by whom and when.
|
||||
type trackerMove struct {
|
||||
Number int `json:"number"`
|
||||
Kind string `json:"kind"`
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
By string `json:"by"`
|
||||
Worker string `json:"worker"`
|
||||
At time.Time `json:"at"`
|
||||
}
|
||||
|
||||
// trackerMoves asks the tracker for every issue's moves in the window, from its own log, by issue, oldest first.
|
||||
func (k *KB) trackerMoves(w window) (map[int][]trackerMove, error) {
|
||||
raw, err := k.Seats(ChangesVerb, map[string]any{"since": w.to.Sub(w.from).String()})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var r struct {
|
||||
Changes []trackerMove `json:"changes"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &r); err != nil {
|
||||
return nil, fmt.Errorf("answered something else: %v", err)
|
||||
}
|
||||
out := map[int][]trackerMove{}
|
||||
for _, m := range r.Changes {
|
||||
if w.holds(m.At) {
|
||||
out[m.Number] = append(out[m.Number], m)
|
||||
}
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ChangesVerb is the tracker's verb that answers its issues' moves over a window.
|
||||
const ChangesVerb = "seat:issue-tracker.changes"
|
||||
@@ -2,6 +2,8 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
@@ -393,3 +395,150 @@ func TestProgressOfAnIssueAndARecord(t *testing.T) {
|
||||
t.Error("an issue the tracker does not hold was answered")
|
||||
}
|
||||
}
|
||||
|
||||
// sinceWorld plays the tracker and the delivery seat from what they answered on 2026-10-28 (testdata/progress/since):
|
||||
// a get or a show it holds no answer for is refused, as a seat that cannot answer. The tracker's changes answers what
|
||||
// mesh-issues' verb made of 1422's open and move to fixing (testdata/progress/README.md); without changes it is
|
||||
// refused, as by a tracker that has no such verb yet.
|
||||
func sinceWorld(t *testing.T, changes bool) func(string, any) (json.RawMessage, error) {
|
||||
t.Helper()
|
||||
read := func(name string) json.RawMessage { return readFixture(t, filepath.Join("since", name)) }
|
||||
var rows []json.RawMessage
|
||||
if err := json.Unmarshal(read("rows.json"), &rows); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
byNumber := map[int]json.RawMessage{}
|
||||
for _, r := range rows {
|
||||
var n struct{ Number int }
|
||||
_ = json.Unmarshal(r, &n)
|
||||
byNumber[n.Number] = r
|
||||
}
|
||||
shows := map[string]string{"novox/mesh-catalog@470687ea4cce": "show-mesh-catalog-539.json", "novox/mesh-catalog@f5d4b2f86ed4": "show-mesh-catalog-537.json",
|
||||
"novox/mesh-delivery@2b801f5bd49a": "show-mesh-delivery-94.json", "novox/de-spiegel@fba6dbe3259e": "show-de-spiegel-6.json"}
|
||||
return func(key string, body any) (json.RawMessage, error) {
|
||||
raw, _ := json.Marshal(body)
|
||||
var a struct {
|
||||
Numbers []int `json:"numbers"`
|
||||
Number int `json:"number"`
|
||||
ID string `json:"id"`
|
||||
One string `json:"one"`
|
||||
}
|
||||
_ = json.Unmarshal(raw, &a)
|
||||
switch key {
|
||||
case MilestonesVerb:
|
||||
return read("milestone-47-6.json"), nil
|
||||
case "seat:issue-tracker.list":
|
||||
var out []json.RawMessage
|
||||
for _, n := range a.Numbers {
|
||||
if r, ok := byNumber[n]; ok {
|
||||
out = append(out, r)
|
||||
}
|
||||
}
|
||||
return json.Marshal(map[string]any{"rows": out, "matched": len(out)})
|
||||
case "seat:issue-tracker.changes":
|
||||
if changes {
|
||||
return read("changes.json"), nil
|
||||
}
|
||||
return nil, errors.New("mesh-issues has no tool issue-tracker.changes")
|
||||
case "seat:issue-tracker.get":
|
||||
if a.Number == 1422 || a.Number == 1956 {
|
||||
return read(fmt.Sprintf("get-%d.json", a.Number)), nil
|
||||
}
|
||||
case "seat:mesh-delivery.deliveries":
|
||||
return read("deliveries.json"), nil
|
||||
case "seat:mesh-delivery.groups":
|
||||
return json.RawMessage(`[]`), nil
|
||||
case "seat:mesh-delivery.show":
|
||||
if f, ok := shows[a.ID]; ok {
|
||||
return read(f), nil
|
||||
}
|
||||
}
|
||||
return nil, os.ErrNotExist
|
||||
}
|
||||
}
|
||||
|
||||
// The operator, 2026-10-28: "can the progress tool also report the progress made since the last call, or maybe better,
|
||||
// the last 60 minutes". With since, an answer lists only what changed in that window under of, read from the
|
||||
// tracker's notes, links, workers and closes, its milestones' history and mesh-delivery's transitions and checks.
|
||||
func TestProgressSinceAWindowSaysOnlyWhatChanged(t *testing.T) {
|
||||
at := func(s string) *time.Time { v, _ := time.Parse(time.RFC3339, s); return &v }
|
||||
k := &KB{Records: progressRecords(), Seats: sinceWorld(t, true), Now: func() time.Time { return *at("2026-10-28T11:13:30Z") }}
|
||||
p, err := k.Progress(ProgressAsk{Of: "issue 1422", Since: "2h"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
lines := strings.Split(p.Tree, "\n")
|
||||
if lines[0] != "17 changes in the last 120 min under issue 1422 (since "+when(at("2026-10-28T09:13:30Z"))+")" || p.Changes != 17 || p.Since != "2h0m0s" {
|
||||
t.Fatalf("%d changes, since %q:\n%s", p.Changes, p.Since, p.Tree)
|
||||
}
|
||||
for _, want := range []string{
|
||||
"▶ 1422 " + clip("The catch-up reads the trunk 'main' of repositories the catalogue follows by another branch or by a commit, and the forge holds none", 80) + " — open → fixing by fix-trunk-unknown@shanks " + when(at("2026-10-28T09:38:37Z")) +
|
||||
"; 9 notes, the last " + when(at("2026-10-28T11:05:21Z")) + " by shanks.node-tools",
|
||||
"✓ mesh-catalog#537 (1422) opened " + when(at("2026-10-28T10:20:56Z")) + " · check pass " + when(at("2026-10-28T10:30:45Z")) + " · merged " + when(at("2026-10-28T10:34:49Z")) + ", on the machines",
|
||||
"✓ mesh-delivery#94 (1126, 1422) opened ",
|
||||
"▶ mesh-catalog#539 (1422, 1956) opened " + when(at("2026-10-28T11:07:42Z")) + ", now ready, waits for its merge",
|
||||
} {
|
||||
if !strings.Contains(p.Tree, want) {
|
||||
t.Errorf("no %q in\n%s", want, p.Tree)
|
||||
}
|
||||
}
|
||||
if strings.Contains(p.Tree, "de-spiegel") || strings.Contains(p.Tree, "triage") {
|
||||
t.Errorf("a change outside issue 1422 or the window is said:\n%s", p.Tree)
|
||||
}
|
||||
w := strings.Join(p.Warnings, "\n")
|
||||
if !strings.Contains(w, "keeps no time a merge reached its machines") || strings.Contains(w, "issue-tracker.changes") {
|
||||
t.Errorf("the warnings: %v", p.Warnings)
|
||||
}
|
||||
// A tracker that cannot say its moves: each is said by the status it reached, and that is said.
|
||||
old := &KB{Records: progressRecords(), Seats: sinceWorld(t, false), Now: k.Now}
|
||||
o, err := old.Progress(ProgressAsk{Of: "issue 1422", Since: "2h"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(o.Tree, " — → fixing by fix-trunk-unknown@shanks "+when(at("2026-10-28T09:38:37Z"))) || o.Changes != 17 ||
|
||||
!strings.Contains(strings.Join(o.Warnings, "\n"), "issue-tracker.changes: mesh-issues has no tool issue-tracker.changes; a move is said by the status it reached") {
|
||||
t.Errorf("without changes:\n%s\n%v", o.Tree, o.Warnings)
|
||||
}
|
||||
d, err := k.Progress(ProgressAsk{Of: "issue 1422", Since: "2h", Detail: DetailDetailed})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, want := range []string{"│ ├── open → fixing " + when(at("2026-10-28T09:38:37Z")) + " by shanks.node-tools, worker fix-trunk-unknown@shanks",
|
||||
"│ ├── noted " + when(at("2026-10-28T09:38:09Z")) + " by shanks.node-tools: lead-47@shanks 2026-10-28 09:40Z.",
|
||||
" └── merged " + when(at("2026-10-28T10:34:49Z")) + ": on the trunk its modules follow: merged there"} {
|
||||
if !strings.Contains(d.Tree, want) {
|
||||
t.Errorf("detailed: no %q in\n%s", want, d.Tree)
|
||||
}
|
||||
}
|
||||
// A milestone's issue the tracker's get cannot answer falls back to its row's moved time, said as such.
|
||||
m, err := k.Progress(ProgressAsk{Of: "milestone 47/L2", Since: "60m"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, want := range []string{"6 changes in the last 60 min under milestone 47/L2", "▶ 1126 " + clip("About 49,800 controller code lines stay after the delivery model, against a first limit of 25,000", 80) + " — moved " +
|
||||
when(at("2026-10-28T11:13:28Z")) + ", now fixing (lead-47@shanks)", "✓ de-spiegel#6 (1126) check pass ", "✓ mesh-delivery#94 (1126, 1422) opened "} {
|
||||
if !strings.Contains(m.Tree, want) {
|
||||
t.Errorf("milestone: no %q in\n%s", want, m.Tree)
|
||||
}
|
||||
}
|
||||
if w := strings.Join(m.Warnings, "\n"); !strings.Contains(w, "issue-tracker.get 1126") {
|
||||
t.Errorf("the fallback is not said: %v", m.Warnings)
|
||||
}
|
||||
if small, _ := k.Progress(ProgressAsk{Of: "issue 1422", Since: "2h", Detail: DetailDetailed, Bound: LeastBound}); small == nil || size(small) > LeastBound || !strings.Contains(small.Cut, "raise bound") {
|
||||
t.Errorf("a window's answer is not kept within its bound: %+v", small)
|
||||
}
|
||||
// A milestone's move, from its history: what it was before, what it is now, who moved it and when.
|
||||
k.Now = func() time.Time { return *at("2026-10-26T18:40:00Z") }
|
||||
ds, err := k.Progress(ProgressAsk{Of: "design 47", Since: "60m"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if ds.Tree != "1 change in the last 60 min under design 47 (since "+when(at("2026-10-26T17:40:00Z"))+")\n└── ✓ milestone 47/6 open → closed: folded into R4g · by shanks.node-tools "+when(at("2026-10-26T18:10:10Z")) {
|
||||
t.Errorf("design:\n%s", ds.Tree)
|
||||
}
|
||||
for _, bad := range []string{"0m", "-5m", "25h", "a day", "5"} {
|
||||
if _, err := k.Progress(ProgressAsk{Of: "issue 1422", Since: bad}); err == nil || !strings.Contains(err.Error(), "since") {
|
||||
t.Errorf("since %q: %v", bad, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,3 +8,12 @@ Captured for the progress verb's tests (novox/hq issue 1947), never written by h
|
||||
- `tracker-milestones-47.json`: the answer of `issue-tracker.milestones` for design 47 (issue 1781), made by running
|
||||
the tracker's own table parse (mesh-issues `parseTable`, its seed) over `hq/`'s design 47, each issue two rows name
|
||||
left in neither, as the seed refuses it; the tracker held no milestone records yet to capture from.
|
||||
- `since/`: answers of the live tracker and delivery seat on 2026-10-28 between 11:10Z and 11:20Z, for `since`
|
||||
(issue 1422 and its pull requests): `issue-tracker.list` rows, `issue-tracker.get` 1422 and 1956 (the report,
|
||||
the triage and each note's text after its first sentence or two cut), `mesh-delivery.deliveries` (its first ten
|
||||
rows) and `.show` of four deliveries (the ready record, the ask and the paths cut), and `issue-tracker.milestones`
|
||||
with `one` 47/6, its milestones joined by 47/L2's row from `one` 47/L2.
|
||||
- `since/changes.json`: the answer of mesh-issues' `issue-tracker.changes` (window 2h at 2026-10-28 11:13:30Z) made by
|
||||
the tracker's own code over its log, replaying issue 1422's open (10-20 14:36:07Z) and its move to fixing by
|
||||
fix-trunk-unknown@shanks (10-28 09:38:37Z) through its verbs: the live verb was not delivered yet to capture from, and
|
||||
the status 1422 moved from (open) is the replay's, as no verb read the live log then. Recapture once it is delivered.
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"since": "2026-10-28T09:13:30Z",
|
||||
"changes": [
|
||||
{
|
||||
"number": 1422,
|
||||
"title": "The catch-up reads the trunk 'main' of repositories the catalogue follows by another branch or by a commit, and the forge holds none",
|
||||
"kind": "moved",
|
||||
"from": "open",
|
||||
"to": "fixing",
|
||||
"by": "shanks.node-tools",
|
||||
"worker": "fix-trunk-unknown@shanks",
|
||||
"at": "2026-10-28T09:38:37Z"
|
||||
}
|
||||
],
|
||||
"entries-read": 4,
|
||||
"said": "1 changes of status since 2026-10-28T09:13:30Z, from the tracker's log (4 entries read)."
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{"deliveries": [
|
||||
{"for": "4m8s", "id": "novox/mesh-catalog@470687ea4cce", "number": 539, "since": "2026-10-28T11:07:43Z", "state": "ready", "waits": "its merge"},
|
||||
{"for": "14m17s", "id": "novox/mesh-catalog@fc5335360967", "number": 538, "since": "2026-10-28T10:57:33Z", "state": "closed"},
|
||||
{"for": "26m23s", "id": "novox/de-spiegel@fba6dbe3259e", "machines": "on the machines", "number": 6, "since": "2026-10-28T10:45:28Z", "state": "merged"},
|
||||
{"for": "36m56s", "group": "fix/1422-trunk-unknown", "id": "novox/mesh-delivery@2b801f5bd49a", "machines": "on the machines", "number": 94, "since": "2026-10-28T10:34:54Z", "state": "merged"},
|
||||
{"for": "37m2s", "group": "fix/1422-trunk-unknown", "id": "novox/mesh-catalog@f5d4b2f86ed4", "machines": "on the machines", "number": 537, "since": "2026-10-28T10:34:49Z", "state": "merged"},
|
||||
{"for": "56m30s", "id": "novox/hq@dd36b7557ae6", "machines": "on the machines", "number": 489, "since": "2026-10-28T10:15:20Z", "state": "merged"},
|
||||
{"for": "1h3m4s", "id": "novox/mesh-host@6502ba6ad6e6", "machines": "on the machines", "number": 159, "since": "2026-10-28T10:08:47Z", "state": "merged"},
|
||||
{"for": "1h24m56s", "group": "fix/1126-seed-same", "id": "novox/mesh-host@c912bcab6e73", "machines": "on the machines", "number": 158, "since": "2026-10-28T09:46:55Z", "state": "merged"},
|
||||
{"for": "2h51m31s", "id": "novox/mesh-catalog@c2606f99178a", "number": 534, "since": "2026-10-28T08:20:20Z", "state": "closed"},
|
||||
{"for": "3h25m11s", "group": "fix/1126-shadow-bodies", "id": "novox/mesh-host@82d0e125b2c0", "machines": "on the machines", "number": 157, "since": "2026-10-28T07:46:40Z", "state": "merged"}
|
||||
]}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"fixing-from": "2026-10-28T09:38:37Z",
|
||||
"links": [
|
||||
{"at": "2026-10-20T14:37:00Z", "by": "triage", "kind": "relates-to", "target": "1421"},
|
||||
{"at": "2026-10-20T14:37:00Z", "by": "triage", "kind": "relates-to", "target": "1420"}
|
||||
],
|
||||
"located-in": ["mesh-controller cmd/mesh-controller/catch_up.go"],
|
||||
"needs": "none",
|
||||
"notes": [
|
||||
{"at": "2026-10-20T14:37:00Z", "by": "triage", "text": "Triage of this issue: none of 429 older issues not resolved (the 429 most recent of 493; the titles of the rest did not fit the question) asks the same question."},
|
||||
{"at": "2026-10-20T14:44:57Z", "by": "triage", "text": "Triage: issue 1424 relates to this one, opened later."},
|
||||
{"at": "2026-10-20T14:45:10Z", "by": "triage", "text": "Triage: issue 1425 relates to this one, opened later."},
|
||||
{"at": "2026-10-28T09:38:09Z", "by": "shanks.node-tools", "text": "lead-47@shanks 2026-10-28 09:40Z. New kind beside this issue (diag-despiegel-check@shanks): the checker judges a pull request only when the gate's source.main names its repository"},
|
||||
{"at": "2026-10-28T09:43:50Z", "by": "shanks.node-tools", "text": "fix-trunk-unknown@shanks, 2026-10-28. Quick fix: the checker says loudly that a pull request cannot be judged when source.main names no trunk head of its repository."},
|
||||
{"at": "2026-10-28T09:51:00Z", "by": "shanks.node-tools", "text": "fix-trunk-unknown@shanks, 2026-10-28, part (b) built locally, not pushed."},
|
||||
{"at": "2026-10-28T10:00:02Z", "by": "shanks.node-tools", "text": "lead-47@shanks 2026-10-28 10:05Z. de-spiegel to main (the operator, 09:58Z: 'yes use the main branch please')."},
|
||||
{"at": "2026-10-28T10:07:56Z", "by": "shanks.node-tools", "text": "lead-47@shanks 2026-10-28 10:10Z. Side finding (tools-gitea-base@shanks): modules/gitea guard.ts and gitea_api's refusal text cite 'ADR 0266'"},
|
||||
{"at": "2026-10-28T10:40:43Z", "by": "shanks.node-tools", "text": "lead-47@shanks 2026-10-28 10:41Z. Fix group delivered in part (gate 4c091b08, gitea a6cc3509 on novox at 10:39Z; indexer applying; bridge and checker pending)."},
|
||||
{"at": "2026-10-28T10:44:38Z", "by": "shanks.node-tools", "text": "lead-47@shanks 2026-10-28 10:46Z. Subtask (the operator asked why a retarget waits for a poll)"},
|
||||
{"at": "2026-10-28T10:45:16Z", "by": "shanks.node-tools", "text": "lead-47@shanks 2026-10-28 10:49Z. Correction to note 10"},
|
||||
{"at": "2026-10-28T11:05:21Z", "by": "shanks.node-tools", "text": "Gitea polling, quick versus thorough (fix-gitea-events@shanks, branch fix/1422-gitea-events, commit 470687ea)."}
|
||||
],
|
||||
"number": 1422,
|
||||
"opened": "2026-10-20T14:36:07Z",
|
||||
"opened-by": "shanks.node-tools",
|
||||
"ready": true,
|
||||
"severity": "minor",
|
||||
"status": "fixing",
|
||||
"title": "The catch-up reads the trunk 'main' of repositories the catalogue follows by another branch or by a commit, and the forge holds none",
|
||||
"worker": {"active": "2026-10-28T11:05:21Z", "by": "fix-trunk-unknown@shanks", "since": "2026-10-28T09:38:37Z"}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"links": [
|
||||
{"at": "2026-10-28T11:07:31Z", "by": "triage", "kind": "relates-to", "target": "1903"},
|
||||
{"at": "2026-10-28T11:07:31Z", "by": "triage", "kind": "relates-to", "target": "1327"},
|
||||
{"at": "2026-10-28T11:07:31Z", "by": "triage", "kind": "relates-to", "target": "1420"},
|
||||
{"at": "2026-10-28T11:07:31Z", "by": "triage", "kind": "relates-to", "target": "1184"}
|
||||
],
|
||||
"needs": "decision",
|
||||
"notes": [
|
||||
{"at": "2026-10-28T11:07:31Z", "by": "triage", "text": "Triage of this issue: not a duplicate; closest is 1903."}
|
||||
],
|
||||
"number": 1956,
|
||||
"opened": "2026-10-28T11:07:10Z",
|
||||
"opened-by": "shanks.node-tools",
|
||||
"ready": true,
|
||||
"severity": "major",
|
||||
"status": "open",
|
||||
"title": "Parts of the mesh still poll or wait on timers instead of reacting to events on the bus"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
{"history": [
|
||||
{"design": 47, "id": "6", "made": {"at": "2026-10-26T18:09:47Z", "by": "shanks.node-tools"}, "order": 9, "outcome": "Folded into release 4 by ADR 0429 §10 (the fetch over SSH in R4c, the cut-over in R4e): installed toolchains, builders fetching over SSH with their own key, and an SDK change shipping with its users are built in the builder's new home, so the builder is changed once", "status": "open"},
|
||||
{"design": 47, "id": "6", "made": {"at": "2026-10-26T18:09:47Z", "by": "shanks.node-tools"}, "moved": {"at": "2026-10-26T18:10:10Z", "by": "shanks.node-tools"}, "order": 9, "outcome": "Folded into release 4 by ADR 0429 §10 (the fetch over SSH in R4c, the cut-over in R4e): installed toolchains, builders fetching over SSH with their own key, and an SDK change shipping with its users are built in the builder's new home, so the builder is changed once", "reason": "folded into R4g", "status": "closed"}
|
||||
],
|
||||
"milestones": [
|
||||
{"design": 47, "done": 0, "id": "6", "issues": [], "made": {"at": "2026-10-26T18:09:47Z", "by": "shanks.node-tools"}, "moved": {"at": "2026-10-26T18:10:10Z", "by": "shanks.node-tools"}, "order": 9, "outcome": "Folded into release 4 by ADR 0429 §10 (the fetch over SSH in R4c, the cut-over in R4e): installed toolchains, builders fetching over SSH with their own key, and an SDK change shipping with its users are built in the builder's new home, so the builder is changed once", "reason": "folded into R4g", "ref": "47/6", "status": "closed"},
|
||||
{"design": 47, "done": 0, "id": "L2", "issues": [1126], "made": {"at": "2026-10-26T18:09:47Z", "by": "shanks.node-tools"}, "order": 31, "outcome": "Nodes compose: each node agent composes its own modules, and no node applies a composition made elsewhere but the bus's user list (ADR 0547 §11)", "ref": "47/L2", "status": "open"}
|
||||
],
|
||||
"said": "2 milestones."}
|
||||
@@ -0,0 +1,5 @@
|
||||
[
|
||||
{"moved": "2026-10-28T11:13:28Z", "needs": "decision", "number": 1126, "owner": "mesh-controller", "ready": false, "severity": "minor", "since": "2026-10-27T01:01:41Z", "status": "fixing", "title": "About 49,800 controller code lines stay after the delivery model, against a first limit of 25,000", "worker": "lead-47@shanks"},
|
||||
{"moved": "2026-10-28T11:05:21Z", "needs": "none", "number": 1422, "owner": "mesh-controller cmd/mesh-controller/catch_up.go", "ready": true, "severity": "minor", "since": "2026-10-28T09:38:37Z", "status": "fixing", "title": "The catch-up reads the trunk 'main' of repositories the catalogue follows by another branch or by a commit, and the forge holds none", "worker": "fix-trunk-unknown@shanks"},
|
||||
{"moved": "2026-10-28T11:07:31Z", "needs": "decision", "number": 1956, "owner": "mesh-host; mesh-catalog modules/gitea; mesh-delivery; mesh-controller", "ready": true, "severity": "major", "status": "open", "title": "Parts of the mesh still poll or wait on timers instead of reacting to events on the bus"}
|
||||
]
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{"delivery": {"id": "novox/de-spiegel@fba6dbe3259e", "number": 6, "repository": "novox/de-spiegel", "issues": [1126], "state": "merged", "since": "2026-10-28T10:45:28.285947172Z",
|
||||
"title": "Take the practice's public names from config, not the definition (issue 1126)",
|
||||
"check": {"at": "2026-10-28T10:44:13.035037566Z", "gate": "pass", "head": "fba6dbe3259e", "status": "mesh/check", "summary": "pass fba6dbe3259e on 927d302714af | unit 0 run 0 kept | int 0 run 0 kept | clone 31s lint 177ms | composition passed", "trunk": "927d302714af"},
|
||||
"merged_at": "2026-10-28T10:45:00Z",
|
||||
"transitions": [
|
||||
{"at": "2026-10-28T08:49:52.467925371Z", "event": "announced", "from": "", "to": "proposed", "why": "novox/de-spiegel#6's head announced"},
|
||||
{"at": "2026-10-28T08:49:54.046089933Z", "event": "accepted", "from": "proposed", "to": "ready", "why": "a verdict names this commit and the trunk's head as its trunk commit, the gate passed or warned, and the repository's own check did not fail; or the check gates no merge (check-gates-merge false)"},
|
||||
{"at": "2026-10-28T10:45:28.285947172Z", "event": "merged", "from": "ready", "to": "merged", "why": "on the trunk its modules follow: merged there"}
|
||||
]},
|
||||
"machines": "on the machines", "waits": ""}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
{"delivery": {"id": "novox/mesh-catalog@f5d4b2f86ed4", "number": 537, "repository": "novox/mesh-catalog", "issues": [1422], "group": "fix/1422-trunk-unknown", "state": "merged", "since": "2026-10-28T10:34:49.628764012Z",
|
||||
"title": "Gate seeds a never-merged repository's trunk head and follows a retargeted base; gitea announces a retarget and sets a default branch and a pull request's base (issue 1422; group fix/1422-trunk-unknown)",
|
||||
"check": {"at": "2026-10-28T10:30:45.793798647Z", "gate": "pass", "head": "f5d4b2f86ed4", "status": "mesh/check", "summary": "pass f5d4b2f86ed4 on 9fd95693db54 | unit 1329 run, 3852 kept, 13 skipped | integration 1330 run, 3968 kept, 21 skipped | over bound: unit, …", "trunk": "9fd95693db54"},
|
||||
"merged_at": "2026-10-28T10:34:47Z",
|
||||
"transitions": [
|
||||
{"at": "2026-10-28T10:20:56.142821047Z", "event": "announced", "from": "", "to": "proposed", "why": "novox/mesh-catalog#537's head announced"},
|
||||
{"at": "2026-10-28T10:20:58.259805356Z", "event": "accepted", "from": "proposed", "to": "ready", "why": "a verdict names this commit and the trunk's head as its trunk commit, the gate passed or warned, and the repository's own check did not fail; or the check gates no merge (check-gates-merge false)"},
|
||||
{"at": "2026-10-28T10:34:49.628764012Z", "event": "merged", "from": "ready", "to": "merged", "why": "on the trunk its modules follow: merged there"}
|
||||
]},
|
||||
"machines": "on the machines", "waits": ""}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
{"delivery": {"id": "novox/mesh-catalog@470687ea4cce", "number": 539, "repository": "novox/mesh-catalog", "issues": [1422, 1956], "state": "ready", "since": "2026-10-28T11:07:43.555244108Z",
|
||||
"title": "gitea announces from the forge's events, not a poll: an edited base and a close are announced at once, one pass at start (issue 1422)",
|
||||
"check_state": "pending", "merged_at": "0001-01-01T00:00:00Z",
|
||||
"transitions": [
|
||||
{"at": "2026-10-28T11:07:42.740718441Z", "event": "announced", "from": "", "to": "proposed", "why": "novox/mesh-catalog#539's head announced"},
|
||||
{"at": "2026-10-28T11:07:43.555244108Z", "event": "accepted", "from": "proposed", "to": "ready", "why": "a verdict names this commit and the trunk's head as its trunk commit, the gate passed or warned, and the repository's own check did not fail; or the check gates no merge (check-gates-merge false)"}
|
||||
]},
|
||||
"waits": "its merge"}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
{"delivery": {"id": "novox/mesh-delivery@2b801f5bd49a", "number": 94, "repository": "novox/mesh-delivery", "issues": [1126, 1422], "group": "fix/1422-trunk-unknown", "state": "merged", "since": "2026-10-28T10:34:54.759088217Z",
|
||||
"title": "Say loudly what cannot be judged, read only a merge's changed directories, and move the taken key only by an applied merge (issues 1422, 1126; group fix/1422-trunk-unknown)",
|
||||
"check": {"at": "2026-10-28T10:30:45.875693927Z", "gate": "pass", "head": "2b801f5bd49a", "status": "mesh/check", "summary": "pass 2b801f5bd49a on ae7ec702a5e9 | unit 1329 run, 3852 kept, 13 skipped | integration 1330 run, 3968 kept, 21 skipped | over bound: unit, …", "trunk": "ae7ec702a5e9"},
|
||||
"merged_at": "2026-10-28T10:34:51Z",
|
||||
"transitions": [
|
||||
{"at": "2026-10-28T10:20:50.017669046Z", "event": "announced", "from": "", "to": "proposed", "why": "novox/mesh-delivery#94's head announced"},
|
||||
{"at": "2026-10-28T10:20:51.900542745Z", "event": "accepted", "from": "proposed", "to": "ready", "why": "a verdict names this commit and the trunk's head as its trunk commit, the gate passed or warned, and the repository's own check did not fail; or the check gates no merge (check-gates-merge false)"},
|
||||
{"at": "2026-10-28T10:34:54.759088217Z", "event": "merged", "from": "ready", "to": "merged", "why": "on the trunk its modules follow: merged there"}
|
||||
]},
|
||||
"machines": "on the machines", "waits": ""}
|
||||
@@ -88,6 +88,7 @@
|
||||
"seat:issue-tracker.list",
|
||||
"seat:issue-tracker.get",
|
||||
"seat:issue-tracker.milestones",
|
||||
"seat:issue-tracker.changes",
|
||||
"seat:mesh-delivery.deliveries",
|
||||
"seat:mesh-delivery.show",
|
||||
"seat:mesh-delivery.groups"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# *Not:* words with no scope or with (tools). A copy, so a catalogue merge needs nothing else; novox/hq's
|
||||
# words.py compares it with the glossary. Regenerate with: python3 00-META/checks/words.py --list tools
|
||||
build machine
|
||||
catalogue
|
||||
change plan
|
||||
control plane
|
||||
flavor
|
||||
|
||||
Reference in New Issue
Block a user